chore(tests): Add benchmark tests for new and old netbox comparison
- Adds benchmarks for netbox and network client comparison
- Refactors benchmarks (removes
run_benchmarks.lua
and unifies its logic withrun_tests.lua
) - Removes BenchBulkInsert (see MR comments)
Results
Results on my machine:
test call_netbox ... bench: 38,066 ns/iter (+/- 3,499)
test call_network_client ... bench: 62,442 ns/iter (+/- 4,348)
test ping_client_tcp_stream ... bench: 8,652 ns/iter (+/- 3,486)
test ping_coio_stream ... bench: 7,703 ns/iter (+/- 800)
test start_async_runtime ... bench: 265 ns/iter (+/- 5)
We can make the following conclusions:
-
netbox
is 1.5 times faster thannetwork::client
- async
tcp_stream
is nearly same ascoio_stream
-
runtime
initialization can not be fully blamed fornetwork::client
being slower.
My working theory is that network::client
is slower due to its sans-io architecture.
E.g. where netbox
was directly decoding/encoding the stream of input/output bytes,
network::client
has to buffer them first.
Edited by Егор Ивков