[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | David Monniaux <David.Monniaux@e...> |
| Subject: | Pervasives.compare: slow? |
I used Pervasives.compare as a comparison function between hash values (16-byte strings). Pervasives.compare is a polymorphic hack that works by induction on the type information left for the garbage collector; even if you specify Pervasives.compare : string -> string -> int, it still invokes the polymorphic function. There is apparently a 20-25% performance penalty using this form instead of a simple comparison procedure for 16-byte strings. I suspect the performance hit is even higher for more complex data structures. Would it be possible to have ad hoc generated comparison functions? That sounds like it needs including polytypic features into the language, which is some very big stuff. Perhaps including a String.compare function would be easier. Regards, David Monniaux http://www.di.ens.fr/~monniaux Laboratoire d'informatique de l'École Normale Supérieure, Paris, France