Skip to content

Commit 1f46c40

Browse files
committed
new implementation based on varints
1 parent c823ff1 commit 1f46c40

File tree

3 files changed

+328
-284
lines changed

3 files changed

+328
-284
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ nim c -r -d:release -d:useStdlib benchmark.nim
1313
On my machine, I got these results:
1414

1515
```
16-
packed json: used Mem: 140.063MiB time: 3.127s
16+
packed json: used Mem: 94.06MiB time: 2.622s
1717
stdlib json: used Mem: 1.277GiB time: 3.759s
1818
```

bench/benchmark.nim

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
when defined(useStdlib):
44
import json
55
else:
6-
import packedjson
6+
import ".." / packedjson
77
import strutils, times
88

99
proc main =
1010
let jobj = parseFile("1.json")
1111

1212
let coordinates = jobj["coordinates"]
1313
let len = float(coordinates.len)
14+
doAssert coordinates.len == 1000000
1415
var x = 0.0
1516
var y = 0.0
1617
var z = 0.0
@@ -31,7 +32,8 @@ echo "used Mem: ", formatSize getOccupiedMem(), " time: ", cpuTime() - start, "s
3132
#[
3233
Results on my machine:
3334
34-
packed json: used Mem: 140.063MiB time: 3.127s
35+
packed json: used Mem: 94.06MiB time: 2.622s
36+
old version: used Mem: 140.063MiB time: 3.127s
3537
stdlib json: used Mem: 1.277GiB time: 3.759s
3638
3739
]#

0 commit comments

Comments
 (0)