performance
This commit is contained in:
parent
6f5fbd20c7
commit
d1c353d23b
13
README.md
13
README.md
|
@ -14,7 +14,7 @@ I have also verified that Zippy builds with `--experimental:strictFuncs` on Nim
|
||||||
|
|
||||||
### Performance
|
### Performance
|
||||||
|
|
||||||
Benchmarks can be run comparing different Zip implementations. Check the performance yourself by running [tests/benchmark.nim](https://github.com/guzba/zippy/blob/master/tests/benchmark.nim).
|
Benchmarks can be run comparing different Zip implementations. My benchmarking shows this library performs well but it is not as fast as zlib itself (not a surprise). Check the performance yourself by running [tests/benchmark.nim](https://github.com/guzba/zippy/blob/master/tests/benchmark.nim).
|
||||||
|
|
||||||
`nim c --gc:arc -d:release -r .\tests\benchmark.nim` (1000 uncompresses, lower time is better)
|
`nim c --gc:arc -d:release -r .\tests\benchmark.nim` (1000 uncompresses, lower time is better)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ randtest3.z | 0.0519s
|
||||||
rfctest3.z | 0.3295s
|
rfctest3.z | 0.3295s
|
||||||
alice29.txt.z | 1.4704s
|
alice29.txt.z | 1.4704s
|
||||||
urls.10K.z | 7.3240s
|
urls.10K.z | 7.3240s
|
||||||
fixed.z | 6.8125s
|
fixed.z | 6.6955s
|
||||||
|
|
||||||
https://github.com/treeform/miniz results:
|
https://github.com/treeform/miniz results:
|
||||||
File | Time
|
File | Time
|
||||||
|
@ -36,6 +36,15 @@ alice29.txt.z | 3.3442s
|
||||||
urls.10K.z | 16.1209s
|
urls.10K.z | 16.1209s
|
||||||
fixed.z | 19.8003s
|
fixed.z | 19.8003s
|
||||||
|
|
||||||
|
https://github.com/nim-lang/zip results:
|
||||||
|
File | Time
|
||||||
|
--- | ---:
|
||||||
|
randtest3.z | 0.0061s
|
||||||
|
rfctest3.z | 0.1285s
|
||||||
|
alice29.txt.z | 0.4918s
|
||||||
|
urls.10K.z | 2.2510s
|
||||||
|
fixed.z | 2.1033s
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
`nimble test`
|
`nimble test`
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import std/monotimes, strformat, zippy, miniz
|
import std/monotimes, strformat, zippy, miniz, zip/zlib
|
||||||
|
|
||||||
const
|
const
|
||||||
files = [
|
files = [
|
||||||
|
@ -35,3 +35,16 @@ block treeform_miniz:
|
||||||
inc(c, uncompressed.len)
|
inc(c, uncompressed.len)
|
||||||
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
|
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
|
||||||
echo &" {file}: {delta:.4f}s [{c}]"
|
echo &" {file}: {delta:.4f}s [{c}]"
|
||||||
|
|
||||||
|
block nimlang_zip: # Requires zlib1.dll
|
||||||
|
echo "https://github.com/nim-lang/zip"
|
||||||
|
for file in files:
|
||||||
|
let
|
||||||
|
compressed = readFile(&"tests/data/{file}")
|
||||||
|
start = getMonoTime().ticks
|
||||||
|
var c: int
|
||||||
|
for i in 0 ..< iterations:
|
||||||
|
let uncompressed = zlib.uncompress(compressed, stream=ZLIB_STREAM)
|
||||||
|
inc(c, uncompressed.len)
|
||||||
|
let delta = float64(getMonoTime().ticks - start) / 1000000000.0
|
||||||
|
echo &" {file}: {delta:.4f}s [{c}]"
|
||||||
|
|
Loading…
Reference in New Issue