Switch from Cap'n'proto to Serde for cache#5358
Switch from Cap'n'proto to Serde for cache#5358GearsDatapacks wants to merge 5 commits intogleam-lang:mainfrom
Conversation
| // Write cache file | ||
| let bytes = ModuleEncoder::new(&module.ast.type_info).encode()?; | ||
| let bytes = | ||
| metadata::encode(&module.ast.type_info).expect("Failed to serialise module cache"); |
There was a problem hiding this comment.
There's a slight difference in behaviour here in that previously warnings would not be stored for dependencies, but now they are. I don't think it results in them being shown to the programmer, but it does mean we do a little bit more work to encode and decode them each time.
Probably doesn't matter? What do you think?
There was a problem hiding this comment.
I have tested and they still are not shown to the programmer with this change. I can remove them from the cache as well though.
There was a problem hiding this comment.
Do you think it's worth doing that?
There was a problem hiding this comment.
Looking at the code, removing warning caching would mean we need to clone the ModuleInterface, as we only have an immutable reference here. Not sure if that's a worthwhile tradeoff
There was a problem hiding this comment.
Couldn't we mutate it instead? Swap the vector for an empty one?
There was a problem hiding this comment.
We are only given an immutable reference, so we cannot mutate it without cloning
c18cfe9 to
406a83b
Compare
406a83b to
5445a5d
Compare
5445a5d to
1893fdd
Compare
Closes #1599 and fixes #5260
This PR replaces Cap'n'proto with Serde and Bincode for module caching. I have also merged the
cache_inlineandcache_modulefiles into the main.cacheas I don't see a reason for them to be kept separate anymore.