Merge: lib/trees: improve bintrees efficiency
authorJean Privat <jean@pryen.org>
Fri, 8 Aug 2014 17:30:31 +0000 (13:30 -0400)
committerJean Privat <jean@pryen.org>
Fri, 8 Aug 2014 17:30:31 +0000 (13:30 -0400)
commit8e4384be6b4e96b4b7281ac00d63848c3b1f6b29
tree07e139743a6f5295ae7e7a30cd23618dd69eea85
parent784fac2d0d6a1598dc174cfaaa63c0d89d12d34e
parent665485c208ff0a3421ac001c602e33436acce30b
Merge: 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)

Pull-Request: #653
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>