[Adium-devl] HOM

Ofri Wolfus ofri.wolfus at gmail.com
Sat Nov 11 15:02:50 UTC 2006


On 11/11/2006, at 16:38, Colin Barrett wrote:

> On Nov 11, 2006, at 4:28 AM, Ofri Wolfus wrote:
>
>> First of all, unit (and speed) tests are included with the source so
>> anyone can see the results on their own machine. On my eMac with
>> 1.25 GHz G4, 768MB RAM and 10.4.7 the results of this example with
>> an array of 3 objects are (each test was performed 1000 times and
>> the results are the average times):
>> NSEnumerator: 0.000010 sec
>> -objectAtIndex: 0.000005 sec
>> -selectWhere: 0.000013 sec
>> -selectWhere: with a cached Message instance: 0.000005 sec
>>
>> For large arrays (with 10000 strings) the results are:
>> NSEnumerator: 0.005581 sec
>> -objectAtIndex: 0.006068 sec
>> -selectWhere: 0.007683 sec
>> -selectWhere: with a cached Message instance: 0.007740 sec
>>
>> With that being said, I the differences between the iterations vary
>> based on the iteration method (e.g. -selectWhere: vs -rejectWhere:)
>> and the collection being used. I think I can safely say that for
>> really large collections HOM is a bit faster, but for small
>> collections it's a bit slower. Anyhow, I think these slight
>> differences in speed are not something that'll be noticeable.
>
> It looks like HOM is slower on that large array than NSEnumerator is.
> Also, why is the cached version slower than the non cached one?

Like I said, the speed varies from one method to another. For  
example, the results of -[NSSet collect:] on a large set are:
NSEnumerator: 0.060574 sec
MSG(): 0.049289 sec
Cached message: 0.049166 sec

I honestly don't know why the cached message test in the previous  
example was slower, but I guess it's due to some other stuff not  
related to my code (you're more than welcome to take a look at the  
tests and see if I missed something ;).

>
> Performance aside, I think it would be tough to graft HOM on to our
> already existing codebase.

I agree, but I suggest new code and future rewrites will use it.

> It looks great if you're developing
> something from scratch and can be very HOMful, but I can see how
> putting it in this late in the game would result in a kind of "stapled
> on" look to the API. Then again, you may have some excellent
> suggestions for refactoring -- don't let us stop you. If you're
> serious about trying to refactor parts of Adium to use HOM, I'd be
> interested to see you do some work in a branch on it :)

When I get the time, I'll start doing it (if no one objects) although  
I don't have any specific plans yet :)
>
> -Colin

- Ofri





More information about the devel mailing list