DescriptionOptimise IntToString by avoiding string allocation.
Use a fixed-sized temporary buffer on the stack for IntToString and
variants, rather than allocating a string.
This reduces the time to run IntToString in a microbenchmark by 70%, and
the code size by 30%, both on Android arm7. See the bug for more details.
Since all the *Int*ToString* functions share a common implementation,
they all benefit from this change.
Security implications: If this function overflowed its buffer, then this
change would change a heap overflow bug to a stack overflow
bug. However, the unit tests in combination with the DCHECKs in the code
provide a strong guarantee that this function does not overflow its
buffer. The compiler also adds stack-smashing protection.
BUG=535972
TEST=base_unittests
Committed: https://crrev.com/ad547d8741b466f19d50adbc0abb2b6a4b5524e8
Cr-Commit-Position: refs/heads/master@{#350883}
Patch Set 1 #
Total comments: 4
Patch Set 2 : Changes proposed by mark. #Messages
Total messages: 9 (2 generated)
|