The problem
Every request is one round trip. find_surface in Recompile's shoot_scenes.py walks down from
y=110 looking for a standing position, running two commands per candidate:
for y in range(high, low, -1):
solid = bridge.command(f"execute unless block {x} {y - 1} {z} minecraft:air")
clear = bridge.command(f"execute if block {x} {y} {z} minecraft:air")
That is up to a hundred sequential socket calls, each queued onto the server thread and waited on,
to answer one question.
The proposal
Let a request carry several verbs and return several replies:
{"verb": "batch", "requests": [{"verb": "cmd", "command": "..."}, {"verb": "cmd", "command": "..."}]}
{"ok": true, "replies": [{"ok": true, "output": "..."}, {"ok": true, "output": "..."}]}
The win is not raw speed so much as fewer server-thread hops: a batch can run its commands in one
server.execute rather than one each.
Notes
- Needs a decision on failure semantics: stop at the first failure, or run everything and report per
item. Probably the latter, with an ok per reply, since a verifier usually wants the whole
picture.
- Should refuse to batch
stop, and probably screenshot, since those change which thread and
which lifecycle stage everything after them runs in.
- Lower priority than the tier-one items: it makes existing things faster rather than making
currently-impossible things possible.
The problem
Every request is one round trip.
find_surfacein Recompile'sshoot_scenes.pywalks down fromy=110 looking for a standing position, running two commands per candidate:
That is up to a hundred sequential socket calls, each queued onto the server thread and waited on,
to answer one question.
The proposal
Let a request carry several verbs and return several replies:
{"verb": "batch", "requests": [{"verb": "cmd", "command": "..."}, {"verb": "cmd", "command": "..."}]} {"ok": true, "replies": [{"ok": true, "output": "..."}, {"ok": true, "output": "..."}]}The win is not raw speed so much as fewer server-thread hops: a batch can run its commands in one
server.executerather than one each.Notes
item. Probably the latter, with an
okper reply, since a verifier usually wants the wholepicture.
stop, and probablyscreenshot, since those change which thread andwhich lifecycle stage everything after them runs in.
currently-impossible things possible.