cue icon indicating copy to clipboard operation
cue copied to clipboard

cmd/cue: cmd definition adds significant time to export of yaml

Open cueckoo opened this issue 4 years ago • 2 comments

Originally opened by @myitcv in https://github.com/cuelang/cue/issues/757

What version of CUE are you using (cue version)?

$ cue version
cue version +760aa115 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

Like #756, this is a non-minimal repro in order to demonstrate a perceivable timing difference.

Given this issue is based on the same example as #756, it's possible the slowdown here is a function of the underlying cause of #756. Nonetheless, reporting this for completeness.

That said, a number of people have anecdotally said "cue cmd makes things slower". This issue seeks to demonstrate the difference between a cue eval --out yaml and a cue cmd command that does exactly the same thing (in fact marginally less).

https://gist.github.com/myitcv/849b8aeaecf2469706ce0a15251c0040

The cue cmd command is defined as follows:

package ci

import (

	"encoding/yaml"

	"tool/file"
)

command: genworkflows: {
	"test.yml": file.Create & {
		filename: "tmp/test.yml"
		contents: yaml.Marshal(test)
	}
}

where test is one of our GitHub workflow declarations.

The cue export command run is:

cue eval --out yaml -o tmp/out

What did you expect to see?

Similar timings between the two

What did you see instead?

The cue cmd command taking almost twice as long:

> exec time -p cue eval --out yaml -o tmp/out
[stderr]
real 0.95
> exec time -p cue cmd genworkflows
[stderr]
real 1.74

Tentatively marking this as v0.3.0... but on the basis we're looking to rewrite cue cmd as cuerun we may choose to simply ignore this for now.

cueckoo avatar Jul 03 '21 10:07 cueckoo

Dropping the now-defunct v0.4.x milestone from this issue, but leaving the zGarden label such that we come round to considering what milestone this should sit in.

myitcv avatar Jun 20 '23 12:06 myitcv