numo-narray icon indicating copy to clipboard operation
numo-narray copied to clipboard

Numo::Int32.parse is much slower in Ruby 3.4.5 than in Ruby 3.3.8

Open puni073 opened this issue 5 months ago • 0 comments

# 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)

puni073 avatar Jul 17 '25 12:07 puni073