hashMap;
22 |
23 | // No compile errors
24 | MyStruct()
25 | {
26 | }
27 |
28 | // Compile errors
29 | MyStruct(std::pmr::memory_resource* memoryResource = std::pmr::get_default_resource())
30 | : hashMap(memoryResource)
31 | {
32 | }
33 | };
34 |
--------------------------------------------------------------------------------
/html/Makefile:
--------------------------------------------------------------------------------
1 | PANDOC = stack exec pandoc --
2 | MATHJAX = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
3 | FLAGS = --standalone --toc --toc-depth=2 --mathjax=$(MATHJAX) --highlight-style pygments
4 | PNG_IMAGES = $(patsubst %.pdf,%.png,$(wildcard img/*.pdf))
5 | IFORMAT = -f gfm
6 | FILTER = includes.exe
7 | FILTER_OPT = --filter=${FILTER} # includes.hs
8 |
9 | ############################### html
10 | STYLE = css/style.css
11 | TEMPLATE_HTML = template.html
12 | HTML_OPT = -c ${STYLE} --template ${TEMPLATE_HTML} -t html
13 | PGTITLE = --metadata pagetitle="The Parallel Hashmap"
14 |
15 | ############################### pdf
16 | TEMPLATE_TEX = template.latex
17 | TEX_OPT = --template $(TEMPLATE_TEX) --pdf-engine=xelatex
18 |
19 | ############################### epub
20 | EPUB_COVER = --epub-cover-image=img/cover-kindle.jpg
21 |
22 |
23 | SRC = parallel_hashmap.md
24 |
25 | OBJ = $(SRC:.md=.html)
26 |
27 | all: html
28 |
29 | includes.exe: includes.hs
30 | stack exec ghc -- -o $@ -no-keep-hi-files -no-keep-o-files includes.hs
31 |
32 | html: parallel_hashmap.md $(FILTER) ${TEMPLATE_HTML} ${STYLE}
33 | $(PANDOC) ${FILTER_OPT} ${IFORMAT} ${HTML_OPT} $(FLAGS) ${PGTITLE} -o ../index.html parallel_hashmap.md
34 |
35 | %.pdf: %.md $(FILTER) ${TEMPLATE_TEX}
36 | $(PANDOC) ${FILTER_OPT} ${IFORMAT} ${TEX_OPT} $(FLAGS) -o $@ $<
37 |
38 | pdf: $(FILTER) ${TEMPLATE_TEX}
39 | rm -f parallel_hashmap.pdf; $(PANDOC) ${FILTER_OPT} ${IFORMAT} ${TEX_OPT} $(FLAGS) -o parallel_hashmap.pdf title.md $(SRC)
40 |
41 | native:
42 | $(PANDOC) -s -t native $(SRC)
43 |
44 | native_filt: $(FILTER)
45 | $(PANDOC) ${FILTER_OPT} -s -t native $(SRC)
46 |
47 | clean:
48 | -rm -f *.html *.pdf cppi.epub
49 |
--------------------------------------------------------------------------------
/html/bench_results/martinus_mod/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Benchmark Results
6 |
7 | insert 100m values in map
8 |
9 | Lookup 100m ints, all present | Lookup 100m ints, few present
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/html/css/colors.css:
--------------------------------------------------------------------------------
1 | /***
2 |
3 | colors.css v2.0.0
4 | http://clrs.cc
5 | @mrmrs
6 | MIT License
7 |
8 | ***/
9 | /*
10 |
11 | SKINS
12 | - Backgrounds
13 | - Colors
14 | - Border colors
15 | - SVG fills
16 | - SVG Strokes
17 |
18 | */
19 | /* Backgrounds */
20 | .bg-navy {
21 | background-color: #001F3F; }
22 |
23 | .bg-blue {
24 | background-color: #0074D9; }
25 |
26 | .bg-aqua {
27 | background-color: #7FDBFF; }
28 |
29 | .bg-teal {
30 | background-color: #39CCCC; }
31 |
32 | .bg-olive {
33 | background-color: #3D9970; }
34 |
35 | .bg-green {
36 | background-color: #2ECC40; }
37 |
38 | .bg-lime {
39 | background-color: #01FF70; }
40 |
41 | .bg-yellow {
42 | background-color: #FFDC00; }
43 |
44 | .bg-orange {
45 | background-color: #FF851B; }
46 |
47 | .bg-red {
48 | background-color: #FF4136; }
49 |
50 | .bg-fuchsia {
51 | background-color: #F012BE; }
52 |
53 | .bg-purple {
54 | background-color: #B10DC9; }
55 |
56 | .bg-maroon {
57 | background-color: #85144B; }
58 |
59 | .bg-white {
60 | background-color: #fff; }
61 |
62 | .bg-gray {
63 | background-color: #aaa; }
64 |
65 | .bg-silver {
66 | background-color: #ddd; }
67 |
68 | .bg-black {
69 | background-color: #111; }
70 |
71 | /* Colors */
72 | .navy {
73 | color: #001F3F; }
74 |
75 | .blue {
76 | color: #0074D9; }
77 |
78 | .aqua {
79 | color: #7FDBFF; }
80 |
81 | .teal {
82 | color: #39CCCC; }
83 |
84 | .olive {
85 | color: #3D9970; }
86 |
87 | .green {
88 | color: #2ECC40; }
89 |
90 | .lime {
91 | color: #01FF70; }
92 |
93 | .yellow {
94 | color: #FFDC00; }
95 |
96 | .orange {
97 | color: #FF851B; }
98 |
99 | .red {
100 | color: #FF4136; }
101 |
102 | .fuchsia {
103 | color: #F012BE; }
104 |
105 | .purple {
106 | color: #B10DC9; }
107 |
108 | .maroon {
109 | color: #85144B; }
110 |
111 | .white {
112 | color: #fff; }
113 |
114 | .silver {
115 | color: #ddd; }
116 |
117 | .gray {
118 | color: #aaa; }
119 |
120 | .black {
121 | color: #111; }
122 |
123 | /* Border colors
124 |
125 | Use with another border utility that sets border-width and style
126 | i.e .border { border-width: 1px; border-style: solid; }
127 | */
128 | .border--navy {
129 | border-color: #001F3F; }
130 |
131 | .border--blue {
132 | border-color: #0074D9; }
133 |
134 | .border--aqua {
135 | border-color: #7FDBFF; }
136 |
137 | .border--teal {
138 | border-color: #39CCCC; }
139 |
140 | .border--olive {
141 | border-color: #3D9970; }
142 |
143 | .border--green {
144 | border-color: #2ECC40; }
145 |
146 | .border--lime {
147 | border-color: #01FF70; }
148 |
149 | .border--yellow {
150 | border-color: #FFDC00; }
151 |
152 | .border--orange {
153 | border-color: #FF851B; }
154 |
155 | .border--red {
156 | border-color: #FF4136; }
157 |
158 | .border--fuchsia {
159 | border-color: #F012BE; }
160 |
161 | .border--purple {
162 | border-color: #B10DC9; }
163 |
164 | .border--maroon {
165 | border-color: #85144B; }
166 |
167 | .border--white {
168 | border-color: #fff; }
169 |
170 | .border--gray {
171 | border-color: #aaa; }
172 |
173 | .border--silver {
174 | border-color: #ddd; }
175 |
176 | .border--black {
177 | border-color: #111; }
178 |
179 | /* Fills for SVG */
180 | .fill-navy {
181 | fill: #001F3F; }
182 |
183 | .fill-blue {
184 | fill: #0074D9; }
185 |
186 | .fill-aqua {
187 | fill: #7FDBFF; }
188 |
189 | .fill-teal {
190 | fill: #39CCCC; }
191 |
192 | .fill-olive {
193 | fill: #3D9970; }
194 |
195 | .fill-green {
196 | fill: #2ECC40; }
197 |
198 | .fill-lime {
199 | fill: #01FF70; }
200 |
201 | .fill-yellow {
202 | fill: #FFDC00; }
203 |
204 | .fill-orange {
205 | fill: #FF851B; }
206 |
207 | .fill-red {
208 | fill: #FF4136; }
209 |
210 | .fill-fuchsia {
211 | fill: #F012BE; }
212 |
213 | .fill-purple {
214 | fill: #B10DC9; }
215 |
216 | .fill-maroon {
217 | fill: #85144B; }
218 |
219 | .fill-white {
220 | fill: #fff; }
221 |
222 | .fill-gray {
223 | fill: #aaa; }
224 |
225 | .fill-silver {
226 | fill: #ddd; }
227 |
228 | .fill-black {
229 | fill: #111; }
230 |
231 | /* Strokes for SVG */
232 | .stroke-navy {
233 | stroke: #001F3F; }
234 |
235 | .stroke-blue {
236 | stroke: #0074D9; }
237 |
238 | .stroke-aqua {
239 | stroke: #7FDBFF; }
240 |
241 | .stroke-teal {
242 | stroke: #39CCCC; }
243 |
244 | .stroke-olive {
245 | stroke: #3D9970; }
246 |
247 | .stroke-green {
248 | stroke: #2ECC40; }
249 |
250 | .stroke-lime {
251 | stroke: #01FF70; }
252 |
253 | .stroke-yellow {
254 | stroke: #FFDC00; }
255 |
256 | .stroke-orange {
257 | stroke: #FF851B; }
258 |
259 | .stroke-red {
260 | stroke: #FF4136; }
261 |
262 | .stroke-fuchsia {
263 | stroke: #F012BE; }
264 |
265 | .stroke-purple {
266 | stroke: #B10DC9; }
267 |
268 | .stroke-maroon {
269 | stroke: #85144B; }
270 |
271 | .stroke-white {
272 | stroke: #fff; }
273 |
274 | .stroke-gray {
275 | stroke: #aaa; }
276 |
277 | .stroke-silver {
278 | stroke: #ddd; }
279 |
280 | .stroke-black {
281 | stroke: #111; }
282 |
283 | /* PRETTIER LINKS */
284 | a {
285 | text-decoration: none;
286 | -webkit-transition: color .3s ease-in-out;
287 | transition: color .3s ease-in-out; }
288 |
289 | a:link {
290 | -webkit-transition: color .3s ease-in-out;
291 | transition: color .3s ease-in-out; }
292 |
293 | a:visited { }
294 |
295 | a:hover {
296 | color: #001F3F;
297 | -webkit-transition: color .3s ease-in-out;
298 | transition: color .3s ease-in-out; }
299 |
300 | a:active {
301 | -webkit-transition: color .3s ease-in-out;
302 | transition: color .3s ease-in-out; }
303 |
--------------------------------------------------------------------------------
/html/css/style.css:
--------------------------------------------------------------------------------
1 | /* main stylesheet */
2 |
3 | @import url(http://fonts.googleapis.com/css?family=Signika);
4 |
5 | html {
6 | overflow-y: scroll;
7 | }
8 |
9 | body {
10 | font-size: 15px;
11 | font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, sans-serif;
12 | color: #332;
13 | }
14 |
15 | h1, h2, h3, h4, h5 {
16 | color: #332;
17 | font-family: "Signika";
18 | font-weight: 400;
19 | font-size: 1.4em;
20 | line-height: 1.1;
21 | margin-top: 30px;
22 | }
23 |
24 | pre code {
25 | font: 14px/19px Inconsolata, Monaco,"Lucida Console",Terminal,"Courier New",Courier;
26 | }
27 |
28 | .figure {
29 | text-align: center;
30 | }
31 |
32 | .small .figure img {
33 | height: 200px;
34 | }
35 |
36 | .pagetitle .figure {
37 | text-align: left !important;
38 | }
39 |
40 | .pagetitle .figure img {
41 | height: 36px;
42 | }
43 |
44 | table{
45 | background:#fff;
46 | border:1px solid #ccc;
47 | border-width:2px;
48 | border-collapse:collapse;
49 | margin:5px 0 10px;
50 |
51 | margin-top: 20px;
52 | margin-bottom: 20px;
53 | }
54 |
55 | th, td{
56 | border:1px solid #ccc;
57 | padding:3px 10px;
58 | text-align:left;
59 | vertical-align:top;
60 | }
61 |
62 | tr.even td{
63 | background:#f7f7f7;
64 | }
65 |
66 | th{
67 | background:#edeff0;
68 | }
69 |
70 | td code {
71 | border: 0px;
72 | }
73 |
74 | img {
75 | max-width: 100%;
76 | height: auto;
77 | }
78 |
79 | hr {
80 | border: 0px;
81 | height: 0;
82 | border-bottom: 1px solid #ccc;
83 | margin-bottom: 100px;
84 | }
85 |
86 | /* Logo */
87 |
88 | .logo {
89 | text-align: center;
90 | }
91 |
92 | .tagline {
93 | font-family: Georgia;
94 | font-size: 18px;
95 | font-style: italic;
96 | line-height: 1.45;
97 | color: #383838;
98 | }
99 |
100 | .author {
101 | }
102 |
103 | .halfbreak {
104 | padding-bottom: 100px;
105 | }
106 |
107 | .break {
108 | padding-bottom: 200px;
109 | }
110 |
111 | /* TOC Links */
112 |
113 | a {
114 | color: #111111;
115 | text-decoration: none;
116 | }
117 |
118 | .body li a {
119 | text-decoration: underline;
120 | }
121 |
122 | /* Math */
123 |
124 | .MathJax_Display {
125 | padding-top: 20px;
126 | padding-bottom: 20px;
127 | }
128 |
129 | /* Body Links */
130 |
131 | p a {
132 | text-decoration: underline;
133 | }
134 |
135 | li code, p code {
136 | font-size: 12px;
137 | border: 1px solid #ccc;
138 | margin-left: 3px;
139 | margin-right: 3px;
140 | padding-left: 2px;
141 | padding-right: 2px;
142 | }
143 |
144 | /* */
145 |
146 | .center {
147 | text-align: center;
148 | }
149 |
150 | .bigger img {
151 | width: 120%;
152 | height: 120%;
153 | }
154 |
155 | pre {
156 | font-size: 0.9em;
157 |
158 | margin-bottom: 18px;
159 | margin-top: 18px;
160 |
161 | border-left: 1px solid #ccc;
162 |
163 | }
164 |
165 | h1 {
166 | margin-top: 0px;
167 | }
168 |
169 | .annotation {
170 | font-size: 10pt;
171 | }
172 |
173 | .annotation pre {
174 | display: block;
175 | margin: 0;
176 | padding: 7px 10px;
177 | overflow-x: auto;
178 | }
179 |
180 | .annotation.span2 {
181 | /* Override bootstrap */
182 | margin-left: 0px !important;
183 | margin-top: 18px !important;
184 | }
185 |
186 | .annotation pre code {
187 | border: 0;
188 | padding: 0;
189 | background: transparent;
190 | }
191 |
192 | blockquote {
193 | border-left: 1px solid #ccc;
194 | font-family: Georgia, serif;
195 | font-size: 14px;
196 | font-style: italic;
197 | margin: 0.25em 0;
198 | padding-left: 10px;
199 | line-height: 1.45;
200 | color: #383838;
201 | left: 20px;
202 | }
203 |
204 |
205 | blockquote cite {
206 | color: #999999;
207 | font-size: 14px;
208 | display: block;
209 | margin-top: 5px;
210 | }
211 |
212 | ul.sections {
213 | list-style: none;
214 | padding:0 0 5px 0;
215 | margin:0;
216 | }
217 |
218 | code.sourceCode {
219 | padding: 0;
220 | background: inherit;
221 | }
222 |
223 | pre.sourceCode {
224 | padding: 10px;
225 | }
226 |
227 | ul.sections > li > div {
228 | -moz-box-sizing: border-box; /* firefox */
229 | -ms-box-sizing: border-box; /* ie */
230 | -webkit-box-sizing: border-box; /* webkit */
231 | -khtml-box-sizing: border-box; /* konqueror */
232 | box-sizing: border-box; /* css3 */
233 | }
234 |
235 |
236 | /* Make the naviation centered and larger on small screens */
237 | /*---------------------- (> 481px) ---------------------*/
238 |
239 | @media only screen and (max-width: 481px) {
240 |
241 | }
242 |
243 | @media only screen and (min-width: 1025px) {
244 | body {
245 | padding: 10px;
246 | }
247 |
248 | .side {
249 | position: fixed;
250 | width: 120px !important;
251 | margin-left: 0px;
252 | z-index: 1000;
253 | }
254 |
255 | .side ul ul {
256 | display: none;
257 | }
258 |
259 | .side ul ul.active {
260 | display: block;
261 | }
262 |
263 | .side .active {
264 | font-weight: bold;
265 | }
266 |
267 | .body {
268 | margin-left: 120px !important;
269 | }
270 |
271 | }
272 |
--------------------------------------------------------------------------------
/html/diagrams/closed_hashing:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | +----------------+
5 | |"(keyi, valuei)"| "(key, value) pairs are stored directly"
6 | +----+-----------+ "into the array (no pointers)"
7 | | +--------+---------------------+
8 | | | | |
9 | | | | |
10 | | | | |
11 | | | | |
12 | | | | |
13 | | +--------+---------------------+
14 | +---------------> | keyi | valuei |
15 | hasher(keyi) +--------+---------------------+
16 | | | |
17 | | | |
18 | | | |
19 | +--------+---------------------+
20 | | | |
21 | +--------+---------------------+
22 | | | |
23 | | | |
24 | | | |
25 | +--------+---------------------+
26 |
27 | absl::flat_hash_map
28 |
29 |
--------------------------------------------------------------------------------
/html/diagrams/closed_hashing.svg:
--------------------------------------------------------------------------------
1 |
134 |
--------------------------------------------------------------------------------
/html/diagrams/index_computation:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | +----------------+
5 | |"(keyi, valuei)"|
6 | +------+---------+
7 | |
8 | | hasher(keyi) "Parallel Hash Map"
9 | v "(with 8 submaps)"
10 | +--------+-------------+ +----------------+
11 | | h=0x7d84ea13707f4657 | | submap0 |
12 | +---------+------------+ +----------------+
13 | | | submap1 |
14 | | "(h ^ (h >> 3)) & 0x7" +----------------+
15 | v | submap2 |
16 | +----+----+ +----------------+
17 | |"idx = 5"| | submap3 |
18 | +----+----+ +----------------+
19 | | | submap4 |
20 | | +----------------+
21 | +------------------------------->| submap5 |
22 | +----------------+
23 | | submap6 |
24 | +----------------+
25 | | submap7 |
26 | +----------------+
27 |
28 | "parallel_hash_map with 8 submaps, each submap is an absl::flat_hash_map"
29 |
30 |
--------------------------------------------------------------------------------
/html/diagrams/index_computation.svg:
--------------------------------------------------------------------------------
1 |
197 |
--------------------------------------------------------------------------------
/html/img/closed_hashing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/closed_hashing.png
--------------------------------------------------------------------------------
/html/img/flat_mem_usage.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_mem_usage.gif
--------------------------------------------------------------------------------
/html/img/flat_mem_usage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_mem_usage.png
--------------------------------------------------------------------------------
/html/img/flat_par_mutex_4.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_par_mutex_4.PNG
--------------------------------------------------------------------------------
/html/img/flat_par_mutex_5.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_par_mutex_5.PNG
--------------------------------------------------------------------------------
/html/img/flat_par_mutex_5_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_par_mutex_5_speed.PNG
--------------------------------------------------------------------------------
/html/img/flat_par_mutex_6_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_par_mutex_6_speed.PNG
--------------------------------------------------------------------------------
/html/img/flat_par_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_par_speed.PNG
--------------------------------------------------------------------------------
/html/img/flat_peak.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_peak.gif
--------------------------------------------------------------------------------
/html/img/flat_peak.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/flat_peak.png
--------------------------------------------------------------------------------
/html/img/hashtable_benchmarks.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/hashtable_benchmarks.PNG
--------------------------------------------------------------------------------
/html/img/idx_computation_cost.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/idx_computation_cost.PNG
--------------------------------------------------------------------------------
/html/img/index_computation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/index_computation.png
--------------------------------------------------------------------------------
/html/img/lock_various_sizes.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/lock_various_sizes.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_both.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_both.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_both_run2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_both_run2.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_mem.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_mem.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_mem_run2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_mem_run2.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_mem_run2_zoomed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_mem_run2_zoomed.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_mem_zoomed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_mem_zoomed.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_speed.PNG
--------------------------------------------------------------------------------
/html/img/mt_stl_flat_par_speed_run2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/mt_stl_flat_par_speed_run2.PNG
--------------------------------------------------------------------------------
/html/img/no_preselection.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/no_preselection.PNG
--------------------------------------------------------------------------------
/html/img/node_mem_usage.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/node_mem_usage.gif
--------------------------------------------------------------------------------
/html/img/node_mem_usage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/node_mem_usage.png
--------------------------------------------------------------------------------
/html/img/node_peak.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/node_peak.gif
--------------------------------------------------------------------------------
/html/img/node_peak.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/node_peak.png
--------------------------------------------------------------------------------
/html/img/par_align_test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/par_align_test.png
--------------------------------------------------------------------------------
/html/img/par_mt_memory.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/par_mt_memory.PNG
--------------------------------------------------------------------------------
/html/img/par_mt_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/par_mt_speed.PNG
--------------------------------------------------------------------------------
/html/img/parallel_flat_peak.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/parallel_flat_peak.gif
--------------------------------------------------------------------------------
/html/img/parallel_flat_peak.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/parallel_flat_peak.png
--------------------------------------------------------------------------------
/html/img/parallel_node_peak.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/parallel_node_peak.gif
--------------------------------------------------------------------------------
/html/img/parallel_node_peak.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/parallel_node_peak.png
--------------------------------------------------------------------------------
/html/img/phash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/phash.png
--------------------------------------------------------------------------------
/html/img/phmap_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/phmap_logo.png
--------------------------------------------------------------------------------
/html/img/spp_flat_par_both.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/spp_flat_par_both.png
--------------------------------------------------------------------------------
/html/img/stl_flat_both.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_both.PNG
--------------------------------------------------------------------------------
/html/img/stl_flat_mem.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_mem.PNG
--------------------------------------------------------------------------------
/html/img/stl_flat_par_both.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_par_both.PNG
--------------------------------------------------------------------------------
/html/img/stl_flat_par_mem.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_par_mem.PNG
--------------------------------------------------------------------------------
/html/img/stl_flat_par_mem_zoomed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_par_mem_zoomed.PNG
--------------------------------------------------------------------------------
/html/img/stl_flat_par_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_par_speed.PNG
--------------------------------------------------------------------------------
/html/img/stl_flat_speed.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/img/stl_flat_speed.PNG
--------------------------------------------------------------------------------
/html/includes.hs:
--------------------------------------------------------------------------------
1 | {-# LANGUAGE OverloadedStrings #-}
2 |
3 | import Text.Read
4 | import Control.Monad.State
5 | import Control.Monad
6 | import Text.Pandoc
7 | import Data.Monoid
8 | import Control.Applicative
9 |
10 | import Text.Pandoc.JSON
11 | import Text.Pandoc.Walk
12 |
13 | slice :: Int -> Int -> [a] -> [a]
14 | slice from to xs = take (to - from + 1) (drop from xs)
15 |
16 | doSlice :: Block -> IO Block
17 | doSlice cb@(CodeBlock (id, classes, namevals) contents) = do
18 | res <- return $ do
19 | upper <- readMaybe =<< lookup "upper" namevals
20 | lower <- readMaybe =<< lookup "lower" namevals
21 | file <- lookup "slice" namevals
22 | return (upper, lower, file)
23 |
24 | case res of
25 | Nothing -> return cb
26 | Just (upper, lower, f) -> do
27 | contents <- readFile f
28 | let lns = unlines $ slice lower upper (lines contents)
29 | return (CodeBlock (id, classes, namevals) lns)
30 | doSlice x = return x
31 |
32 | doInclude :: Block -> IO Block
33 | doInclude cb@(CodeBlock (id, classes, namevals) contents) =
34 | case lookup "include" namevals of
35 | Just f -> return . (CodeBlock (id, classes, namevals)) =<< readFile f
36 | Nothing -> return cb
37 | doInclude x = return x
38 |
39 | doHtml :: Block -> IO Block
40 | doHtml cb@(CodeBlock (id, classes, namevals) contents) =
41 | case lookup "literal" namevals of
42 | Just f -> return . (RawBlock "html") =<< readFile f
43 | Nothing -> return cb
44 | doHtml x = return x
45 |
46 | injectLatexMacros :: Maybe Format -> Pandoc -> IO Pandoc
47 | injectLatexMacros (Just fmt) p = do
48 | macros <- readFile "latex_macros"
49 | let block =
50 | case fmt of
51 | Format "html" ->
52 | Div ("",[],[("style","display:none")]) . (:[])
53 | . Para . (:[]) . Math DisplayMath $ macros
54 | Format "latex" -> RawBlock "latex" macros
55 | Format "epub" -> RawBlock "latex" macros
56 | _ -> RawBlock "latex" macros
57 | return (Pandoc nullMeta [block] <> p)
58 | injectLatexMacros _ _ = return mempty
59 |
60 | main :: IO ()
61 | main = toJSONFilter
62 | ((\fmt -> injectLatexMacros fmt
63 | >=> walkM doInclude
64 | >=> walkM doSlice
65 | >=> walkM doHtml) :: Maybe Format -> Pandoc -> IO Pandoc)
66 |
--------------------------------------------------------------------------------
/html/latex_macros:
--------------------------------------------------------------------------------
1 | \newcommand{\andalso}{\quad\quad}
2 | \newcommand{\infabbrev}[2]{\infax{#1 \quad\eqdef\quad #2}}
3 | \newcommand{\infrule}[2]{\displaystyle \dfrac{#1}{#2}}
4 | \newcommand{\ar}{\rightarrow}
5 | \newcommand{\Int}{\mathtt{Int}}
6 | \newcommand{\Bool}{\mathtt{Bool}}
7 | \newcommand{\becomes}{\Downarrow}
8 | \newcommand{\trule}[1]{(\textbf{#1})}
9 | \newcommand{\FV}[1]{\mathtt{fv}(#1)}
10 | \newcommand{\FTV}[1]{\mathtt{ftv}(#1)}
11 | \newcommand{\BV}[1]{\mathtt{bv}(#1)}
12 | \newcommand{\compiles}[1]{\text{C}\llbracket{#1}\rrbracket}
13 | \newcommand{\exec}[1]{\text{E}\llbracket{#1}\rrbracket}
14 | \renewcommand{\t}[1]{\mathtt{#1}}
15 | \newcommand{\ite}[3]{\text{if }#1\text{ then }#2\text{ else }#3}
16 |
--------------------------------------------------------------------------------
/html/parallel_hashmap.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/greg7mdp/parallel-hashmap/896f1a03e429c45d9fe9638e892fc1da73befadd/html/parallel_hashmap.pdf
--------------------------------------------------------------------------------
/html/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | The Parallel Hashmap (Gregory Popovitch)
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | $if(highlighting-css)$
17 |
20 | $endif$
21 | $for(css)$
22 |
23 | $endfor$
24 | $if(math)$
25 | $if(html5)$
26 | $else$
27 | $math$
28 | $endif$
29 | $endif$
30 | $for(header-includes)$
31 | $header-includes$
32 | $endfor$
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | $body$
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/parallel_hashmap/meminfo.h:
--------------------------------------------------------------------------------
1 | #if !defined(spp_memory_h_guard)
2 | #define spp_memory_h_guard
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #if defined(_WIN32) || defined( __CYGWIN__)
9 | #define SPP_WIN
10 | #endif
11 |
12 | #ifdef SPP_WIN
13 | #include
14 | #include
15 | #undef min
16 | #undef max
17 | #elif defined(__linux__)
18 | #include
19 | #include
20 | #elif defined(__FreeBSD__)
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #endif
28 |
29 | namespace spp
30 | {
31 | uint64_t GetSystemMemory();
32 | uint64_t GetTotalMemoryUsed();
33 | uint64_t GetProcessMemoryUsed();
34 | uint64_t GetPhysicalMemory();
35 |
36 | uint64_t GetSystemMemory()
37 | {
38 | #ifdef SPP_WIN
39 | MEMORYSTATUSEX memInfo;
40 | memInfo.dwLength = sizeof(MEMORYSTATUSEX);
41 | GlobalMemoryStatusEx(&memInfo);
42 | return static_cast(memInfo.ullTotalPageFile);
43 | #elif defined(__linux__)
44 | struct sysinfo memInfo;
45 | sysinfo (&memInfo);
46 | auto totalVirtualMem = memInfo.totalram;
47 |
48 | totalVirtualMem += memInfo.totalswap;
49 | totalVirtualMem *= memInfo.mem_unit;
50 | return static_cast(totalVirtualMem);
51 | #elif defined(__FreeBSD__)
52 | kvm_t *kd;
53 | u_int pageCnt;
54 | size_t pageCntLen = sizeof(pageCnt);
55 | u_int pageSize;
56 | struct kvm_swap kswap;
57 | uint64_t totalVirtualMem;
58 |
59 | pageSize = static_cast(getpagesize());
60 |
61 | sysctlbyname("vm.stats.vm.v_page_count", &pageCnt, &pageCntLen, NULL, 0);
62 | totalVirtualMem = pageCnt * pageSize;
63 |
64 | kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
65 | kvm_getswapinfo(kd, &kswap, 1, 0);
66 | kvm_close(kd);
67 | totalVirtualMem += kswap.ksw_total * pageSize;
68 |
69 | return totalVirtualMem;
70 | #else
71 | return 0;
72 | #endif
73 | }
74 |
75 | uint64_t GetTotalMemoryUsed()
76 | {
77 | #ifdef SPP_WIN
78 | MEMORYSTATUSEX memInfo;
79 | memInfo.dwLength = sizeof(MEMORYSTATUSEX);
80 | GlobalMemoryStatusEx(&memInfo);
81 | return static_cast(memInfo.ullTotalPageFile - memInfo.ullAvailPageFile);
82 | #elif defined(__linux__)
83 | struct sysinfo memInfo;
84 | sysinfo(&memInfo);
85 | auto virtualMemUsed = memInfo.totalram - memInfo.freeram;
86 |
87 | virtualMemUsed += memInfo.totalswap - memInfo.freeswap;
88 | virtualMemUsed *= memInfo.mem_unit;
89 |
90 | return static_cast(virtualMemUsed);
91 | #elif defined(__FreeBSD__)
92 | kvm_t *kd;
93 | u_int pageSize;
94 | u_int pageCnt, freeCnt;
95 | size_t pageCntLen = sizeof(pageCnt);
96 | size_t freeCntLen = sizeof(freeCnt);
97 | struct kvm_swap kswap;
98 | uint64_t virtualMemUsed;
99 |
100 | pageSize = static_cast(getpagesize());
101 |
102 | sysctlbyname("vm.stats.vm.v_page_count", &pageCnt, &pageCntLen, NULL, 0);
103 | sysctlbyname("vm.stats.vm.v_free_count", &freeCnt, &freeCntLen, NULL, 0);
104 | virtualMemUsed = (pageCnt - freeCnt) * pageSize;
105 |
106 | kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open");
107 | kvm_getswapinfo(kd, &kswap, 1, 0);
108 | kvm_close(kd);
109 | virtualMemUsed += kswap.ksw_used * pageSize;
110 |
111 | return virtualMemUsed;
112 | #else
113 | return 0;
114 | #endif
115 | }
116 |
117 | uint64_t GetProcessMemoryUsed()
118 | {
119 | #ifdef SPP_WIN
120 | PROCESS_MEMORY_COUNTERS_EX pmc;
121 | GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast