Skip to content

Optimize LightList copies - #2

Draft
8Keep wants to merge 5 commits into
jmh-benchmark-harnessfrom
lightlist-hotpath-copies
Draft

8Keep wants to merge 5 commits into
jmh-benchmark-harnessfrom
lightlist-hotpath-copies

Conversation

@8Keep

@8Keep 8Keep commented May 17, 2026

Copy link
Copy Markdown
Owner

Needs my jmh harness PR in jMonkeyEngine#2778

Summary

  • avoid copying and clearing unused retained LightList backing capacity
  • use bulk copy/fill paths for unfiltered world light-list updates
  • keep the retained sort buffer sized to active lights instead of backing-array capacity
  • add focused LightList regression tests for removal ordering, update ordering/filtering, and sorting after retained capacity

Benchmark Results

JMH results from the jme3-core benchmark harness, lower is better:

Before -> After

  • removeFromFront, 256 lights: 0.317 us/op -> 0.036 us/op
  • removeFromMiddle, 256 lights: 0.172 us/op -> 0.031 us/op
  • updateFromLocalAndParent, 256 lights: 0.738 us/op -> 0.195 us/op
  • sortTransformChanged, 256 lights, retained x1024: 94.191 us/op -> 25.909 us/op

Testing

  • ./gradlew :jme3-core:test --tests com.jme3.light.LightListTest :jme3-core:benchmarkClasses

@8Keep
8Keep force-pushed the jmh-benchmark-harness branch from cc0750d to 2876086 Compare May 19, 2026 22:53
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch from 5906442 to bd6da59 Compare May 19, 2026 23:09
@8Keep
8Keep force-pushed the jmh-benchmark-harness branch from 2876086 to dc27f27 Compare May 27, 2026 02:42
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch from bd6da59 to 6b2ec09 Compare May 27, 2026 02:45
@8Keep
8Keep force-pushed the jmh-benchmark-harness branch from dc27f27 to b0fce5b Compare May 27, 2026 18:23
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch 2 times, most recently from 4400dac to e2dfcf2 Compare May 27, 2026 18:43
@8Keep
8Keep force-pushed the jmh-benchmark-harness branch from b0fce5b to 5c81b07 Compare May 28, 2026 20:05
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch from e2dfcf2 to 5fe394e Compare May 28, 2026 20:05
@8Keep
8Keep force-pushed the jmh-benchmark-harness branch from 5c81b07 to fb1e304 Compare September 2, 2026 14:45
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch from 5fe394e to f67972b Compare September 2, 2026 14:45
@8Keep
8Keep force-pushed the jmh-benchmark-harness branch from efd97f5 to a989775 Compare October 30, 2026 17:45
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch 2 times, most recently from 1854dd1 to b26c971 Compare October 30, 2026 19:16
@8Keep
8Keep force-pushed the lightlist-hotpath-copies branch from b26c971 to 3928357 Compare October 30, 2026 20:42
toaster0123 and others added 4 commits October 31, 2026 00:08
…Engine#2982)

* BitmapFont: complete array-based assembly and color-tag traversal cleanup

Supersede PR jMonkeyEngine#2963 and address issue jMonkeyEngine#2221 and maintainer review 5255645948.
Reconstruct the missing changes and regression tests from current master,
retaining the valid BitmapTextPage work from the original PR.

Co-authored-by: Jaime Bot <jaime@rblb.it>

* BitmapFont: remove unused LetterQuad buffer append helpers

Remove the five obsolete append helpers and their unused nio imports after
the unreachable non-array BitmapTextPage assembly path was deleted.
Repository-wide Java search confirms no remaining call sites.

Addresses the review by @jaime-jmebot:
jMonkeyEngine#2982 (comment)

The original Jaime Bot contribution remains credited in the parent commit.

* Optimize bitmap-text updates and reuse glyph and mesh buffers

Separate color refreshes from layout, reuse parsed letter quads and page
membership, grow NIO buffers geometrically, and retain unchanged indices.
Apply color tags in one pass and avoid allocations for untagged text and
steady-state alpha updates.

Preserve clone styling and isolate cached state. Invalidate the complete
layout suffix and refresh style changes so selective updates cannot leave
stale wrapping or glyphs. Add regression coverage for reuse, clipping,
shaping, clones, buffer limits, and selective uploads.

---------

Co-authored-by: toaster0123 <261194501+toaster0123@users.noreply.github.com>
Co-authored-by: Jaime Bot <jaime@rblb.it>
Co-authored-by: Riccardo Balbo <riccardo0blb@gmail.com>
* Add JMH benchmark harness

* Add light sorting and filter rejection benchmarks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants