3 ms·
Not meant to be a thread hijack, but I guess it is anyway... I put up a blog post last night with some troubles I was having in Gambit (my site with the post:
by rpdillon 17y ago
Not meant to be a thread hijack, but I guess it is anyway...
I put up a blog post last night with some troubles I was having in Gambit (my site with the post: http://etherplex.org http://etherplex.org) I'm very new to non-JVM hosted languages, so I'm not yet sensitive to where the performance pitfalls are.
Essentially, a professor of mine gave me a program in C that boiled down to a for loop doing 144 million iterations with a check inside of it, and an increment if the check passes. The C program runs in 1 second, and the straight port to Gambit I attempted runs in about 8 minutes.
I posted code, in hopes someone might spot my error. Are nested do statements or let statements particularly expensive, or did I make some bone-headed mistake somewhere when I ported it over? It's not meant to be functional (yet), I thought I'd just start with an imperative implementation and go from there, since that was what the original code was. Thoughts?
- jlongster 17y agoI will take a look at it later tonight. But the first thing you need to do is add this to the top of your Scheme file: (declare (block) (standard-bindings) (extended-bindings)) These are statements to let the compiler optimize things, losing some dynamicism. That should increase it a lot. When it comes to tight loops, Gambit doesn't usually do as good of a job because of its garbage collector (it doesn't optimize for lots of small short-lived objects), which is planned to be fixed in the future.
- rpdillon 17y agoThanks very much...those settings don't seem to help much, but they've led me to the area of the documentation that I haven't looked at before. I'll read through it and learn a bit more about the compiler settings.
- grettke 17y agoYou might post it to a Scheme related list: http://www.wisdomandwonder.com/scheme http://www.wisdomandwonder.com/scheme