Skip to content

Example: performance on every target #64

Open

Description

@houko

Context

Part of #8.

Scope

Measure 1000 moving sprites with --nsgo-fps on macOS, Windows, Linux, the web, an iPhone and an Android phone.

Acceptance

  • The readings are in the README; desktops hold the display's rate and phones 60 fps.

Activity

  1. added
    enhancement
    on Nov 21, 2026
  2. houko commented on Nov 25, 2026

    @houko
    ContributorAuthor

    Measured examples/caverun with the 1000-firefly stress swarm enabled (SPRITES 1012, single DrawAtlas) on physical devices:

    Target Device Display rate Measured with 1000 sprites (--nsgo-fps) Notes
    Android Google Pixel 3 XL (Android 12) 60 Hz 59–60 fps (0% dropped, frame 0.24–0.35 ms, 60 commits/s) Holds 60 fps target
    Web Google Chrome (Apple M4 Pro) 60 Hz (test) 60 commits/s (0% dropped, app 0.65 ms, core 0.35 ms, engine 21%) Visually verified SPRITES 1012
    macOS MacBook Pro, Apple M4 Pro 120 Hz ~16 fps (APP 0.24 ms, CORE 0.08 ms, engine 1%; TICK 42.13 ms, CPU 103%, GPU 70%, MEM grew 232→351 MB) Bottleneck is upstream NSGo v0.3.0 Apple CoreGraphics Canvas.DrawAtlas (Go game code takes only 0.32 ms/frame)
    iOS iPhone 17 (iPhone18,3, release -fps) 120 Hz ~12.5 fps (sprites=1012, sustained over 30s) Same upstream NSGo v0.3.0 Apple CoreGraphics Canvas.DrawAtlas bottleneck
    Linux AMD Ryzen 9 3900X + Radeon RX 6800/6900 XT 2560×1440 Binary launches cleanly; remote monitor asleep (needs interactive unlocked display for live --nsgo-fps)
    Windows Intel Core i5-14600KF (win-runner) VM (Microsoft Basic Display Adapter) Binary deployed; needs physical/GPU-attached interactive desktop for real --nsgo-fps

    Keeping #64 open because macOS and iOS currently fall short of display rate / 60 fps due to NSGo v0.3.0's Apple CoreGraphics Canvas.DrawAtlas backend (while Android Pixel 3 XL already holds 59–60 fps with identical zero-alloc Go code).

  3. houko commented on Nov 27, 2026

    @houko
    ContributorAuthor

    Update on the macOS / iOS Apple Canvas.DrawAtlas bottleneck:

    1. Upstream fix merged: perf(apple): batch Canvas.DrawAtlas compositing in pure Go nsgo#2525 replaces Apple's per-sprite CGContextSetAlpha + CGContextDrawImage loop in Canvas.DrawAtlas with a two-tier pure-Go premultiplied blitter (direct CGBitmapContext write for Tier 1; single-blit tight-bounds scratch bitmap for live CALayer display-list contexts with ≥64 sprites for Tier 2).
      • 1,000-sprite 2560×1440 Retina unit benchmark: 8.26 ms / 7,050 allocs → 0.86 ms (Linear) / 0.46 ms (Nearest) (Tier 1) and 2.34 ms (Tier 2).
    2. Live Apple M4 Pro (120 Hz ProMotion) verification (go tool nsgo test -target macos -activate -fps, 960×540@2x, SPRITES 1012 swarm on):
    3. README updated in chore: guard release notes length and record Cave Run perf readings #1257 with the verified Android, Web, and macOS readings.

    Keeping #64 (and parent #8) open until:

    • NSGo cuts a release containing Canvas.ResolutionScale (nsgo-dev/nsgo@b78d869f3) and perf(apple): batch Canvas.DrawAtlas compositing in pure Go nsgo#2525 so examples/caverun can bump its tagged nsgo dependency and enable ResolutionScale + Sampling: core.ImageSamplingNearest,
    • iOS is re-measured on a physical iPhone (60 fps target), and
    • Windows and Linux are measured on physical GPU-attached interactive displays.
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions