Commit 016fd7c
Use StringValue in dict key in ParametersSpec::collect
Summary:
Before this diff `kwargs` were collected into `Dict` which is `SmallMap<Hashed<Value>, Value>`.
Now `kwargs` are collected into `SmallMap<Hashed<StringValue>, Value>` and that `SmallMap` is "coerced" into a map with `Value` key.
When inserting keys we lookup previous keys (this should be partially addressed by [this PR in indexmap](indexmap-rs/indexmap#200)), and equality operation on `StringValue` is cheaper that equality on `Value` because there's no dynamic casts. We don't do real equality often (because hash collisions are rare), but having `StringValue` instead of `Value` may generate more efficient machine code.
Also this makes code a little more type-safe.
Reviewed By: ndmitchell
Differential Revision: D30921794
fbshipit-source-id: cf2b4fa72eeef150e6308d2fe2d7c16f591665861 parent 1f85103 commit 016fd7c
File tree
2 files changed
+40
-16
lines changed- starlark/src
- eval/runtime
- values/layout
2 files changed
+40
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
374 | | - | |
375 | | - | |
| 378 | + | |
| 379 | + | |
376 | 380 | | |
377 | 381 | | |
378 | 382 | | |
379 | 383 | | |
380 | 384 | | |
381 | 385 | | |
382 | | - | |
| 386 | + | |
383 | 387 | | |
384 | 388 | | |
385 | | - | |
| 389 | + | |
386 | 390 | | |
387 | 391 | | |
388 | 392 | | |
| |||
425 | 429 | | |
426 | 430 | | |
427 | 431 | | |
428 | | - | |
| 432 | + | |
429 | 433 | | |
430 | 434 | | |
431 | 435 | | |
| |||
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
469 | | - | |
| 473 | + | |
470 | 474 | | |
471 | 475 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
477 | 484 | | |
478 | 485 | | |
479 | 486 | | |
| |||
483 | 490 | | |
484 | 491 | | |
485 | 492 | | |
486 | | - | |
| 493 | + | |
487 | 494 | | |
488 | 495 | | |
489 | 496 | | |
| |||
538 | 545 | | |
539 | 546 | | |
540 | 547 | | |
541 | | - | |
542 | | - | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
543 | 553 | | |
544 | 554 | | |
545 | | - | |
| 555 | + | |
546 | 556 | | |
547 | 557 | | |
548 | 558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| |||
161 | 171 | | |
162 | 172 | | |
163 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
164 | 178 | | |
165 | 179 | | |
166 | 180 | | |
| |||
0 commit comments