Optimize `chars2bytes` with `MRB_UTF8_STRING` to ASCII only string
### Benchmark (with `MRB_UTF8_STRING`) ``` $ mruby -e ' COUNT = 150000 SIZE = 10000 strs = Array.new(COUNT) do s = "a" * SIZE s.size # set `MRB_STR_ASCII` flag s end i = 0 t = Time.now while i < COUNT strs[i][-2..-1] = "" i += 1 end printf "%.2f sec\n", Time.now - t ' 1.10 sec # before 0.07 sec # after ```
Showing
Please register or sign in to comment