Skip to content

batch several requests into one round trip #19

Description

@Flatts3000

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions