moleike / haskell-jsonnet

🎏 Haskell implementation of Jsonnet
https://hackage.haskell.org/package/jsonnet
Other
21 stars 6 forks source link

Preloading of stdlib #33

Closed moleike closed 3 years ago

moleike commented 3 years ago

Find a way to preload the stdlib library e.g. using a serialisation library instead of a TH splice producing a huge Haskell expression. Parsing and desugaring still happens at compile-time, but we instead store the Jsonnet.Core output in a file (or embedded depending on the size), via a library like cereal or binary.

sbarzowski commented 3 years ago

An additional advantage of being able to store pre-processed Jsonnet code as data is that you can use it for other Jsonnet libs as well. You could have something similar to .pyc. This can result in massive performance advantage for repeated execution of code depending on a lot of libraries, especially things like auto-generated APIs.

BTW eventually I think we'll have some sort of bytecode upstream (i.e. for go-jsonnet) which will make serialization easier and the interpretation faster. If anyone wants to play with this idea, I'll be happy to discuss it.

moleike commented 3 years ago

@sbarzowski having some sort of bytecode representation is a nice idea, as you mention performance would be improved in certain scenarios and the tooling. But more importantly, sounds fun 😄 . I'd be keen on discussing how to implement an initial version.