Merge: UTF-8 Strings
authorJean Privat <jean@pryen.org>
Thu, 23 Jul 2015 17:33:29 +0000 (13:33 -0400)
committerJean Privat <jean@pryen.org>
Thu, 23 Jul 2015 17:33:29 +0000 (13:33 -0400)
commitc322d371a74a473934db7dd934746443caa3b215
tree2a4c7f30ca5d75ebba6530ec9c62c74c468734a9
parente38cdeac023e4a8dd2e2341c55c6b9012cfd22b9
parentbbc0adda39a86858f153f8531c59466d218e394f
Merge: UTF-8 Strings

In regard to #1262, and after many rewritings, here's a fully-functional prototype for UTF-8 compliant Strings !

Many things have changed and now, operations on String will need to be considered differently to avoid bad surprises, namely:

- FlatBuffers are slow as hell when getting chars or modifying in-place (and an in-place modification can degenerate if a single-byte char is modified by a multibyte char)
- Length is now potentially expensive (especially within FlatBuffer where it is not cached)
- Indexed access is now O(n), though it is cached for local accesses (except in FlatBuffer)

Performances, for the user time of `nitc src/nitc.nit -o bin/nitc`, has gone from 4.55s to 4.80s, so +5.5%; we have seen worse.

So a little slowdown, but definitely acceptable when introducing UTF-8 in Strings.

Pull-Request: #1277
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
lib/standard/file.nit
src/compiler/abstract_compiler.nit