DescriptionProvide CommandLine::HasSwitch(const char*) to save 76kB in sizes perf
Currently every callsite to CommandLine::HasSwitch() has to generate
code to allocate a string on the stack, malloc(), copy characters from
the switch constant, and then free things when it goes out of scope.
Testing on a Mac release build, this results in about 76kB of generated
object code. (about 40 bytes for each of the ~1928 calls in the non-test
codebase).
Adding a char[] overload allows this codegen to happen only once. And
there's no lost inlining benefit since the new overload can inline its
call instead.
BUG=468184
Committed: https://crrev.com/009a1dc860942184fc6abdb4bedf854b15da7d91
Cr-Commit-Position: refs/heads/master@{#322737}
Patch Set 1 #Patch Set 2 : Use StringToLowerASCII, fix tests #Patch Set 3 : skip the case optimization #
Total comments: 1
Messages
Total messages: 17 (4 generated)
|