Re: Small optimization tips

I made a script run 800% faster by using the Time class instead of the
DateTime class. You can see the scripts and more details at
http://www.recentrambles.com/pragmatic/view/33 Also, using a “memoize”
function whenever possible can greatly increase performance.

I’m still new to ruby, but what does this mean?

On Wed, 2006-03-15 at 03:53 +0900, Vincent F. wrote:

  • Using a Set instead of an Array when you only want to store unique
    values can help make your code go faster

Charlie B.
http://www.recentrambles.com

On Mar 14, 2006, at 12:59 PM, Charlie B. wrote:

I’m still new to ruby, but what does this mean?

The Set library is a standard library that comes with Ruby. I
believe it uses rbtree if it can be loaded or a plain Hash otherwise,
but it supports the expected set operations and keeps the contents
unique.

James Edward G. II

Thanks, I’ll look that up in the pickaxe book when I get home.

On Wed, 2006-03-15 at 04:04 +0900, James Edward G. II wrote:

Charlie B.
Programmer
Castle Branch Inc.

On Wed, 15 Mar 2006, James Edward G. II wrote:

On Mar 14, 2006, at 12:59 PM, Charlie B. wrote:

I’m still new to ruby, but what does this mean?

The Set library is a standard library that comes with Ruby. I believe it
uses rbtree if it can be loaded or a plain Hash otherwise, but it supports
the expected set operations and keeps the contents unique.

when, oh when, will rbtree be in the core… sigh.

-a

Ah thanks about the Time class. The script I wrote deals with dates,
and I was using Date.strptime. Switching to Time.gm increased the
speed of the script by 4x.

[email protected] wrote:

when, oh when, will rbtree be in the core… sigh.

-a

and it would be nice for it to have some more methods, like #slice! (a
destructive version of #bound).

On Mar 14, 2006, at 1:57 PM, [email protected] wrote:

when, oh when, will rbtree be in the core… sigh.

Isn’t it the library someone was complaining is broken in Ruby
1.8.4? We might need to fix it first.

James Edward G. II

James Edward G. II wrote:

Isn’t it the library someone was complaining is broken in Ruby 1.8.4?
We might need to fix it first.

Did you mean ruby-talk:183166 ? I’ve been using rbtree happily on 1.8.4.

On Mar 14, 2006, at 2:39 PM, Joel VanderWerf wrote:

James Edward G. II wrote:

Isn’t it the library someone was complaining is broken in Ruby 1.8.4?
We might need to fix it first.

Did you mean ruby-talk:183166 ? I’ve been using rbtree happily on
1.8.4.

Oops, yeah, my memory was poor on that one. It looks like it might
be broken on 1.8.2, not 1.8.4. Sorry. My bad.

James Edward G. II