Skip to content

getLarva() scans all units (expensive) #98

Closed

Description

@dgant

JBWAPI:
return game.getAllUnits().stream() .filter(u -> equals(u.getHatchery())) .collect(Collectors.toList());

Native BWAPI:
Unitset UnitImpl::getLarva() const { if (!getType().producesLarva()) return Unitset{}; return connectedUnits; }

BWAPI builds connectedUnits during its regular unit updates.

Activity

  1. JasperGeurtz commented on Oct 30, 2026

    @JasperGeurtz
    Collaborator

    AFAIK this hasn't been the case since >4y :)

    Can you check if syncing your purplewave's jbwapi version to develop's head fixes this for you?

  2. JasperGeurtz commented on Oct 30, 2026

    @JasperGeurtz
    Collaborator

    If this is about the ConnectedUnitCache implementation of jbwapi not being efficient (enough), I don't know of a better way to do it. But open for suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions