-
Notifications
You must be signed in to change notification settings - Fork 302
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
Performance: Evaluation of 200 lines takes >130s #3654
Comments
@loisch thanks for raising this. Please can you help to provide the following details (taken from the bug report template):
I've already noted that under evalv3 we run into #3597 |
Sorry... I've made testscripts to explain (see below). OverviewThere seem to be three - possibly related - issues concerning
1) PerformanceWith my definitions every operation (cue vet, cue export, cue eval) is very slow. I'm processing a tree of six nodes defined at the bottom of my program (see reproducers below):
When leaving out the
2) CorrectnessWhen the
I don't understand these errors. Probably this is my fault but it's still a problem when using CUE if it's so hard to understand what's wrong.
I don't know where this
so the upper should be equivalent to 3) Referential transparencyComing from Haskell I'd expect a pure / side-effect-free language such as CUE to have referential transparency, that is replacing a name with it's definition doesn't change the meaning of the program. That's not the case in CUE: When repeating the same term in an expression unification fails:
while it unifies when the term appears only once
When I give
I hope that this behavior is due to a bug, because I'd have no idea how I could work with CUE when I have to exactly know how the evaluation order is and when a name is replaced with it's definition to be able to predict if unification will succeed or fail. I also seems very hard to optimize the evaluator when replacing a name with it's definition changes semantics. ReproducersWhat version of CUE are you using (
|
I'm opening an issue because #2850 told me to.
Context: I'm evaluating CUE as a configuration language for our hospital information system with about 120.000 loc (just 2,5 MB) of declarative configuration that consists of data (catalogs) and DSL code. The configuration uses files with XML and (Emacs) org-mode syntax. Currently our Haskell backend parses and checks the configuration in less than a second. I'd like to replace that configuration using CUE.
Thank's to @myitcv I've managed to write CUE definitions that check my input and generate my old-style org-mode configuration. But just with about 40 lines of test data
cue eval
already needs 130s on my Mac M2. Haskell's lazyness has got it's surprises so I'm used to think differently about performance for different languages.Why does my CUE program take so long and what can I do about it? How do I need to think about performance when writing CUE code? Which constructions can be evaluated in linear / quadratic / cubic (or worse?) time? Am I using too many disjunctions?
I've tried the new evaluator (using my own build at commit f2775f8) but that didn't change anything.
Without my org-generation the checking is fast. So maybe CUE is just not suited as a programming language for generating my old-style org-syntax configuration format?
The text was updated successfully, but these errors were encountered: