Rakefile in zser-0.0.0 vs Rakefile in zser-0.0.1
- old
+ new
@@ -6,6 +6,20 @@
RSpec::Core::RakeTask.new
require "rubocop/rake_task"
RuboCop::RakeTask.new
-task default: %w(spec rubocop)
+task default: %w[spec rubocop]
+
+task :bench do
+ require "benchmark/ips"
+ require "zser"
+
+ Benchmark.ips do |b|
+ input = "\xE9\xF4\x81\x80\x80\x80@".dup.force_encoding("BINARY").freeze
+
+ b.report("zsint encode") { Zser::Varint.encode(281_474_976_741_993) }
+ b.report("zsint decode") { Zser::Varint.decode(input) }
+
+ b.compare!
+ end
+end