Closed martin308 closed 4 years ago
Benchmarking, using the following code and pointing at a local endpoint that just returns 200.
require "benchmark"
require "libhoney"
libhoney = Libhoney::Client.new(writekey: writekey, dataset: dataset, api_host: "localhost:4567")
Benchmark.bm do |b|
b.report do
1000.times do
event = libhoney.event
event.add({ wow: "wee", "wee" => "wow" })
event.add_field("look", "here")
event.send
end
libhoney.close(true)
end
end
Current version:
user | system | total | real |
---|---|---|---|
0.058666 | 0.025970 | 0.084636 | ( 0.077860) |
0.065547 | 0.031916 | 0.097463 | ( 0.089169) |
0.060360 | 0.027771 | 0.088131 | ( 0.081538) |
0.060432 | 0.027913 | 0.088345 | ( 0.080946) |
0.064040 | 0.032437 | 0.096477 | ( 0.087880) |
0.056276 | 0.025963 | 0.082239 | ( 0.075059) |
0.061170 | 0.026536 | 0.087706 | ( 0.081571) |
0.059400 | 0.026908 | 0.086308 | ( 0.078791) |
0.057387 | 0.026713 | 0.084100 | ( 0.076532) |
0.059217 | 0.026823 | 0.086040 | ( 0.078644) |
This version:
user | system | total | real |
---|---|---|---|
0.062588 | 0.026430 | 0.089018 | ( 0.081445) |
0.063945 | 0.027953 | 0.091898 | ( 0.083822) |
0.063435 | 0.026462 | 0.089897 | ( 0.082740) |
0.073152 | 0.028985 | 0.102137 | ( 0.098140) |
0.064425 | 0.025991 | 0.090416 | ( 0.082965) |
0.062538 | 0.025697 | 0.088235 | ( 0.081180) |
0.065444 | 0.025701 | 0.091145 | ( 0.084251) |
0.060570 | 0.026059 | 0.086629 | ( 0.079202) |
0.061412 | 0.025793 | 0.087205 | ( 0.079637) |
0.062734 | 0.026838 | 0.089572 | ( 0.082099) |
@maplebed added some benchmarks, there seems to be a small hit to performance with this code but I think the advantages to having events not being dropped makes up for it. I also added some additional comments to the cleaning code. Let me know more clarification is needed.
In the case of an error serializing the events data the event gets dropped. This adds some ability to clean the data object so that it can still be sent. This should fix #36 and https://github.com/honeycombio/beeline-ruby/issues/41
Benchmarking, using the following code and pointing at a local endpoint that just returns 200.
Current version:
This version: