Skip to content

Conversation

@jhermsmeier
Copy link
Contributor

@jhermsmeier jhermsmeier commented Nov 3, 2017

This replaces matcha with nanobench, which will enable us to easily compare between changes and versions with nanobench-compare.

$ node benchmark/bencode.js
NANOBENCH version 2
> node benchmark/bencode.js

# bencode.encode() [buffer] ⨉ 10000
ok ~474 ms (0 s + 473525130 ns)

# bencode.encode() [utf8] ⨉ 10000
ok ~8.74 s (8 s + 743247355 ns)

# bencode.encode() [ascii] ⨉ 10000
ok ~699 ms (0 s + 699163950 ns)

# bencode.encode() [binary] ⨉ 10000
ok ~2.32 s (2 s + 322715866 ns)

# bencode.decode() [buffer] ⨉ 10000
ok ~199 ms (0 s + 198994278 ns)

# bencode.decode() [utf8] ⨉ 10000
ok ~6.01 s (6 s + 5084972 ns)

# bencode.decode() [ascii] ⨉ 10000
ok ~411 ms (0 s + 411197073 ns)

# bencode.decode() [binary] ⨉ 10000
ok ~137 ms (0 s + 137260635 ns)

all benchmarks completed
ok ~19 s (18 s + 991189259 ns)

One thing to note is also that this gives us higher resolution timing on an iteration level; for example the ~8.74 s for the UTF8 encoding run might seem terribly slow, but that's only 0.874 ms per iteration – on a 27 KB torrent file.

@jhermsmeier jhermsmeier requested a review from themasch November 3, 2017 00:42
@themasch themasch merged commit 9a66652 into master Nov 6, 2017
@themasch themasch deleted the benchmarks branch November 6, 2017 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants