retard:
> 0. use a better algorithm (the big O notation matters, like in this case)

This is a big mistake, because:
- Optimizing before you know what to optimize is premature optimization. The 
profiler is one of the best tools to find what to optimize.
- Often data structures and algorithms are a trade-off between different needs. 
So "better" is not absolute, it's problem-specific, and the profiler helps to 
find such specific problems.

And regarding the problem of searching in a sequence of items, if the sequence 
is small (probably up to 10 or 20 if the items are integers, the language is a 
low level one and the associative array is not very efficient), a linear search 
or a binary search is often faster.

---------------

dsimcha:
>While writing assembly is notoriously hard (I've never even tried for anything 
>non-trivial), 

Using well certain Java frameworks is harder :-)

Bye,
bearophile

Reply via email to