llvm-project/llvm/unittests/ADT
Ben Vanik 2fcffcd0e8 [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
2021-11-03 20:31:20 -07:00
..
APFixedPointTest.cpp [Fixed Point] Add floating point methods to APFixedPoint. 2020-10-09 10:27:42 +02:00
APFloatTest.cpp [APFloat] convertToDouble/Float can work on shorter types 2021-05-21 11:02:51 +07:00
APIntTest.cpp [ADT] Add APInt::isNegatedPowerOf2() helper 2021-10-19 14:38:21 +01:00
APSIntTest.cpp
AnyTest.cpp
ArrayRefTest.cpp Switch from llvm::is_trivially_copyable to std::is_trivially_copyable 2020-12-02 22:02:48 -08:00
BitFieldsTest.cpp
BitVectorTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
BitmaskEnumTest.cpp
BreadthFirstIteratorTest.cpp
BumpPtrListTest.cpp
CMakeLists.txt [ADT] Add STLForwardCompat.h and llvm::disjunction 2021-04-30 17:28:47 +00:00
CoalescingBitVectorTest.cpp
DAGDeltaAlgorithmTest.cpp
DeltaAlgorithmTest.cpp
DenseMapTest.cpp [ADT] Add initializer_list constructor to SmallDenseMap 2021-07-21 09:32:16 -04:00
DenseSetTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
DepthFirstIteratorTest.cpp
DirectedGraphTest.cpp
EnumeratedArrayTest.cpp
EquivalenceClassesTest.cpp
FallibleIteratorTest.cpp
FloatingPointMode.cpp
FoldingSet.cpp
FunctionExtrasTest.cpp [ADT] Extend EnableIfCallable for callables with incomplete returns 2021-09-13 19:16:16 +00:00
FunctionRefTest.cpp [ADT] Fix accidental pointer comparison in test 2020-10-27 18:11:45 +01:00
HashingTest.cpp [Support] Automatically support `hash_value` when `HashBuilder` support is available. 2021-09-07 09:56:11 -07:00
IListBaseTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
IListIteratorTest.cpp
IListNodeBaseTest.cpp
IListNodeTest.cpp
IListSentinelTest.cpp
IListTest.cpp
ImmutableListTest.cpp [RGT] Recode more unreachable assertions and tautologies 2021-03-19 09:17:22 -07:00
ImmutableMapTest.cpp [ADT] Fix for ImmutableMapRef 2020-10-29 13:19:51 +01:00
ImmutableSetTest.cpp [RGT][ADT] Remove test assertion that will not be executed 2021-01-22 14:52:55 -08:00
IntEqClassesTest.cpp
IntervalMapTest.cpp
IntrusiveRefCntPtrTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
IteratorTest.cpp Revert "Fix iterator_adaptor_base/enumerator_iter to allow composition of llvm::enumerate with llvm::make_filter_range" 2021-11-04 00:14:12 +00:00
MapVectorTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
MappedIteratorTest.cpp
OptionalTest.cpp [ADT] Factor out in_place_t and expose in Optional ctor 2021-05-17 22:25:39 +00:00
PackedVectorTest.cpp
PointerEmbeddedIntTest.cpp
PointerIntPairTest.cpp Switch from llvm::is_trivially_copyable to std::is_trivially_copyable 2020-12-02 22:02:48 -08:00
PointerSumTypeTest.cpp
PointerUnionTest.cpp
PostOrderIteratorTest.cpp [ADT] Update RPOT to work with specializations of different types. 2021-04-17 20:45:04 +01:00
PriorityWorklistTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
RangeAdapterTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
SCCIteratorTest.cpp
STLExtrasTest.cpp Add `all_of_zip` to STLExtras 2021-07-29 05:00:35 +00:00
STLForwardCompatTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
ScopeExitTest.cpp
SequenceTest.cpp Make enum iteration with seq safe by default 2021-11-03 20:52:21 -04:00
SetVectorTest.cpp
SimpleIListTest.cpp
SmallPtrSetTest.cpp Allow SmallPtrSet to be used with a std::insert_iterator 2021-02-05 16:12:47 -05:00
SmallSetTest.cpp
SmallStringTest.cpp [llvm] Rename StringRef _lower() method calls to _insensitive() 2021-06-25 00:22:01 +03:00
SmallVectorTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
SparseBitVectorTest.cpp
SparseMultiSetTest.cpp
SparseSetTest.cpp
StatisticTest.cpp
StringExtrasTest.cpp [ADT] Simplifying hex string parsing so it runs faster in debug modes. 2021-11-03 20:31:20 -07:00
StringMapTest.cpp Reland "Try to unbreak Win build differently after 973519826edb76"" 2021-09-02 16:19:58 -07:00
StringRefTest.cpp [ADT] Rename StringRef case insensitive methods for clarity 2021-06-25 00:22:00 +03:00
StringSetTest.cpp
StringSwitchTest.cpp
TestGraph.h
TinyPtrVectorTest.cpp Put back the trailing commas on TYPED_TEST_SUITE 2021-05-17 14:14:13 +02:00
TripleTest.cpp [MIPS] Fix switching between 32/64-bit variants of r6 target triples 2021-10-21 15:04:07 +03:00
TwineTest.cpp Consolidate string types into ptr and length representations. 2021-07-20 13:29:57 -07:00
TypeSwitchTest.cpp [mlir] Add support for walking locations similarly to Operations 2021-04-15 16:09:34 -07:00
TypeTraitsTest.cpp
WaymarkingTest.cpp