Merge: Less char boxings
authorJean Privat <jean@pryen.org>
Wed, 27 Aug 2014 15:11:16 +0000 (11:11 -0400)
committerJean Privat <jean@pryen.org>
Wed, 27 Aug 2014 15:11:16 +0000 (11:11 -0400)
Because of the way the boxing is done in nitg-s, the services in the `Text::chars` view cause unnecessary boxing of chars.

After profiling, we found that the biggest consumers of such boxing are `Lexer::get_token` and `BufferedIStream::read_all`.

Thus, the idea is to implement a efficient `Text::[]` method that do not use the `chars` view. Then to update the two consumers to use it instead.

With `nitg nitg.nit`, the total gain is approx 5%, and the number of boxes of char is reduced by 70% (from 4.8Mboxes to 1.4Mboxes).

Note: this is only an easy workaround until the boxing is done better in nitg (mid-term goal)

Pull-Request: #688
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

1  2 
lib/standard/string.nit

Simple merge