[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Small optimization tips

Charlie Bowman

3/14/2006 7:00:00 PM

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.recentr.../pragmat... 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 Foley wrote:

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

Charlie Bowman
http://www.recentr...
10 Answers

James Gray

3/14/2006 7:04:00 PM

0

On Mar 14, 2006, at 12:59 PM, Charlie Bowman 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 Gray II


Charlie Bowman

3/14/2006 7:17:00 PM

0

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 Gray II wrote:

> On Mar 14, 2006, at 12:59 PM, Charlie Bowman 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 Gray II
>
>

Charlie Bowman
Programmer
Castle Branch Inc.

Vincent Foley

3/14/2006 7:23:00 PM

0

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.

Ara.T.Howard

3/14/2006 7:57:00 PM

0

Joel VanderWerf

3/14/2006 8:14:00 PM

0

ara.t.howard@noaa.gov wrote:
> On Wed, 15 Mar 2006, James Edward Gray II wrote:
>
>> On Mar 14, 2006, at 12:59 PM, Charlie Bowman 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

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

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


James Gray

3/14/2006 8:30:00 PM

0

On Mar 14, 2006, at 1:57 PM, ara.t.howard@noaa.gov wrote:

> On Wed, 15 Mar 2006, James Edward Gray II wrote:
>
>> On Mar 14, 2006, at 12:59 PM, Charlie Bowman 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.

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

James Edward Gray II


Joel VanderWerf

3/14/2006 8:40:00 PM

0

James Edward Gray II wrote:
> Isn't it the library someone was complaining is broken in Ruby 1.8.4?
> We might need to fix it first. <laughs>

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

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407


James Gray

3/14/2006 8:47:00 PM

0

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

> James Edward Gray II wrote:
>> Isn't it the library someone was complaining is broken in Ruby 1.8.4?
>> We might need to fix it first. <laughs>
>
> 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 Gray II


Jokho Nyingkir

9/2/2010 10:29:00 AM

0

b?mb?? <batoekaras@cavecove.com> wrote in news:4c7f79f0$1@x-privat.org:

> On 9/2/2010 5:07 PM, JockoThinker wrote:
>> Sekali - kali biar merasa mendapatkan kemenangan .... kan Girang
>> Bener .... ...
>>
>> Soalnya selama Ini selalu posisi .. tersudut ... dan tak mampu
>> berargumentasi ...
>>
>> hehehehe .................
>
> anggap saja hadiyah lebaran oentoe oztadt ?on and the gang.
>

ahh itu pan perangsaan blionya saja,

semua orang juga sah2 saja di NG ini kalo menganggap orang laen

nyang kalah kita nyang menang, atau orang laen dongok kita nyang D3

toh ini cumming donia maya, forum tak ber moderasi, gak ada juri

dan wasit

malah di sini ada nyang sering banget jadi wasit merangkap
pemaen merangkap penonton bahkan sekalian jadi bola, tiang
gawang, jala, rumput dan bangku penonton serta gedung stadionnya
sekalean ...... serakah dan norak bangets sek belionyah !


JIAKAKAKAKAKAKAKAKAKAKAKAKAKAKKAKAKAKAKKAKAKAKAKAK


**) tapi kalo biang nyang paleng dongok sak-universe tak terbantahkan seh
tetep belio nyah our veloved bozo clown nyang noles di internet :
"jangan procaya tolesan2 di internet"

jiakakakakakakakakkak lage ahh !

darion

9/2/2010 12:57:00 PM

0

On Sep 2, 12:18 pm, bámbÖö <batoeka...@cavecove.com> wrote:
> On 9/2/2010 5:17 PM, bámbÖö wrote:
>
> > On 9/2/2010 5:07 PM, JockoThinker wrote:
> >> Sekali - kali biar merasa mendapatkan kemenangan .... kan Girang
> >> Bener .... ...
>
> >> Soalnya selama Ini selalu posisi .. tersudut ... dan tak mampu
> >> berargumentasi ...
>
> >> hehehehe .................
>
> > anggap saja hadiyah lebaran oentoe oztadt Öon and the gang.
>
> Ups loepa , kesaksian adalah tanpa boekti , coekoep dogma bin taqiya.

mBill, jelas nggak tuh ?
lamtaran iku si mBill pracaya banget samah kasaksian Pak Ulus.