lib/trees: improve bintrees efficiency
authorJean Privat <jean@pryen.org>
Thu, 7 Aug 2014 02:04:46 +0000 (22:04 -0400)
committerJean Privat <jean@pryen.org>
Thu, 7 Aug 2014 02:19:00 +0000 (22:19 -0400)
commit665485c208ff0a3421ac001c602e33436acce30b
tree1b6c44bdc4d39c673dcbb9acd2c7ab5c6e0452b5
parent1d032767b9143171f8e69789d7764c31926f3049
lib/trees: improve bintrees efficiency

First, comment potential slow asserts in the hot-path.
These asserts are needed only to check that the implementation is
correct.

Second, use a single `<=>` instead of doing multiple comparisons.
So reduce the total number of comparisons.

On a real instance (IA-related problems), the gain is the following:

RBTreeMap, 8738 insertions, 24855 accesses
Before: 2.54s
After: 0.07s (so, in the noise)

Signed-off-by: Jean Privat <jean@pryen.org>
lib/trees/bintree.nit