They say Ruby is slow...
-
@jessejames said:
Well don't give up so easy Dan. I know you to be quite versed in the Ruby language and i think you may also be an accomplished C programmer. Maybe you could offer you expertise to the project? Are you interested?
Perhaps... my list of to-dos is getting longer and longer. C was one of those languages I had to learn (and like Assembly,) have forgotten more than I remember. I can read it and understand what's happening, but I'd really have to reread the old textbook and play around to get comfy again. Some little Ruby extentions might do the trick.@jessejames said:
...just don't blame me if you fall in love with the Python language and lament the shortcomings of all others
Well, there are some things I don't like off the bat with Python. Those hanging indents with no block closures. I was really into Pascal for many years and don't mind the "end" keywords. With the editors we have now, it's nice to have the indent markers that line up the 'begin' and 'end'; I've gotten to rely on those. In Python... wait let me load one of the .py files from SuPy...Ok I see how they will work for Python... a bit strange, but the fold margin gives more info as to where blocks begin and end (at least in notepad++.) I had planned to learn Python for other things, even before I found Sketchup and Ruby.@jessejames said:
PS: i remember a while back you wanting to get wxRuby into the API as a usable GUI kit. I also believe strongly in the power of GUI kits over those atrocious web dialogs. With Python's built in GUI you need look no further!
Yes, but is it cross-platform, as WxRuby/WxWidgets claims to be? GTK+ or Fx or something else? -
And another thread gets hijacked off into dreamy python land...
-
Back on Subject [for a minute] XP(Pro) on Mac/Parallel
1000000.times { 1.0 + 2.0 + 3.0 }; puts Time.now - t t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 }; puts Time.now - t t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 + 5.0 }; puts Time.now - t 0.109 0.469 0.766 1.125 1.422 nil t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 + 5.0 }; puts Time.now - t 1.407 nil t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 }; puts Time.now - t 1.109 nil t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 }; puts Time.now - t 0.765 nil t=Time.now; 1000000.times { 1.0 + 2.0 }; puts Time.now - t 0.453 nil t=Time.now; 1000000.times { 1.0 }; puts Time.now - t 0.109 nil
pasted as a one by mistake, slows it a little...
Now, back off subject.
I posted about suPy.rb before, with very little response,
I've got hypocycloid.py and suPy.rb but I can't get them to run on the Mac, want to take a look?
john -
@driven said:
0.109
0.469
0.766
1.125
1.422Python is still quite a bit quicker. Thanks for posting these specs.
@unknownuser said:
I posted about suPy.rb before, with very little response,
I've got hypocycloid.py and suPy.rb but I can't get them to run on the Mac, want to take a look?I am very sorry i never saw the post. Only a few people have shown interest in SuPy from it's conception, probably due to the bulling from some higher ups in this group when Greg and I tried to announce it. But i will keep on despite the resistance because i know the language has much to offer for the noob programmer. And it would be a good motivator if people showed interest. I still have much docs to write and tutorials which never were completed.
From now on if anyone has questions about SuPy or Python feel free to contact me personally via PM. I will go out of my way to help you no matter what your level of programming skills are. I also help a lot with Ruby, it's just i am more versed in the Python language.
John, I don't have a Mac but i'll do everything in my power to get you up and running. Send me a PM immediately and let me see what i can do. The Good news is Greg is a mac fan so i know he built a solid mac version, or will update it if needed.
-
@dan rathbun said:
@jessejames said:
...just don't blame me if you fall in love with the Python language and lament the shortcomings of all others
Well, there are some things I don't like off the bat with Python. Those hanging indents with no block closures.Once you read code with no redundant end statements you'll wonder how you ever liked them in the first place. The forced indention of Python uses the visual aid of INDENT/DEDENT to mark blocks which the human eye notices much quicker than end or "}" or whatever. Let C hackers "eyeball-parse" brackets like a compiler until they go blind, let humans "read" code naturally!
@unknownuser said:
I had planned to learn Python for other things, even before I found Sketchup and Ruby.
Dan, i will personally give you (or anybody) a crash coarse in the Python language anytime you are ready send me a PM. I will show you everything i know, and i guarantee it won't be a waste of your time, you're going to like this language friend!
@unknownuser said:
@jessejames said:
PS: i remember a while back you wanting to get wxRuby into the API as a usable GUI kit.
Yes, but is it cross-platform, as WxRuby/WxWidgets claims to be? GTK+ or Fx or something else?Absolutely, even more so than wx. I don't know if you have messed around with wx but it is not as cross platform as they claim it to be. Yes it is a good full featured GUI kit but totally cross platform, no way!
@chris fullmer said:
And another thread gets hijacked off into dreamy python land...
Oh Chris, stop being theatrical!
-
@driven said:
I've got hypocycloid.py and suPy.rb but I can't get them to run on the Mac, want to take a look?
I DID download hypocycloid.py John, and looked at the links, viewed some of those videos, the author made at YouTube of his reducer drives. Amazing thing! Didn't know there was such a thing. I have some drive designs that could benefit from a 0 backlash mechanism, but they are not reduction, they would be a 1:3 step-up drive.
Anyhow... most of what I saw was math, not hard to translate to Ruby. The other thing is the calls to DXF would be tranlated to SU geometry calls, and then you'd use the built-in DXF exporter. Also his py file makes a flat profile, which would need to be pushpull'ed up to a given thickness.
I noticed... the DXF example at that guy's website had some of the lobes flawed when I loaded it into AutoCAD.
Anyhow.. have not had time to seriously consider a translation. -
@thomthom said:
...and I believed that. It is after all a scripting language we're talking about. But wow! - it's slow!
> > t=Time.now; 1000000.times { 1.0 }; puts Time.now - t > 0.1 > nil > > > t=Time.now; 1000000.times { 1.0 + 2.0 }; puts Time.now - t > 0.985 > nil > > > t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 }; puts Time.now - t > 1.85 > nil > > > t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 }; puts Time.now - t > 2.76 > nil > > > t=Time.now; 1000000.times { 1.0 + 2.0 + 3.0 + 4.0 + 5.0 }; puts Time.now - t > 3.685 > nil >
If I remember correctly, compilers started adding constant folding in the '80s. This is truly brain dead.
On the other hand, Ruby allows
1_000_000.times ...
when counting zeros gets annoying. A peculiar mixture of great stuff and trash. -
@martinrinehart said:
If I remember correctly, compilers started adding constant folding in the '80s. This is truly brain dead.
Just FYI. Strength Reduction is the transformation that would turn these loops into do_nothing loops. I remember in the late 80's being so impressed with gcc when it would simply remove
for (i=0; i<1000; i++);
because it has no side-effect. -
@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 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.
-
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?
Advertisement