nevalang / neva

🌊 Dataflow programming language with static types and implicit parallelism. Compiles to native code and Go
https://nevalang.org
MIT License
91 stars 7 forks source link

Compiler reinstalls stdlib onto the disk on each compilation #563

Open emil14 opened 5 months ago

emil14 commented 5 months ago

It's not clear and should be fixed somehow

emil14 commented 5 months ago

Introduce snapshot_id

Possible solution

Every time we (re)compile compiler (not when we run it!) we calculate some "snapshot id".

That ID (which is probably UUID or UNIX timestamp) is somehow inserted into stdlib (maybe into neva.yaml as some metadata).

When compiler reads stdlib from disk (if it's there, otherwise it simply reads it) it ensures that this snapshot_id in stdlib is exactly the same as in the compiler's binary. If they don't match, it erases the stdlib on the disk and replaces it with the embedded one (with the right snapshotID).

P.S - we could use go generate and maybe embed to handle that.

emil14 commented 5 months ago

561 will contain dirty hack that will erase stdlib from disk each time compiler runs, this is temporary solution that is bad for performance and unclear, we must replace it with either snapshot_id or (even better, if possible) rewrite builder in a way it can use embedded FS along with normal one - that would be perfect.

emil14 commented 5 months ago

Status changed to minor because now this is basically performance issue. Actually not even an issue but performance optimisation idea (that feels like it has to be done tho).