Commit cc5f1e1
authored
Cache common instances (#19621)
These few types account for a significant proportion of all types
created:
* `str` is just everywhere
* `object` and `function` are used as fallbacks in many places
* `int` and `bool` are coming from various literals
This gives around 1.5% performance improvement on my desktop. This is a
bit ugly, but also looks like an easy win. Note that during semantic
analysis I am caching types more conservatively, just in case some
plugins modify them in place (`named_type()` is a part of semantic
analyzer plugin interface).1 parent 186515f commit cc5f1e1
3 files changed
+64
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
434 | 441 | | |
435 | 442 | | |
436 | 443 | | |
| |||
7369 | 7376 | | |
7370 | 7377 | | |
7371 | 7378 | | |
| 7379 | + | |
| 7380 | + | |
| 7381 | + | |
| 7382 | + | |
| 7383 | + | |
| 7384 | + | |
| 7385 | + | |
| 7386 | + | |
| 7387 | + | |
| 7388 | + | |
| 7389 | + | |
| 7390 | + | |
| 7391 | + | |
| 7392 | + | |
| 7393 | + | |
| 7394 | + | |
| 7395 | + | |
| 7396 | + | |
| 7397 | + | |
| 7398 | + | |
| 7399 | + | |
| 7400 | + | |
| 7401 | + | |
7372 | 7402 | | |
7373 | 7403 | | |
7374 | 7404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
363 | 366 | | |
364 | 367 | | |
365 | 368 | | |
| |||
3428 | 3431 | | |
3429 | 3432 | | |
3430 | 3433 | | |
3431 | | - | |
3432 | | - | |
3433 | | - | |
3434 | | - | |
3435 | | - | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
3436 | 3447 | | |
3437 | 3448 | | |
3438 | 3449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
500 | 504 | | |
501 | 505 | | |
502 | 506 | | |
| |||
1241 | 1245 | | |
1242 | 1246 | | |
1243 | 1247 | | |
1244 | | - | |
| 1248 | + | |
1245 | 1249 | | |
1246 | 1250 | | |
1247 | 1251 | | |
| |||
1373 | 1377 | | |
1374 | 1378 | | |
1375 | 1379 | | |
1376 | | - | |
| 1380 | + | |
1377 | 1381 | | |
1378 | 1382 | | |
1379 | 1383 | | |
| |||
1536 | 1540 | | |
1537 | 1541 | | |
1538 | 1542 | | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
| 1543 | + | |
1542 | 1544 | | |
1543 | 1545 | | |
1544 | 1546 | | |
| |||
6630 | 6632 | | |
6631 | 6633 | | |
6632 | 6634 | | |
6633 | | - | |
| 6635 | + | |
| 6636 | + | |
| 6637 | + | |
6634 | 6638 | | |
6635 | 6639 | | |
6636 | | - | |
| 6640 | + | |
| 6641 | + | |
| 6642 | + | |
| 6643 | + | |
| 6644 | + | |
| 6645 | + | |
| 6646 | + | |
| 6647 | + | |
6637 | 6648 | | |
6638 | 6649 | | |
6639 | 6650 | | |
| |||
0 commit comments