Commit 7d3863f
authored
Reduce memory usage in IEx autocomplete module listing (#15140)
Use :erlang.loaded/0 instead of :code.all_loaded/0 since we only need
module names, not file paths. The latter copies the full path for every
loaded module, which on production systems with many dependencies
caused significant memory spikes (measured 2.8MB -> 172KB on a real pod).
Also replace Enum.sort/1 |> Enum.dedup/1 with :lists.usort/1 and
avoid list allocations.1 parent 29f5726 commit 7d3863f
1 file changed
Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
512 | | - | |
513 | | - | |
514 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
518 | | - | |
519 | | - | |
| 517 | + | |
| 518 | + | |
520 | 519 | | |
521 | 520 | | |
522 | 521 | | |
523 | 522 | | |
524 | 523 | | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
525 | 531 | | |
526 | 532 | | |
527 | 533 | | |
| |||
604 | 610 | | |
605 | 611 | | |
606 | 612 | | |
607 | | - | |
608 | | - | |
| 613 | + | |
609 | 614 | | |
610 | 615 | | |
611 | 616 | | |
| |||
615 | 620 | | |
616 | 621 | | |
617 | 622 | | |
618 | | - | |
| 623 | + | |
619 | 624 | | |
620 | 625 | | |
621 | 626 | | |
| |||
0 commit comments