Commit Graph

15 Commits

Author SHA1 Message Date
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
ed26eb05a1 Use the typedef to make the code more readable. NFC.
Swift SVN r23442
2014-11-19 19:21:05 +00:00
Nadav Rotem
34fbb4f846 Cache map lookups
When we search for metadata we usually search for the same value over and
over again. Instead of searching the value in the binary tree we can save
the value that we found and use it again the next time we search. This
commit adds a cache value. The invariant is that the LastSearch variable
always points to a valid node and the access to the pointer itself is atomic.
This is a major performance win for the current use of getGenericMetadata.

Swift SVN r23434
2014-11-19 08:22:43 +00:00
Nadav Rotem
08ff6ed547 Move the less frequently used field to the end of the struct.
This saves one add instruction in the fast path (for calculating the address of .Left).

Swift SVN r23420
2014-11-19 01:42:50 +00:00
Nadav Rotem
02c3aeb717 Split the lookup node lookup cold path from the hot path.
In debug builds getGenericMetadata takes about 10% of the execution time.
Most of this time is spent in searching the binary tree. This commit splits
the search into cold path and hot path, where the less likely checks are
done after the mode likely checks. This reduces the overall runtime of the
test suite in -Onone by ~1%.

Swift SVN r23419
2014-11-19 01:42:37 +00:00
Nadav Rotem
6199b409c5 Use load-acquire store-release for the node pointers in the tree.
Swift SVN r23413
2014-11-18 21:44:17 +00:00
Nadav Rotem
ecd58818ba Use load-acquire store-release for the first element in the linked list.
The use of seq_cst order for all operations is an overkill.

Swift SVN r23412
2014-11-18 21:44:15 +00:00
Nadav Rotem
20f75c7f67 Remove the push_front return value.
Swift SVN r23410
2014-11-18 20:43:19 +00:00
Nadav Rotem
90f0e436c3 Small cleanup. NFC.
Swift SVN r23409
2014-11-18 20:43:17 +00:00
Nadav Rotem
7274929c21 Describe the node insertion algorithm in the binary tree.
Swift SVN r23401
2014-11-18 03:55:12 +00:00
Nadav Rotem
4821ccf7ed Add additional docs to the concurrent linked list.
Swift SVN r23400
2014-11-18 03:55:10 +00:00
Nadav Rotem
daa991d07a Mark a method as static.
Swift SVN r23399
2014-11-18 03:20:49 +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
d99ed4f959 Implement a lock-free concurrent multimap.
Swift SVN r23352
2014-11-15 07:07:34 +00:00