[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sc-devel] (Identity)Dictionary : includesKey performance



The speed difference is embarrassing, about a hundredfold speedup on
my machine! I'd agree with this suggestion. It looks like it still
responds correctly to nils etc. Any reason not to?

Dan

2007/12/5, Sciss <contact@xxxxxxxx>:
> hello,
>
> should we change includesKey in Dictionary and IdentityDictionary to
> call 'at', since that is a lot faster? :
>
> x = IdentityDictionary.new;
> (1..1000).do({ arg key; x.put( key, \lala )})
>
> { a = 2000.collect({ arg key; x.includesKey( key )})}.bench;
> { b = 2000.collect({ arg key; x.at( key ).notNil })}.bench;
> a == b
>
> x = Dictionary.new;
> (1..1000).do({ arg key; x.put( key, \lala )})
>
> { a = 2000.collect({ arg key; x.includesKey( key )})}.bench;
> { b = 2000.collect({ arg key; x.at( key ).notNil })}.bench;
> a == b;
>
>
>
> ciao, -sciss-
>
> _______________________________________________
> Sc-devel mailing list
> Sc-devel@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
>


-- 
http://www.mcld.co.uk