INNER CODE UNIT · Swift

runBenchmarks

Arthur-Ficial/apfel · Sources/Benchmark.swift:38

func runBenchmarks() async throws {
    let report = try await benchmarkReport()
    switch outputFormat {
    case .json:
        print(jsonString(report, pretty: false))
    case .plain:
        print("""
        \(styled("apfel", .cyan, .bold)) v\(report.version) — benchmark report
        model: \(report.environment.model)
        context: \(report.environment.context_window) tokens
        token counter available: \(report.environment.token_counter_available)
        """)
        for result in report.benchmarks {
            let baseline = result.baseline_avg_ms.map { String(format: "%.3f ms", $0) } ?? "n/a"
            let speedup = result.speedup_ratio.map { String(format: "%.2fx", $0) } ?? "n/a"
            print("""
            \(styled("•", .dim)) \(result.name)
              iterations: \(result.iterations)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…