Commit Graph

21 Commits

Author SHA1 Message Date
Nadav Rotem
e9ba57a342 Replace std::function with llvm::function_ref to avoid memory allocation for large lambdas.
This class does not own the callable and does not allocate memory.

Swift SVN r23952
2014-12-16 00:47:28 +00:00
Nadav Rotem
d7e6386850 Revert "Get rid of a memory allocation on each call to the getXXXMetadata functions."
This reverts r23919.

Swift SVN r23951
2014-12-16 00:47:25 +00:00
Nadav Rotem
e9ffbd6707 Get rid of a memory allocation on each call to the getXXXMetadata functions.
We were using std::function that allocated memory. Unfortunately c++ lambdas
don't have a type so I had to make the function findOrAdd templated on the
type of the callback. This is not a big deal since the class is already
templated and there is a single call site.

Swift SVN r23919
2014-12-14 05:43:23 +00:00
Nadav Rotem
ddfe1cc876 Use size_t for the hash type and fix the undefined behavior that came from shifts on 32bit targets.
Swift SVN r23814
2014-12-09 22:31:27 +00:00
Nadav Rotem
2321849cff Replace the use of llvm::hash in getGenericMetadata with a fast hash implementation.
Before the change we were spending ~35% of the time of getGenericMetadata in hashing the inputs. I measured the following speedups:

SwiftStructuresQueue  1.11x
Havlak                1.11x
CaptureProp           1.11x
SwiftStructuresStack  1.12x
Life                  1.15x
NestedLoop            1.16x
RangeAssignment       1.24x

Swift SVN r23708
2014-12-05 00:45:48 +00:00
Nadav Rotem
8ce6af50ea Make the node of the concurrent map a ConcurrentList.
Making the type of nodes in the concurrent map a concurrent list will get rid
of the problem of the map itself allocating the node type, which may have a
side effect.

Swift SVN r23443
2014-11-19 19:21:10 +00:00
Nadav Rotem
db4a9ce093 Refactor the hash code into the EntryRef class.
Swift SVN r23433
2014-11-19 08:22:41 +00:00
Nadav Rotem
c989e2fb73 Add a note about the fact that the entried are completly constructed before they are inserted into the map.
Swift SVN r23402
2014-11-18 03:55:13 +00:00
Nadav Rotem
384d4583c7 Small cleanups, renames and deletion of unused ctors. NFC.
Swift SVN r23398
2014-11-18 03:20:49 +00:00
Nadav Rotem
9bf2d0dae3 Update the -*- C++ -*- marker
Swift SVN r23397
2014-11-18 03:20:32 +00:00
Nadav Rotem
8ceb854e0e Remove the unused lock utils.
Swift SVN r23360
2014-11-16 23:08:53 +00:00
Nadav Rotem
3c23f144ab Continue to reduce the size of the metadata cache by dynamically allocating the mutex.
Swift SVN r23359
2014-11-16 23:08:52 +00:00
Nadav Rotem
3bb9279bcf Reapply "Remove the locks from getGenericMetadata to accelerate Debug builds."
This commits also reduces the size of the metadata cache by allocating the
map dynamically,

There are no regressions and many perf wins:
NestedLoop     1.96x
Life           1.92x
CaptureProp    1.84x
Ary            1.67x
Ary2           1.60x
ArraySubscript 1.57x
ArrayLiteral   1.54x
StdlibSort     1.52x
Havlak         1.51x
TwoSum         1.49x
DollarFilter   1.37x
PrimeNum       1.35x
NBody          1.30x
RangeAssignmen 1.29x
DollarFunction 1.28x
Walsh          1.27x
Memset         1.27x
Histogram      1.27x
RIPEMD         1.27x

Swift SVN r23358
2014-11-16 22:45:30 +00:00
Arnold Schwaighofer
866a4facba Revert "Remove the locks from getGenericMetadata to accelerate Debug builds."
This reverts commit 23353.

It broke the build.

Swift SVN r23354
2014-11-15 18:24:25 +00:00
Nadav Rotem
dbcdfff724 Remove the locks from getGenericMetadata to accelerate Debug builds.
This commit removes the locks from the family of getXXXXMetadata APIs in the
fast path that does not create a new metadata. We still need the lock for the
cache-miss case because constructing metadata has side effects and we must
not construct two metadatas at the same time.

I am seeing a 25% - 30% boost in performance on most workloads that are built
with -Onone.

Swift SVN r23353
2014-11-15 07:07:38 +00:00
Nadav Rotem
866477d241 Small cleanups. NFC.
Swift SVN r23337
2014-11-14 22:29:28 +00:00
Nadav Rotem
22b5204719 Move the debug flag into the MetaCache implementation, where it is used.
Swift SVN r23336
2014-11-14 22:29:27 +00:00
Nadav Rotem
fd9824366c Move the DenseMap EntryRef entry into MetadataCache.
Swift SVN r23335
2014-11-14 22:29:27 +00:00
Graham Batty
a61085a562 Fix missing include of condition_variable.
Swift SVN r23334
2014-11-14 22:09:21 +00:00
Joe Groff
a8a2ff3f95 Case sensitivity fix
Swift SVN r23330
2014-11-14 21:54:47 +00:00
Nadav Rotem
70ce09c0f3 Refactor the metadata cache classes into a new file.
Swift SVN r23327
2014-11-14 20:28:07 +00:00