-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Labels
Description
As described in this hackmd, we currently create an interned ingredient for every tracked function unless it has exactly 1 argument. This is wasteful. The reason we do this is because the memos for tracked functions are stored on salsa structs1 and so we need to have a 1:1 relationship between a (salsa struct, tracked fn) pair and a memo.
We should refactor things so that:
- Every tracked function has as its first argument a salsa struct. If there are no arguments, we can add some kind of dummy interned struct in
salsalike#[salsa::intern] struct Placeholder<'db>{ data: () }and redefine the argument as being called on aPlaceholder<'db>, which we can trivially create (it'd also be nice to have a more optimized "global struct", maybe that's worth thinking about; even interning unit is more work than it really ought to be for this case). - For tracked functions with >1 argument, when you index into the memo-table for a tracked struct, you would get back a
DashMapinstead of a single memo; the map would be keyed by the additional arguments.
Footnotes
-
(Salsa struct = input | tracked | interned) ↩
Reactions are currently unavailable