blob: 1b42d0fb826e42d7281150d782552b93717f59f1 [file] [edit]
# frozen_string_literal: true
require "benchmark/ips"
require "llhttp"
def parse(instance)
instance << "GET / HTTP/1.1\r\n"
instance << "content-length: 18\r\n"
instance << "\r\n"
instance << "body1\n"
instance << "body2\n"
instance << "body3\n"
instance << "\r\n"
end
def benchmark
delegate = LLHttp::Delegate.new
instance = LLHttp::Parser.new(delegate, type: :request)
Benchmark.ips do |x|
x.report do
parse(instance)
instance.finish
end
end
end