Skip to content

prime? very slow #3649

@giuan

Description

@giuan

The method prime? is 20x slower then MRI.
But a method implemented by myself give the same time as MRI prime? in MRI and jruby.
I think the problem is in the library prime.
Try

require 'prime'
require 'benchmark'
n = 1090109110921093
Benchmark.bm do |r|
  4.times do
    r.report {puts n.prime?}
  end
end

Tiziano Merzi

P.S.
jruby 9.0.5.0 on MAC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions