##// END OF EJS Templates
rust-performance: introduce FastHashMap type alias for HashMap...
Raphaël Gomès -
r44278:5ac243a9 default
parent child Browse files
Show More
@@ -32,6 +32,15 b' version = "1.3.2"'
32 source = "registry+https://github.com/rust-lang/crates.io-index"
32 source = "registry+https://github.com/rust-lang/crates.io-index"
33
33
34 [[package]]
34 [[package]]
35 name = "c2-chacha"
36 version = "0.2.2"
37 source = "registry+https://github.com/rust-lang/crates.io-index"
38 dependencies = [
39 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
40 "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
41 ]
42
43 [[package]]
35 name = "cfg-if"
44 name = "cfg-if"
36 version = "0.1.10"
45 version = "0.1.10"
37 source = "registry+https://github.com/rust-lang/crates.io-index"
46 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -105,6 +114,16 b' version = "0.1.1"'
105 source = "registry+https://github.com/rust-lang/crates.io-index"
114 source = "registry+https://github.com/rust-lang/crates.io-index"
106
115
107 [[package]]
116 [[package]]
117 name = "getrandom"
118 version = "0.1.12"
119 source = "registry+https://github.com/rust-lang/crates.io-index"
120 dependencies = [
121 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
122 "libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)",
123 "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
124 ]
125
126 [[package]]
108 name = "hg-core"
127 name = "hg-core"
109 version = "0.1.0"
128 version = "0.1.0"
110 dependencies = [
129 dependencies = [
@@ -115,6 +134,7 b' dependencies = ['
115 "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
134 "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
116 "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
135 "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
117 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
136 "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
137 "twox-hash 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
118 ]
138 ]
119
139
120 [[package]]
140 [[package]]
@@ -179,6 +199,11 b' dependencies = ['
179 ]
199 ]
180
200
181 [[package]]
201 [[package]]
202 name = "ppv-lite86"
203 version = "0.2.5"
204 source = "registry+https://github.com/rust-lang/crates.io-index"
205
206 [[package]]
182 name = "python27-sys"
207 name = "python27-sys"
183 version = "0.3.0"
208 version = "0.3.0"
184 source = "registry+https://github.com/rust-lang/crates.io-index"
209 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -215,6 +240,18 b' dependencies = ['
215 ]
240 ]
216
241
217 [[package]]
242 [[package]]
243 name = "rand"
244 version = "0.7.2"
245 source = "registry+https://github.com/rust-lang/crates.io-index"
246 dependencies = [
247 "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
248 "libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)",
249 "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
250 "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
251 "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
252 ]
253
254 [[package]]
218 name = "rand_chacha"
255 name = "rand_chacha"
219 version = "0.1.1"
256 version = "0.1.1"
220 source = "registry+https://github.com/rust-lang/crates.io-index"
257 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -224,6 +261,15 b' dependencies = ['
224 ]
261 ]
225
262
226 [[package]]
263 [[package]]
264 name = "rand_chacha"
265 version = "0.2.1"
266 source = "registry+https://github.com/rust-lang/crates.io-index"
267 dependencies = [
268 "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
269 "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
270 ]
271
272 [[package]]
227 name = "rand_core"
273 name = "rand_core"
228 version = "0.3.1"
274 version = "0.3.1"
229 source = "registry+https://github.com/rust-lang/crates.io-index"
275 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -237,6 +283,14 b' version = "0.4.2"'
237 source = "registry+https://github.com/rust-lang/crates.io-index"
283 source = "registry+https://github.com/rust-lang/crates.io-index"
238
284
239 [[package]]
285 [[package]]
286 name = "rand_core"
287 version = "0.5.1"
288 source = "registry+https://github.com/rust-lang/crates.io-index"
289 dependencies = [
290 "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
291 ]
292
293 [[package]]
240 name = "rand_hc"
294 name = "rand_hc"
241 version = "0.1.0"
295 version = "0.1.0"
242 source = "registry+https://github.com/rust-lang/crates.io-index"
296 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -245,6 +299,14 b' dependencies = ['
245 ]
299 ]
246
300
247 [[package]]
301 [[package]]
302 name = "rand_hc"
303 version = "0.2.0"
304 source = "registry+https://github.com/rust-lang/crates.io-index"
305 dependencies = [
306 "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
307 ]
308
309 [[package]]
248 name = "rand_isaac"
310 name = "rand_isaac"
249 version = "0.1.1"
311 version = "0.1.1"
250 source = "registry+https://github.com/rust-lang/crates.io-index"
312 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -373,6 +435,19 b' dependencies = ['
373 ]
435 ]
374
436
375 [[package]]
437 [[package]]
438 name = "twox-hash"
439 version = "1.5.0"
440 source = "registry+https://github.com/rust-lang/crates.io-index"
441 dependencies = [
442 "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
443 ]
444
445 [[package]]
446 name = "wasi"
447 version = "0.7.0"
448 source = "registry+https://github.com/rust-lang/crates.io-index"
449
450 [[package]]
376 name = "winapi"
451 name = "winapi"
377 version = "0.3.8"
452 version = "0.3.8"
378 source = "registry+https://github.com/rust-lang/crates.io-index"
453 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -397,6 +472,7 b' source = "registry+https://github.com/ru'
397 "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
472 "checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
398 "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
473 "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
399 "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
474 "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
475 "checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
400 "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
476 "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
401 "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
477 "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
402 "checksum cpython 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85532c648315aeb0829ad216a6a29aa3212cf9319bc7f6daf1404aa0bdd1485f"
478 "checksum cpython 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85532c648315aeb0829ad216a6a29aa3212cf9319bc7f6daf1404aa0bdd1485f"
@@ -406,6 +482,7 b' source = "registry+https://github.com/ru'
406 "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
482 "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
407 "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
483 "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
408 "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
484 "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
485 "checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571"
409 "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
486 "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
410 "checksum libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)" = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
487 "checksum libc 0.2.64 (registry+https://github.com/rust-lang/crates.io-index)" = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
411 "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
488 "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
@@ -413,13 +490,18 b' source = "registry+https://github.com/ru'
413 "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
490 "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
414 "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
491 "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
415 "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
492 "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
493 "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b"
416 "checksum python27-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "372555e88a6bc8109eb641380240dc8d25a128fc48363ec9075664daadffdd5b"
494 "checksum python27-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "372555e88a6bc8109eb641380240dc8d25a128fc48363ec9075664daadffdd5b"
417 "checksum python3-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a8ebed3f1201fda179f3960609dbbc10cd8c75e9f2afcb03788278f367d8ea"
495 "checksum python3-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a8ebed3f1201fda179f3960609dbbc10cd8c75e9f2afcb03788278f367d8ea"
418 "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
496 "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
497 "checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412"
419 "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
498 "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
499 "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853"
420 "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
500 "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
421 "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
501 "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
502 "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
422 "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
503 "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
504 "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
423 "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
505 "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
424 "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
506 "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
425 "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
507 "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
@@ -435,6 +517,8 b' source = "registry+https://github.com/ru'
435 "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
517 "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
436 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
518 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
437 "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
519 "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
520 "checksum twox-hash 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56"
521 "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
438 "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
522 "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
439 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
523 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
440 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
524 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
@@ -14,5 +14,6 b' lazy_static = "1.3.0"'
14 memchr = "2.2.0"
14 memchr = "2.2.0"
15 rand = "0.6.5"
15 rand = "0.6.5"
16 rand_pcg = "0.1.1"
16 rand_pcg = "0.1.1"
17 rayon = "1.2.0"
17 regex = "1.1.0"
18 regex = "1.1.0"
18 rayon = "1.2.0"
19 twox-hash = "1.5.0"
@@ -5,9 +5,8 b''
5 // This software may be used and distributed according to the terms of the
5 // This software may be used and distributed according to the terms of the
6 // GNU General Public License version 2 or any later version.
6 // GNU General Public License version 2 or any later version.
7
7
8 use crate::{utils::hg_path::HgPathBuf, DirstateParseError};
8 use crate::{utils::hg_path::HgPathBuf, DirstateParseError, FastHashMap};
9 use std::collections::hash_map;
9 use std::collections::hash_map;
10 use std::collections::HashMap;
11 use std::convert::TryFrom;
10 use std::convert::TryFrom;
12
11
13 pub mod dirs_multiset;
12 pub mod dirs_multiset;
@@ -37,9 +36,9 b' pub struct DirstateEntry {'
37 /// merge.
36 /// merge.
38 pub const SIZE_FROM_OTHER_PARENT: i32 = -2;
37 pub const SIZE_FROM_OTHER_PARENT: i32 = -2;
39
38
40 pub type StateMap = HashMap<HgPathBuf, DirstateEntry>;
39 pub type StateMap = FastHashMap<HgPathBuf, DirstateEntry>;
41 pub type StateMapIter<'a> = hash_map::Iter<'a, HgPathBuf, DirstateEntry>;
40 pub type StateMapIter<'a> = hash_map::Iter<'a, HgPathBuf, DirstateEntry>;
42 pub type CopyMap = HashMap<HgPathBuf, HgPathBuf>;
41 pub type CopyMap = FastHashMap<HgPathBuf, HgPathBuf>;
43 pub type CopyMapIter<'a> = hash_map::Iter<'a, HgPathBuf, HgPathBuf>;
42 pub type CopyMapIter<'a> = hash_map::Iter<'a, HgPathBuf, HgPathBuf>;
44
43
45 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
44 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
@@ -11,16 +11,16 b''
11 use crate::utils::hg_path::{HgPath, HgPathBuf};
11 use crate::utils::hg_path::{HgPath, HgPathBuf};
12 use crate::{
12 use crate::{
13 dirstate::EntryState, utils::files, DirstateEntry, DirstateMapError,
13 dirstate::EntryState, utils::files, DirstateEntry, DirstateMapError,
14 FastHashMap,
14 };
15 };
15 use std::collections::hash_map::{self, Entry};
16 use std::collections::hash_map::{self, Entry};
16 use std::collections::HashMap;
17
17
18 // could be encapsulated if we care API stability more seriously
18 // could be encapsulated if we care API stability more seriously
19 pub type DirsMultisetIter<'a> = hash_map::Keys<'a, HgPathBuf, u32>;
19 pub type DirsMultisetIter<'a> = hash_map::Keys<'a, HgPathBuf, u32>;
20
20
21 #[derive(PartialEq, Debug)]
21 #[derive(PartialEq, Debug)]
22 pub struct DirsMultiset {
22 pub struct DirsMultiset {
23 inner: HashMap<HgPathBuf, u32>,
23 inner: FastHashMap<HgPathBuf, u32>,
24 }
24 }
25
25
26 impl DirsMultiset {
26 impl DirsMultiset {
@@ -28,11 +28,11 b' impl DirsMultiset {'
28 ///
28 ///
29 /// If `skip_state` is provided, skips dirstate entries with equal state.
29 /// If `skip_state` is provided, skips dirstate entries with equal state.
30 pub fn from_dirstate(
30 pub fn from_dirstate(
31 vec: &HashMap<HgPathBuf, DirstateEntry>,
31 vec: &FastHashMap<HgPathBuf, DirstateEntry>,
32 skip_state: Option<EntryState>,
32 skip_state: Option<EntryState>,
33 ) -> Self {
33 ) -> Self {
34 let mut multiset = DirsMultiset {
34 let mut multiset = DirsMultiset {
35 inner: HashMap::new(),
35 inner: FastHashMap::default(),
36 };
36 };
37
37
38 for (filename, DirstateEntry { state, .. }) in vec {
38 for (filename, DirstateEntry { state, .. }) in vec {
@@ -52,7 +52,7 b' impl DirsMultiset {'
52 /// Initializes the multiset from a manifest.
52 /// Initializes the multiset from a manifest.
53 pub fn from_manifest(vec: &Vec<HgPathBuf>) -> Self {
53 pub fn from_manifest(vec: &Vec<HgPathBuf>) -> Self {
54 let mut multiset = DirsMultiset {
54 let mut multiset = DirsMultiset {
55 inner: HashMap::new(),
55 inner: FastHashMap::default(),
56 };
56 };
57
57
58 for filename in vec {
58 for filename in vec {
@@ -127,7 +127,6 b' impl DirsMultiset {'
127 #[cfg(test)]
127 #[cfg(test)]
128 mod tests {
128 mod tests {
129 use super::*;
129 use super::*;
130 use std::collections::HashMap;
131
130
132 #[test]
131 #[test]
133 fn test_delete_path_path_not_found() {
132 fn test_delete_path_path_not_found() {
@@ -243,13 +242,13 b' mod tests {'
243 fn test_dirsmultiset_new_empty() {
242 fn test_dirsmultiset_new_empty() {
244 let new = DirsMultiset::from_manifest(&vec![]);
243 let new = DirsMultiset::from_manifest(&vec![]);
245 let expected = DirsMultiset {
244 let expected = DirsMultiset {
246 inner: HashMap::new(),
245 inner: FastHashMap::default(),
247 };
246 };
248 assert_eq!(expected, new);
247 assert_eq!(expected, new);
249
248
250 let new = DirsMultiset::from_dirstate(&HashMap::new(), None);
249 let new = DirsMultiset::from_dirstate(&FastHashMap::default(), None);
251 let expected = DirsMultiset {
250 let expected = DirsMultiset {
252 inner: HashMap::new(),
251 inner: FastHashMap::default(),
253 };
252 };
254 assert_eq!(expected, new);
253 assert_eq!(expected, new);
255 }
254 }
@@ -13,16 +13,16 b' use crate::{'
13 hg_path::{HgPath, HgPathBuf},
13 hg_path::{HgPath, HgPathBuf},
14 },
14 },
15 CopyMap, DirsMultiset, DirstateEntry, DirstateError, DirstateMapError,
15 CopyMap, DirsMultiset, DirstateEntry, DirstateError, DirstateMapError,
16 DirstateParents, DirstateParseError, StateMap,
16 DirstateParents, DirstateParseError, FastHashMap, StateMap,
17 };
17 };
18 use core::borrow::Borrow;
18 use core::borrow::Borrow;
19 use std::collections::{HashMap, HashSet};
19 use std::collections::HashSet;
20 use std::convert::TryInto;
20 use std::convert::TryInto;
21 use std::iter::FromIterator;
21 use std::iter::FromIterator;
22 use std::ops::Deref;
22 use std::ops::Deref;
23 use std::time::Duration;
23 use std::time::Duration;
24
24
25 pub type FileFoldMap = HashMap<HgPathBuf, HgPathBuf>;
25 pub type FileFoldMap = FastHashMap<HgPathBuf, HgPathBuf>;
26
26
27 const NULL_ID: [u8; 20] = [0; 20];
27 const NULL_ID: [u8; 20] = [0; 20];
28 const MTIME_UNSET: i32 = -1;
28 const MTIME_UNSET: i32 = -1;
@@ -327,7 +327,7 b' impl DirstateMap {'
327 if let Some(ref file_fold_map) = self.file_fold_map {
327 if let Some(ref file_fold_map) = self.file_fold_map {
328 return file_fold_map;
328 return file_fold_map;
329 }
329 }
330 let mut new_file_fold_map = FileFoldMap::new();
330 let mut new_file_fold_map = FileFoldMap::default();
331 for (filename, DirstateEntry { state, .. }) in self.state_map.borrow()
331 for (filename, DirstateEntry { state, .. }) in self.state_map.borrow()
332 {
332 {
333 if *state == EntryState::Removed {
333 if *state == EntryState::Removed {
@@ -157,13 +157,12 b' pub fn pack_dirstate('
157 #[cfg(test)]
157 #[cfg(test)]
158 mod tests {
158 mod tests {
159 use super::*;
159 use super::*;
160 use crate::utils::hg_path::HgPathBuf;
160 use crate::{utils::hg_path::HgPathBuf, FastHashMap};
161 use std::collections::HashMap;
162
161
163 #[test]
162 #[test]
164 fn test_pack_dirstate_empty() {
163 fn test_pack_dirstate_empty() {
165 let mut state_map: StateMap = HashMap::new();
164 let mut state_map: StateMap = FastHashMap::default();
166 let copymap = HashMap::new();
165 let copymap = FastHashMap::default();
167 let parents = DirstateParents {
166 let parents = DirstateParents {
168 p1: *b"12345678910111213141",
167 p1: *b"12345678910111213141",
169 p2: *b"00000000000000000000",
168 p2: *b"00000000000000000000",
@@ -194,7 +193,7 b' mod tests {'
194 .collect();
193 .collect();
195 let mut state_map = expected_state_map.clone();
194 let mut state_map = expected_state_map.clone();
196
195
197 let copymap = HashMap::new();
196 let copymap = FastHashMap::default();
198 let parents = DirstateParents {
197 let parents = DirstateParents {
199 p1: *b"12345678910111213141",
198 p1: *b"12345678910111213141",
200 p2: *b"00000000000000000000",
199 p2: *b"00000000000000000000",
@@ -230,7 +229,7 b' mod tests {'
230 .cloned()
229 .cloned()
231 .collect();
230 .collect();
232 let mut state_map = expected_state_map.clone();
231 let mut state_map = expected_state_map.clone();
233 let mut copymap = HashMap::new();
232 let mut copymap = FastHashMap::default();
234 copymap.insert(
233 copymap.insert(
235 HgPathBuf::from_bytes(b"f1"),
234 HgPathBuf::from_bytes(b"f1"),
236 HgPathBuf::from_bytes(b"copyname"),
235 HgPathBuf::from_bytes(b"copyname"),
@@ -270,7 +269,7 b' mod tests {'
270 .iter()
269 .iter()
271 .cloned()
270 .cloned()
272 .collect();
271 .collect();
273 let mut copymap = HashMap::new();
272 let mut copymap = FastHashMap::default();
274 copymap.insert(
273 copymap.insert(
275 HgPathBuf::from_bytes(b"f1"),
274 HgPathBuf::from_bytes(b"f1"),
276 HgPathBuf::from_bytes(b"copyname"),
275 HgPathBuf::from_bytes(b"copyname"),
@@ -284,8 +283,8 b' mod tests {'
284 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
283 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
285 .unwrap();
284 .unwrap();
286
285
287 let mut new_state_map: StateMap = HashMap::new();
286 let mut new_state_map: StateMap = FastHashMap::default();
288 let mut new_copy_map: CopyMap = HashMap::new();
287 let mut new_copy_map: CopyMap = FastHashMap::default();
289 let new_parents = parse_dirstate(
288 let new_parents = parse_dirstate(
290 &mut new_state_map,
289 &mut new_state_map,
291 &mut new_copy_map,
290 &mut new_copy_map,
@@ -341,7 +340,7 b' mod tests {'
341 .iter()
340 .iter()
342 .cloned()
341 .cloned()
343 .collect();
342 .collect();
344 let mut copymap = HashMap::new();
343 let mut copymap = FastHashMap::default();
345 copymap.insert(
344 copymap.insert(
346 HgPathBuf::from_bytes(b"f1"),
345 HgPathBuf::from_bytes(b"f1"),
347 HgPathBuf::from_bytes(b"copyname"),
346 HgPathBuf::from_bytes(b"copyname"),
@@ -359,8 +358,8 b' mod tests {'
359 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
358 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
360 .unwrap();
359 .unwrap();
361
360
362 let mut new_state_map: StateMap = HashMap::new();
361 let mut new_state_map: StateMap = FastHashMap::default();
363 let mut new_copy_map: CopyMap = HashMap::new();
362 let mut new_copy_map: CopyMap = FastHashMap::default();
364 let new_parents = parse_dirstate(
363 let new_parents = parse_dirstate(
365 &mut new_state_map,
364 &mut new_state_map,
366 &mut new_copy_map,
365 &mut new_copy_map,
@@ -388,7 +387,7 b' mod tests {'
388 .iter()
387 .iter()
389 .cloned()
388 .cloned()
390 .collect();
389 .collect();
391 let mut copymap = HashMap::new();
390 let mut copymap = FastHashMap::default();
392 copymap.insert(
391 copymap.insert(
393 HgPathBuf::from_bytes(b"f1"),
392 HgPathBuf::from_bytes(b"f1"),
394 HgPathBuf::from_bytes(b"copyname"),
393 HgPathBuf::from_bytes(b"copyname"),
@@ -402,8 +401,8 b' mod tests {'
402 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
401 pack_dirstate(&mut state_map, &copymap, parents.clone(), now)
403 .unwrap();
402 .unwrap();
404
403
405 let mut new_state_map: StateMap = HashMap::new();
404 let mut new_state_map: StateMap = FastHashMap::default();
406 let mut new_copy_map: CopyMap = HashMap::new();
405 let mut new_copy_map: CopyMap = FastHashMap::default();
407 let new_parents = parse_dirstate(
406 let new_parents = parse_dirstate(
408 &mut new_state_map,
407 &mut new_state_map,
409 &mut new_copy_map,
408 &mut new_copy_map,
@@ -11,12 +11,11 b''
11 //! `mercurial.setdiscovery`
11 //! `mercurial.setdiscovery`
12
12
13 use super::{Graph, GraphError, Revision, NULL_REVISION};
13 use super::{Graph, GraphError, Revision, NULL_REVISION};
14 use crate::ancestors::MissingAncestors;
14 use crate::{ancestors::MissingAncestors, dagops, FastHashMap};
15 use crate::dagops;
16 use rand::seq::SliceRandom;
15 use rand::seq::SliceRandom;
17 use rand::{thread_rng, RngCore, SeedableRng};
16 use rand::{thread_rng, RngCore, SeedableRng};
18 use std::cmp::{max, min};
17 use std::cmp::{max, min};
19 use std::collections::{HashMap, HashSet, VecDeque};
18 use std::collections::{HashSet, VecDeque};
20
19
21 type Rng = rand_pcg::Pcg32;
20 type Rng = rand_pcg::Pcg32;
22
21
@@ -25,7 +24,7 b' pub struct PartialDiscovery<G: Graph + C'
25 graph: G, // plays the role of self._repo
24 graph: G, // plays the role of self._repo
26 common: MissingAncestors<G>,
25 common: MissingAncestors<G>,
27 undecided: Option<HashSet<Revision>>,
26 undecided: Option<HashSet<Revision>>,
28 children_cache: Option<HashMap<Revision, Vec<Revision>>>,
27 children_cache: Option<FastHashMap<Revision, Vec<Revision>>>,
29 missing: HashSet<Revision>,
28 missing: HashSet<Revision>,
30 rng: Rng,
29 rng: Rng,
31 respect_size: bool,
30 respect_size: bool,
@@ -61,7 +60,7 b' fn update_sample<I>('
61 where
60 where
62 I: Iterator<Item = Revision>,
61 I: Iterator<Item = Revision>,
63 {
62 {
64 let mut distances: HashMap<Revision, u32> = HashMap::new();
63 let mut distances: FastHashMap<Revision, u32> = FastHashMap::default();
65 let mut visit: VecDeque<Revision> = heads.into_iter().collect();
64 let mut visit: VecDeque<Revision> = heads.into_iter().collect();
66 let mut factor: u32 = 1;
65 let mut factor: u32 = 1;
67 let mut seen: HashSet<Revision> = HashSet::new();
66 let mut seen: HashSet<Revision> = HashSet::new();
@@ -328,7 +327,8 b' impl<G: Graph + Clone> PartialDiscovery<'
328 }
327 }
329 self.ensure_undecided()?;
328 self.ensure_undecided()?;
330
329
331 let mut children: HashMap<Revision, Vec<Revision>> = HashMap::new();
330 let mut children: FastHashMap<Revision, Vec<Revision>> =
331 FastHashMap::default();
332 for &rev in self.undecided.as_ref().unwrap() {
332 for &rev in self.undecided.as_ref().unwrap() {
333 for p in ParentsIterator::graph_parents(&self.graph, rev)? {
333 for p in ParentsIterator::graph_parents(&self.graph, rev)? {
334 children.entry(p).or_insert_with(|| Vec::new()).push(rev);
334 children.entry(p).or_insert_with(|| Vec::new()).push(rev);
@@ -7,10 +7,11 b''
7
7
8 //! Handling of Mercurial-specific patterns.
8 //! Handling of Mercurial-specific patterns.
9
9
10 use crate::{utils::SliceExt, LineNumber, PatternError, PatternFileError};
10 use crate::{
11 utils::SliceExt, FastHashMap, LineNumber, PatternError, PatternFileError,
12 };
11 use lazy_static::lazy_static;
13 use lazy_static::lazy_static;
12 use regex::bytes::{NoExpand, Regex};
14 use regex::bytes::{NoExpand, Regex};
13 use std::collections::HashMap;
14 use std::fs::File;
15 use std::fs::File;
15 use std::io::Read;
16 use std::io::Read;
16 use std::path::{Path, PathBuf};
17 use std::path::{Path, PathBuf};
@@ -214,8 +215,8 b' pub fn build_single_regex('
214 }
215 }
215
216
216 lazy_static! {
217 lazy_static! {
217 static ref SYNTAXES: HashMap<&'static [u8], &'static [u8]> = {
218 static ref SYNTAXES: FastHashMap<&'static [u8], &'static [u8]> = {
218 let mut m = HashMap::new();
219 let mut m = FastHashMap::default();
219
220
220 m.insert(b"re".as_ref(), b"relre:".as_ref());
221 m.insert(b"re".as_ref(), b"relre:".as_ref());
221 m.insert(b"regexp".as_ref(), b"relre:".as_ref());
222 m.insert(b"regexp".as_ref(), b"relre:".as_ref());
@@ -24,6 +24,8 b' use crate::utils::hg_path::HgPathBuf;'
24 pub use filepatterns::{
24 pub use filepatterns::{
25 build_single_regex, read_pattern_file, PatternSyntax, PatternTuple,
25 build_single_regex, read_pattern_file, PatternSyntax, PatternTuple,
26 };
26 };
27 use std::collections::HashMap;
28 use twox_hash::RandomXxHashBuilder64;
27
29
28 /// Mercurial revision numbers
30 /// Mercurial revision numbers
29 ///
31 ///
@@ -53,6 +55,11 b' pub trait Graph {'
53
55
54 pub type LineNumber = usize;
56 pub type LineNumber = usize;
55
57
58 /// Rust's default hasher is too slow because it tries to prevent collision
59 /// attacks. We are not concerned about those: if an ill-minded person has
60 /// write access to your repository, you have other issues.
61 pub type FastHashMap<K, V> = HashMap<K, V, RandomXxHashBuilder64>;
62
56 #[derive(Clone, Debug, PartialEq)]
63 #[derive(Clone, Debug, PartialEq)]
57 pub enum GraphError {
64 pub enum GraphError {
58 ParentOutOfRange(Revision),
65 ParentOutOfRange(Revision),
@@ -15,9 +15,9 b' use cpython::{'
15 };
15 };
16 use hg::{
16 use hg::{
17 pack_dirstate, parse_dirstate, utils::hg_path::HgPathBuf,
17 pack_dirstate, parse_dirstate, utils::hg_path::HgPathBuf,
18 DirstatePackError, DirstateParents, DirstateParseError, PARENT_SIZE,
18 DirstatePackError, DirstateParents, DirstateParseError, FastHashMap,
19 PARENT_SIZE,
19 };
20 };
20 use std::collections::HashMap;
21 use std::convert::TryInto;
21 use std::convert::TryInto;
22
22
23 use crate::dirstate::{extract_dirstate, make_dirstate_tuple};
23 use crate::dirstate::{extract_dirstate, make_dirstate_tuple};
@@ -29,8 +29,8 b' fn parse_dirstate_wrapper('
29 copymap: PyDict,
29 copymap: PyDict,
30 st: PyBytes,
30 st: PyBytes,
31 ) -> PyResult<PyTuple> {
31 ) -> PyResult<PyTuple> {
32 let mut dirstate_map = HashMap::new();
32 let mut dirstate_map = FastHashMap::default();
33 let mut copies = HashMap::new();
33 let mut copies = FastHashMap::default();
34
34
35 match parse_dirstate(&mut dirstate_map, &mut copies, st.data(py)) {
35 match parse_dirstate(&mut dirstate_map, &mut copies, st.data(py)) {
36 Ok(parents) => {
36 Ok(parents) => {
@@ -85,7 +85,7 b' fn pack_dirstate_wrapper('
85
85
86 let mut dirstate_map = extract_dirstate(py, &dmap)?;
86 let mut dirstate_map = extract_dirstate(py, &dmap)?;
87
87
88 let copies: Result<HashMap<HgPathBuf, HgPathBuf>, PyErr> = copymap
88 let copies: Result<FastHashMap<HgPathBuf, HgPathBuf>, PyErr> = copymap
89 .items(py)
89 .items(py)
90 .iter()
90 .iter()
91 .map(|(key, value)| {
91 .map(|(key, value)| {
General Comments 0
You need to be logged in to leave comments. Login now