We burn a lot of time in hashcode and map manipulation for thread names, which are mostly integers 0...n, but sometimes non-integer names like :nemesis. It's nice to be able to represent thread state internally as purely integers. To do this, we compute a one-time translation table which lets us map those names to integers and vice-versa.
We burn a lot of time in hashcode and map manipulation for thread names, which are mostly integers 0...n, but sometimes non-integer names like :nemesis. It's nice to be able to represent thread state internally as purely integers. To do this, we compute a one-time translation table which lets us map those names to integers and vice-versa.
(all-names translation-table)A sequence of all names in the translation table, in the exact order of thread indices. Index 0's name comes first, then 1, and so on.
A sequence of all names in the translation table, in the exact order of thread indices. Index 0's name comes first, then 1, and so on.
(index->name translation-table thread-index)Turns a thread index (an int) into a thread name (e.g. 0, 5, or :nemesis).
Turns a thread index (an int) into a thread name (e.g. 0, 5, or :nemesis).
(indices->names translation-table indices)Takes a translation table and a BitSet of thread indices. Constructs a Bifurcan ISet out of those threads.
Takes a translation table and a BitSet of thread indices. Constructs a Bifurcan ISet out of those threads.
(name->index translation-table thread-name)Turns a thread name (e.g. 0, 5, or :nemesis) into a primitive int.
Turns a thread name (e.g. 0, 5, or :nemesis) into a primitive int.
(names->indices translation-table names)Takes a translation table and a collection of thread names. Constructs a BitSet of those thread indices.
Takes a translation table and a collection of thread names. Constructs a BitSet of those thread indices.
(thread-count translation-table)How many threads in a translation table in all?
How many threads in a translation table in all?
(translation-table int-thread-count named-threads)Takes a number of integer threads and a collection of named threads, and computes a translation table.
Takes a number of integer threads and a collection of named threads, and computes a translation table.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |