Merge: Optimize get_or_null
authorJean Privat <jean@pryen.org>
Wed, 4 Feb 2015 08:38:06 +0000 (15:38 +0700)
committerJean Privat <jean@pryen.org>
Wed, 4 Feb 2015 08:38:06 +0000 (15:38 +0700)
Recent profiling of the interpreter nit shows that a lof of time is used in hashmaps. This PR improves the standard use-path with the safe method `get_or_null` that is more efficient (and simple) than `has_key` followed by `[]`.

The time for `nit doors_with_classes.nit 5000` give

before: 0m5.592s
after: 0m5.208s (-6,7%)

Note: by comparison, the ruby version is 0m2.284s, and the python is 0m0.116s ; there is still a lot of work

Pull-Request: #1139
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>


Trivial merge