They say Ruby is slow...
-
@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 intofunc( 3.0 ). -
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 nilWhich 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.
-
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?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement