This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Commit 128f768
committed
perf: replace String[]/parseDouble Dijkstra PQ entries with typed DijkstraEntry
The Dijkstra priority queue stored entries as String[]{vertex, String.valueOf(dist)}
and recovered distances via Double.parseDouble() on every poll and comparison.
This caused:
1. Extra String allocation per enqueue (String.valueOf on double)
2. O(L) parseDouble on every PQ comparison instead of O(1) Double.compare
3. Unnecessary GC pressure from short-lived String[] + String objects
Now uses a typed DijkstraEntry with primitive double field — eliminates all
string conversions and reduces comparison cost to a single double compare.
Affects all path operations: K-shortest, constrained, avoidance routing.1 parent 36cf0bc commit 128f768
1 file changed
Lines changed: 36 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
636 | 651 | | |
637 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
638 | 668 | | |
639 | 669 | | |
640 | 670 | | |
641 | 671 | | |
642 | 672 | | |
643 | 673 | | |
644 | | - | |
645 | | - | |
| 674 | + | |
646 | 675 | | |
647 | 676 | | |
648 | | - | |
| 677 | + | |
649 | 678 | | |
650 | 679 | | |
651 | | - | |
652 | | - | |
653 | | - | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
654 | 683 | | |
655 | 684 | | |
656 | 685 | | |
| |||
667 | 696 | | |
668 | 697 | | |
669 | 698 | | |
670 | | - | |
| 699 | + | |
671 | 700 | | |
672 | 701 | | |
673 | 702 | | |
| |||
0 commit comments