New issue
Advanced search Search tips

Issue 751132 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Feature



Sign in to add a comment

Optimise DoIsStringASCII

Project Member Reported by ricea@chromium.org, Aug 1 2017

Issue description

DoIsStringASCII in //base/strings/string_util.cc is unbelievably hot on Windows due to being used in base::UTF8ToWide.

There don't currently appear to be any benchmarks for it, so that would be the first step towards making it faster.

It reads the input one machine word at a time, which is a good implementation strategy, but a couple of possible improvements come to mind:

1. Switch to vector ops for longer strings. This could give maybe 10% speed improvement?
2. It currently checks if the start of the string is word-aligned and processes one character at a time up to the word boundary. If I recall correctly, on Intel implementations of x86 unaligned reads are just as fast as aligned reads, so the conditional branch could be removed.
3. Nitpicking the disassembly would probably highlight some small improvements.
 

Sign in to add a comment