mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
parent
b6ad235990
commit
fea624a05b
3 changed files with 0 additions and 71 deletions
|
@ -1,3 +0,0 @@
|
|||
# encoding: utf-8
|
||||
require "benchmark/ips"
|
||||
require "logstash/instrument/collector"
|
|
@ -1,17 +0,0 @@
|
|||
# encoding: utf-8
|
||||
require "benchmark/ips"
|
||||
require "logstash/event"
|
||||
|
||||
options = { :time => 10, :warmup => 60 }
|
||||
puts "Same Event instance"
|
||||
|
||||
event = LogStash::Event.new("foo" => {"bar" => {"foobar" => "morebar"} })
|
||||
STDERR.puts ""
|
||||
STDERR.puts " ----------> event.get(\"[foo][bar][foobar]\") => #{event.get("[foo][bar][foobar]")}"
|
||||
STDERR.puts ""
|
||||
|
||||
Benchmark.ips do |x|
|
||||
x.config(options)
|
||||
|
||||
x.report("Deep fetch") { event.get("[foo][bar][foobar]") }
|
||||
end
|
|
@ -1,51 +0,0 @@
|
|||
# encoding: utf-8
|
||||
require "benchmark/ips"
|
||||
require "lib/logstash/event"
|
||||
|
||||
options = { :time => 10, :warmup => 10 }
|
||||
puts "Same Event instance"
|
||||
Benchmark.ips do |x|
|
||||
x.config(options)
|
||||
event = LogStash::Event.new("foo" => "bar",
|
||||
"foobar" => "morebar")
|
||||
|
||||
x.report("Complex cached: Event#sprintf") { event.sprintf("/first/%{foo}/%{foobar}/%{+YYY-mm-dd}") }
|
||||
x.report("Date only cached: Event#sprintf") { event.sprintf("%{+YYY-mm-dd}") }
|
||||
x.report("string only cached: Event#sprintf") { event.sprintf("bleh") }
|
||||
x.report("key only cached: Event#sprintf") { event.sprintf("%{foo}") }
|
||||
x.compare!
|
||||
end
|
||||
|
||||
puts "New Event on each iteration"
|
||||
Benchmark.ips do |x|
|
||||
x.config(options)
|
||||
|
||||
|
||||
x.report("Complex cached: Event#sprintf") do
|
||||
event = LogStash::Event.new("foo" => "bar",
|
||||
"foobar" => "morebar")
|
||||
event.sprintf("/first/%{foo}/%{foobar}/%{+YYY-mm-dd}")
|
||||
end
|
||||
|
||||
|
||||
x.report("Date only cached: Event#sprintf") do
|
||||
event = LogStash::Event.new("foo" => "bar",
|
||||
"foobar" => "morebar")
|
||||
|
||||
event.sprintf("%{+YYY-mm-dd}")
|
||||
end
|
||||
|
||||
x.report("string only cached: Event#sprintf") do
|
||||
event = LogStash::Event.new("foo" => "bar",
|
||||
"foobar" => "morebar")
|
||||
event.sprintf("bleh")
|
||||
end
|
||||
|
||||
x.report("key only cached: Event#sprintf") do
|
||||
event = LogStash::Event.new("foo" => "bar",
|
||||
"foobar" => "morebar")
|
||||
event.sprintf("%{foo}")
|
||||
end
|
||||
|
||||
x.compare!
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue