V
Vincent Foley
Hello all,
I was working on a little script earlier, which I thought was too slow
for my taste. It's now about 5-6x faster than it originally was.
Normally, this would've been enough, but being very curious about Ruby,
I tried to make it go even faster by using micro optimizations. Here
are some things I found out:
* Running your script with the -rprofile option is the first thing you
should do
* Using a Set instead of an Array when you only want to store unique
values can help make your code go faster
* Disabling the GC can slightly increase the speed of your script.
However, I don't think it's a good idea to use in larger applications
That's a few things I found out today. Does anyone else have quick
optimization tips?
I was working on a little script earlier, which I thought was too slow
for my taste. It's now about 5-6x faster than it originally was.
Normally, this would've been enough, but being very curious about Ruby,
I tried to make it go even faster by using micro optimizations. Here
are some things I found out:
* Running your script with the -rprofile option is the first thing you
should do
* Using a Set instead of an Array when you only want to store unique
values can help make your code go faster
* Disabling the GC can slightly increase the speed of your script.
However, I don't think it's a good idea to use in larger applications
That's a few things I found out today. Does anyone else have quick
optimization tips?