sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    They say Ruby is slow...

    Scheduled Pinned Locked Moved Developers' Forum
    23 Posts 9 Posters 3.0k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      MartinRinehart
      last edited by

      @adamb said:

      Strength Reduction is the transformation that would turn these loops into do_nothing loops.

      Yes, but that's for really sharp compilers. I was just expecting func( 1.0 + 2.0 ) to be turned into func( 3.0 ).

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Revisiting this on the computer I use at work - which is similar to what I used in the first post:

        
        t=Time.now; 1000000.times { 1.0 }; puts Time.now - t
        0.109
        nil
        t=Time.now; 1000000.times { 1.0 + 2.0 }; puts Time.now - t
        0.515
        nil
        t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 }; puts Time.now - t
        0.873
        nil
        t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 }; puts Time.now - t
        1.264
        nil
        t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 + 5.0 }; puts Time.now - t
        1.638
        nil
        
        

        Which aligns better with what others have posted. My initial results in the first post seem to be an abnormality. But there is still significant performance hit.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • L Offline
          l.frisken
          last edited by

          why don't we just start discussing Lua while we're at it?

          no, but seriously
          Python is just a different language. I learned to use it before ruby, but then I discovered ruby, which I prefer for many reasons other than it's speed, which as mentioned is slow. Yes compulsory indentation is nice in some respects, but it is a complete and utter pain when mixing tabs with spaces (can't see where the problem is). Ruby allows for more creative formatting of the code (which can be very nice). I like them both, and don't we all wish the best of both could be combined?

          1 Reply Last reply Reply Quote 0
          • 1
          • 2
          • 2 / 2
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement