- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
I am missing List.indexOf
Thu, 2009-02-19, 15:05
Hi,
The implementation of Seq.indexOf is noticably unoptimal for List (in my benchmark). I feel it should be overriden in List with a tailored one.
I have attached a sample implementation and my benchmark. Here is the output:
$ scala -savecompiled -optimise test.scala
For default implementation: 23086 ms
For optimised implementation: 2359 ms
Results match: true
My configuration is:
Scala 2.7.3
java version "1.6.0_0"
IcedTea6 1.4 (fedora-9.b14.fc10-i386) Runtime Environment (build 1.6.0_0-b14)
OpenJDK Client VM (build 14.0-b08, mixed mode)
cheers,
Harshad
PS. In a personal project (which I can't share), a similarly tailored version of indexOf saved execution time by a factor of about 60!