opened
suunrider
username_0
Programs which include 5 different libraries and are >2000 lines of code need ~5 seconds to compile. The code gets then 3 times compiled:
1. When validating
2. When closing editor
3. When placing ZCPU
That's really annoying if you make a small change. It's also pretty useless to compile a program 2-3 times.
I fixed it by only letting it compile when validating.
ZCPU: Removed unnecessary compiling
issue
created
AbigailBuccaneer
username_1
Is code automatically validated before placing?
comment
created
suunrider
username_0
It gets compiled when placing
comment
created
immibis
username_2
Does this change make it so the CPU tool uploads whatever was last compiled, not what's currently open in the editor?
comment
created
suunrider
username_0
It uploads the last compiled program. You can only compile with the validator button in the editor, which is the aim of this patch. If you upload the program while compiling, it will upload the last compiled (before current compiling) program.
comment
created
immibis
username_2
Can you make it so uploading will compile if the code has been changed since it was last compiled?

I'm guessing the answer is "no since the editor doesn't keep track of that"
comment
created
TomyLobo
username_3
so keep the last (hash of the) source that went into compilation and compare?
comment
created
immibis
username_2
Also, if the player starts a compile and then tries to upload, the upload should wait for the compile to finish before starting, so you can't accidentally upload stale code that way.
comment
created
suunrider
username_0
What about disabling uploading while compiling?
comment
created
TomyLobo
username_3
you'd also need to stop compilation once there's a change, otherwise you end up uploading code that finished compilation after the last editor change, but started compiling before it.
comment
created
AbigailBuccaneer
username_1
@username_3 In the long term I'd like to make a new more sane mostly-compatible language and rewrite the entire parser and compiler. As of yesterday I even have internet at home, too.
comment
created
TomyLobo
username_3
sounds good
comment
created
oldmud0
username_4
but rather ambitious
comment
created
immibis
username_2
@username_3 HL-ZASM is slow because of the intentional throttling.

I can only speculate why it's intentionally throttled as much as it is, but the problem fixed in [this commit](https://github.com/username_2/wiremod/commit/e08bbaef3dd4b03bb68406106cd2674d20259c7f) (part of PR #1004) might've been part of it - it causes an incredible amount of slowdown on large files. The throttling is broadly adjustable by the `wire_cpu_compile_speed` convar.

It would probably be better to throttle the compiler based on CPU time instead - say, to allow 10ms per frame. (How does E2 determine the amount of CPU time used?)
comment
created
AbigailBuccaneer
username_1
Because of the (apparent need) for this throttling, the compiler's written in a weird incremental way. I'd much rather see it written like a normal compiler and then use `coroutine.yield()` to do throttling as necessary, which would easily let us run the compiler until some amount of time has passed.
comment
created
suunrider
username_0
This got useless since the large compile times got fixed through #1004.
comment