Can you shrink it further?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 11 07:16:54 PDT 2016


On 10/11/2016 04:57 AM, Stefan Koch wrote:
> Yours runs with 790 us best time.
> bsr is a real timetaker :)

What inputs did you test it on?

Here's what I think would be a good set of requirements:

* The ASCII case should be short and fast: a comparison and a branch, 
followed by return. This would improve a very common case and address 
the main issue with autodecoding.

* For the multibyte case, the main requirement is the code must be 
small. This is because it gets inlined all over the place and seldom used.

* For the multibyte case, the fewer bytes in the encoding the less work. 
This is because more frequent multi-byte characters have generally lower 
codes.

Currently front() - the other time spender in autodecoding - issues a 
function call on the multibyte case. That makes the code of front() 
itself small, at the cost of more expensive multibyte handling.


Andrei



More information about the Digitalmars-d mailing list