aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorBen Vanik <benvanik@google.com>2021-11-03 20:30:04 -0700
committerStella Laurenzo <stellaraccident@gmail.com>2021-11-03 20:31:20 -0700
commit2fcffcd0e8e54f3c8c12fcfc58db4af47d5c4272 (patch)
tree934fe13e95feaa078c1febef23e5703f62374ceb /clang/lib/Frontend/InitPreprocessor.cpp
parent539f500e78ad7cdc905da5345d5d0e32122ce12e (diff)
downloadllvm-2fcffcd0e8e54f3c8c12fcfc58db4af47d5c4272.zip
llvm-2fcffcd0e8e54f3c8c12fcfc58db4af47d5c4272.tar.gz
llvm-2fcffcd0e8e54f3c8c12fcfc58db4af47d5c4272.tar.bz2
[ADT] Simplifying hex string parsing so it runs faster in debug modes.
This expands the lookup table statically and avoids routing through methods that contain asserts (like StringRef/std::string element accessors and drop_front) such that performance is more predictable across compilation environments. This was primarily driven by slow debug mode performance but has a large benefit in release builds as well. ``` ssd_mobilenet_v2_face_float (42MB .mlir) Debug/MSVC (old): 5.22s Debug/MSVC (new): 0.16s Release/MSVC (old): 0.81s Release/MSVC (new): 0.02s huggingface_minilm (536MB .mlir) Debug/MSVC (old): 65.31s Debug/MSVC (new): 2.03s Release/MSVC (old): 9.93s Release/MSVC (new): 0.27s ``` Now in debug the time is split evenly between lexString, tryGetFromHex, and element attrs hashing, with the next step to making it faster being to combine the work (incremental hashing during conversion, etc) - but this is at least in the right order of magnitude and retains the original API surface. I have not profiled a build with clang but this is strictly less code and simpler data structures so I'd expect improvements there as well. This also fixes a bug where 0xFF bytes in the input would read out of bounds. Reviewed By: dblaikie, stellaraccident Differential Revision: https://reviews.llvm.org/D112105
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions