Skip to content

Commit

Permalink
Always use nanoseconds for benchmark times
Browse files Browse the repository at this point in the history
  • Loading branch information
juri committed Aug 1, 2023
1 parent 5ec33b3 commit 1d524b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
6 changes: 5 additions & 1 deletion Benchmarks/ParserBenchmarks/ParserBenchmarks.swift
Expand Up @@ -2,7 +2,11 @@ import Benchmark
import Foundation
import Parse3339

let config = Benchmark.Configuration(maxDuration: .seconds(30), maxIterations: 100_000)
let config = Benchmark.Configuration(
timeUnits: .nanoseconds,
maxDuration: .seconds(30),
maxIterations: 100_000
)

let benchmarks = {
Benchmark("Parse with Parse3339 (DateComponents)", configuration: config) { benchmark in
Expand Down
28 changes: 14 additions & 14 deletions README.md
Expand Up @@ -63,11 +63,11 @@ Parse with DateFormatter
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Memory (resident peak) (M) │ 11 │ 15 │ 19 │ 23 │ 25 │ 27 │ 27 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Throughput (# / s) (K) │ 16 │ 16 │ 16 │ 16 │ 16145 │ 100000 │
│ Throughput (# / s) (K) │ 17 │ 16 │ 16 │ 16 │ 15121 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (total CPU) (μs) │ 60 61 61 61 61 68 180 │ 100000 │
│ Time (total CPU) (ns) │ 59084 59967 60255 61887 64927 82175 236750 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (wall clock) (μs) │ 59 60 60 60 61 67 188 │ 100000 │
│ Time (wall clock) (ns) │ 58500 59391 59647 61279 64255 83327 513167 │ 100000 │
╘════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛
Parse with ISO8601DateFormatter
Expand All @@ -76,13 +76,13 @@ Parse with ISO8601DateFormatter
╞════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡
│ Malloc (total) │ 496 │ 496 │ 496 │ 496 │ 496 │ 496 │ 497 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Memory (resident peak) (K) │ 9748976497649764976497649764 │ 100000 │
│ Memory (resident peak) (K) │ 9764978197819781978197819781 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Throughput (# / s) (K) │ 10 │ 10 │ 10 │ 10 │ 10 │ 92 │ 100000 │
│ Throughput (# / s) (K) │ 11 │ 10 │ 10 │ 10 │ 10 │ 70 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (total CPU) (μs) │ 94 95 95 95 95 103 293 │ 100000 │
│ Time (total CPU) (ns) │ 91375 92351 92799 95551 99519 123007 542458 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (wall clock) (μs) │ 93 94 94 94 95 102 │ 384 │ 100000 │
│ Time (wall clock) (ns) │ 90792 91711 92159 94911 98879 127487 │ 3553542 │ 100000 │
╘════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛
Parse with Parse3339 (DateComponents)
Expand All @@ -93,11 +93,11 @@ Parse with Parse3339 (DateComponents)
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Memory (resident peak) (M) │ 9 │ 41 │ 73 │ 105 │ 124 │ 136 │ 137 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Throughput (# / s) (K) │ 424141 │ 41 │ 393310 │ 100000 │
│ Throughput (# / s) (K) │ 434242 │ 41 │ 3829 4 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (total CPU) (μs) │ 24 24 24 24 26 30 100 │ 100000 │
│ Time (total CPU) (ns) │ 23416 23999 24223 25007 26463 34751 206791 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (wall clock) (μs) │ 23 23 24 24 25 29 96 │ 100000 │
│ Time (wall clock) (ns) │ 22833 23423 23631 24383 25807 34335 211458 │ 100000 │
╘════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛
Parse with Parse3339 (Unix time)
Expand All @@ -106,12 +106,12 @@ Parse with Parse3339 (Unix time)
╞════════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡
│ Malloc (total) │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Memory (resident peak) (K) │ 7798783178317831783178317831 │ 100000 │
│ Memory (resident peak) (K) │ 7831785278647864786478647864 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Throughput (# / s) (K) │ 260 │ 252 │ 25024724422824 │ 100000 │
│ Throughput (# / s) (K) │ 263 │ 252 │ 24724223318317 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (total CPU) (ns) │ 4374 │ 4503 │ 450345434627504341166 │ 100000 │
│ Time (total CPU) (ns) │ 4333 │ 4503 │ 454346674875654348584 │ 100000 │
├────────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Time (wall clock) (ns) │ 3834 │ 3959 │ 400140414083437540625 │ 100000 │
│ Time (wall clock) (ns) │ 3791 │ 3959 │ 404141274291545956625 │ 100000 │
╘════════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛
```

0 comments on commit 1d524b8

Please sign in to comment.