Closed moleike closed 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.
@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.
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 theJsonnet.Core
output in a file (or embedded depending on the size), via a library like cereal or binary.