ArnoHu ArnoHu loading

S_P_A_R_T wrote:

ArnoHu wrote:

S_P_A_R_T wrote:

ArnoHu wrote:

S_P_A_R_T wrote:

ArnoHu wrote:

S_P_A_R_T wrote:

After some review, it looks like I found the root issue of poor S3 performance! You see, after every move, WD updates the progress bar, on TW, this doesn't affect performance much but on S3, it's the difference between 18 NPS, and 136 NPS! (136 / 18 = 7.5x faster!)

Now the only problem is that the progress bar doesn't load along with the engine as it's in search.

Good news! If you want to trigger a screen update from a run-without-refresh custom block, the only way is to broadcast a message and repaint in message receiver. That is by using broadcast, not broadcast-and-wait (the latter will kill performance completely).

Oh I see!

But when I try to implement it without “wait”, it just doesn't trigger the screen update… (And doesn't GoK use a broadcast-and-wait in it's code too?)

Yes it does, but not when the engine is running via run-without-screen-refresh.

Here is the code for progress bar update (wait(0) required for yielding):
https://github.com/ArnoHue/scratch/blob/116a8e6f96294e5f35c313419483e6f7b9bd2141/chess/Engine.scratch#L7567
https://github.com/ArnoHue/scratch/blob/116a8e6f96294e5f35c313419483e6f7b9bd2141/chess/Engine.scratch#L646
https://github.com/ArnoHue/scratch/blob/116a8e6f96294e5f35c313419483e6f7b9bd2141/chess/ProgressBar.scratch#L84

WD (P2) played great against GoK (Medium, black) on Scratch 3 here, and was ahead during early midgame:
https://lichess.org/eSguZ1fM#104

Ah ok, so the “internal” broadcast isn't with “wait” as that would affect performance, but it's OK for the broadcast that the internal one triggers, as that's not part of the loop, right?

Exactly!

Wait, I've realised that it doesn't refresh until the ply is finished. Is this expected behavior?

On TurboWarp? Yes, unless you enable Warp Timer.