-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nickel startup overhead seems significant. #2140
Comments
I ran into something similar when benchmarking package manifest evaluation. It turns out that there's a substantial (~20ms on my machine) amount of time spent parsing the standard library. We embed the standard library source in the nickel binary, but parse it on every evaluation. Possible mitigations:
|
That explains. Thanks!
I imagine if the parsed stdlib is somehow serializable (in a straightforward way a la serde) then this approach would be quite feasible? Otherwise, it sounds like lots of work for relatively little gain.
This is an interesting approach, and paying the startup overhead once is definitely acceptable, since that's the minimum cost no matter what. Though the CLI interface might be the tricky part. On top of my head I can't think of a CLI program that enables such "multiple input, multiple output" paradigm. Also in my case, there are calls to both "lazy" parsing of stdlib is another approach, just to add to the ideas list. |
Given RFC007 is in the process of being implemented, I would be inclined to wait to see the result first. In particular once we have a bytecode VM, there's a natural, serializable format to store the stdlib already processed: bytecode. It might take a bit of time to land still, so if it's really an important problem, maybe one light work-around could be considered in the meantime. Otherwise, there's a |
Thanks for mentioning the --no-stdlib flag, did not know about that before. It's not urgent at all, and I can work around that by executing nickel calls in parallel. Looking forward to seeing the bytecode VM landed! |
This is not a "request" in any way, just a nice-to-have sort of issue.
I noticed that nickel's startup time is "slow": on my machine it took about 35ms to execute a minimal '{a = 1} | nickel eval'. For reference, a minimal python invocation
python -c '1 + 1'
took 15ms.In most circumstances this doesn't matter. But I noticed the lag because I was using nickel in a nushell module to validate a bunch of json files during import. Nickel binary is called 8 times, which costs ~400ms, leading to the noticeable lag for the nushell module import.
I wonder if there are low hanging fruits that could improve the startup time.
The text was updated successfully, but these errors were encountered: