haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[ide/cache] signature-based module invalidation

Open nadako opened this issue 4 years ago • 1 comments

Creating this issue to write down an idea for possible significant performance improvements for the cache server (and as a consequence - IDE performance).


The problem:

Currently if module A uses module B and we change module B in any way - module A will invalidate, causing its dependants to invalidate as well and so on. As a result there is a lot of potentially redundant re-typing happening on every change, which especially hurts IDE performance a lot.


The idea:

We can NOT invalidate module A if module B has changed but it's signature stayed the same, where signature is: defined public types, field names and types.

So if you change something at expression level and that doesn't affect the API of the module - we don't invalidate dependants.


Notes:

There are potential problems with inlining, but we can be conservative for a start and use the "full" dependency if we inline something from a module and figure out something better later.

Detecting the signature changes might require re-typing the changed module (especially if monomorphs are involved in field types), but it's what we already do anyway and it's still better to re-type one module, detect that its signature hasn't changed and not invalidate its dependants than to always invalidate and re-type like we do now.


Some extra thoughts by @Simn:

11:50 I think as a first step we have to model dependents as (module * whatever) 11:51 There's probably three levels: 1. nothing changed 2. signature changed 3. everything changed

nadako avatar Dec 17 '20 11:12 nadako

We're now pretty much doing that whenever possible (though current implementation is more conservative, and considers more things as dependencies).

kLabz avatar Jul 19 '24 19:07 kLabz