# frozen_string_literal: true
require "numo/narray"
require "benchmark"
n = 10**5
input_string = (1..n).map { |i| "#{i} 1 1" }.join("\n")
Benchmark.bm do |x|
x.report("Numo::Int32.parse") do
d = Numo::Int32.parse(input_string)
end
end
Ruby 3.4.5
$ ~/.rubies/ruby-3.4.5/bin/ruby p.rb
user system total real
Numo::Int32.parse 1.166177 0.035384 1.201561 ( 1.203538)
Ruby 3.3.8
$ ~/.rubies/ruby-3.3.8/bin/ruby p.rb
user system total real
Numo::Int32.parse 0.610858 0.011996 0.622854 ( 0.624637)