Skip to content

Commit 5024b89

Browse files
committed
improve tstrfloats_bench
1 parent f331368 commit 5024b89

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/benchmarks/tstrfloats_bench.nim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[
22
on OSX:
3-
nim r -d:danger tests/benchmarks/tstrfloats_bench.nim
3+
nim r -d:danger -d:numIter:100_000_00 tests/benchmarks/tstrfloats_bench.nim
44
("toStringSprintf", "genFloatCast", 11.956240000000001)
55
("toStringSprintf", "genFloatConf", 1.581176000000001)
66
("toStringDragonbox", "genFloatCast", 0.1652149999999999)
@@ -9,13 +9,14 @@ nim r -d:danger tests/benchmarks/tstrfloats_bench.nim
99

1010
import std/[times, strfloats]
1111

12+
const numIter {.intdefine.} = 10
13+
1214
template gen(algo, genFloat) =
1315
proc main {.gensym.} =
14-
let n = 100_000_00
1516
var buf: array[strFloatBufLen, char]
1617
var c = 0
1718
let t = cpuTime()
18-
for i in 0..<n:
19+
for i in 0..<numIter:
1920
let x = genFloat(i)
2021
let m = algo(buf, x)
2122
when false: # debugging

0 commit comments

Comments
 (0)