Re: Which is faster ?
- Posted by mattlewis (admin) Feb 17, 2009
- 969 views
bernie said...
On a long sequence of items which is faster using the
find() function or searching with a for loop ???
find() should always be faster than a manual loop. In fact, find() is even faster in 4.0 than it was in 3.1. If the list gets too long, however, other methods may be able to beat it, such as a binary search (of which there is an implementation in the 4.0 std library). But of course, you have to make sure that you sort your data first.
Matt