Use slower and smaller heap sort for hardlink list

Saves 20 KiB off of the ReleaseSafe + stripped binary. That feature is
(1) rarely used and (2) rarely deals with large lists, so no point
spending that much space on an efficient sort implementation.
This commit is contained in:
Yorhel 2024-07-18 21:43:18 +02:00
parent f28f69d831
commit 9cbe1bc91f

View file

@ -380,10 +380,7 @@ const info = struct {
if (&l.entry == e) if (&l.entry == e)
break; break;
} }
// TODO: Zig's sort() implementation is type-generic and not very std.sort.heap(*model.Link, list.items, {}, lt);
// small. I suspect we can get a good save on our binary size by using
// a smaller or non-generic sort. This doesn't have to be very fast.
std.mem.sort(*model.Link, list.items, {}, lt);
for (list.items, 0..) |n,i| if (&n.entry == e) { links_idx = i; }; for (list.items, 0..) |n,i| if (&n.entry == e) { links_idx = i; };
links = list; links = list;
} }