I want to measure compilation and TTFP latencies. So my idea was to run different scripts in fresh Julia processes which I start from a main Julia process so that each time Julia has to reliably compile everything anew.
There are two problems:
- How can I keep a Julia process open and run separate chunks of code in it synchronously? For example, first I would run
@timed using Package, then do something with the result in the main Julia process, then execute the next block that makes further use of
I tried something like
open(`julia`, "w", some_iobuffer) do process println(process, some_commands) do_something_with_some_iobuffer() println(process, some_more_commands) do_something_else_with_some_iobuffer() end
The problem is that
println(process, ... is asynchronous, so the iobuffer doesn’t contain the expected written out data afterwards. That leads me to the second question:
- How can I send data from the child process to the main process? In practice that would just be a couple of NamedTuples without any special other types embedded inside of them. Currently, because the iobuffer method doesn’t work, I’m writing to a csv file, but that seems clunky.