GithubHelp home page GithubHelp logo

Comments (3)

eregon avatar eregon commented on August 10, 2024

BTW, I ran mean by curiosity with benchmark-interface on TruffleRuby:

$ chruby 2.6.0
$ benchmark-driver bench/mean.yml
Warming up --------------------------------------
              inject    45.877k i/s -     49.962k times in 1.089042s (21.80μs/i)
               while    39.798k i/s -     43.406k times in 1.090651s (25.13μs/i)
                mean   186.456k i/s -    199.606k times in 1.070528s (5.36μs/i)
Calculating -------------------------------------
              inject    43.879k i/s -    137.631k times in 3.136621s (22.79μs/i)
               while    39.572k i/s -    119.394k times in 3.017167s (25.27μs/i)
                mean   191.036k i/s -    559.366k times in 2.928068s (5.23μs/i)

Comparison:
                mean:    191035.8 i/s 
              inject:     43878.7 i/s - 4.35x  slower
               while:     39571.6 i/s - 4.83x  slower
$ chruby truffleruby-1.0.0-rc11
$ benchmark-driver bench/mean.yml
Warming up --------------------------------------
              inject   622.604k i/s -    628.830k times in 1.010000s (1.61μs/i)
               while   156.294k i/s -    165.984k times in 1.062000s (6.40μs/i)
Calculating -------------------------------------
              inject   685.143k i/s -      1.868M times in 2.726163s (1.46μs/i)
               while   171.896k i/s -    468.881k times in 2.727697s (5.82μs/i)

Comparison:
              inject:    685142.7 i/s 
               while:    171896.3 i/s - 3.99x  slower

So pure Ruby on TruffleRuby is faster than the C extension on MRI :D
As the README says though, inject and while are not precision-compensated algorithms.

from enumerable-statistics.

mrkn avatar mrkn commented on August 10, 2024

@eregon Thank you for the report. I forgot the bench rake task.

I think it is very interesting that comparing precision-compensated algorithms between pure-Ruby on TruffleRuby and C version.

from enumerable-statistics.

mrkn avatar mrkn commented on August 10, 2024

Fixed at c8fe00b

from enumerable-statistics.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.