Look up package name for a node ID in the parallel arrays. nids must be * sorted ascending (the node query orders by id) — a linear scan here is * O(E×N) across the edge loop and spun for >10 minutes on Linux-kernel-sized * graphs (~1.4M defs × ~1.4M CALLS edges). */
| 5773 | * O(E×N) across the edge loop and spun for >10 minutes on Linux-kernel-sized |
| 5774 | * graphs (~1.4M defs × ~1.4M CALLS edges). */ |
| 5775 | static const char *lookup_pkg(const int64_t *nids, char **npkgs, int nn, int64_t id) { |
| 5776 | int lo = 0; |
| 5777 | int hi = nn - SKIP_ONE; |
| 5778 | while (lo <= hi) { |
| 5779 | int mid = lo + (hi - lo) / PAIR_LEN; |
| 5780 | if (nids[mid] == id) { |
| 5781 | return npkgs[mid]; |
| 5782 | } |
| 5783 | if (nids[mid] < id) { |
| 5784 | lo = mid + SKIP_ONE; |
| 5785 | } else { |
| 5786 | hi = mid - SKIP_ONE; |
| 5787 | } |
| 5788 | } |
| 5789 | return NULL; |
| 5790 | } |
| 5791 | |
| 5792 | /* Accumulate a cross-package boundary into parallel arrays. */ |
| 5793 | static void accum_boundary(const char *src_pkg, const char *tgt_pkg, char **bfroms, char **btos, |