Skip to content

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

@puni073

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions