Skip to content

Commit 165edd6

Browse files
authored
Merge pull request #3 from EllanServer/codex/optimize-display-culling
2 parents 6f2a6e2 + b3c2453 commit 165edd6

138 files changed

Lines changed: 24760 additions & 1724 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/benchmark.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: A-B Performance Benchmark
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- '.github/workflows/benchmark.yml'
8+
- 'benchmark/**'
9+
- 'build.gradle.kts'
10+
- 'common/src/main/java/com/loohp/interactionvisualizer/entities/DroppedItemDisplay.java'
11+
- 'common/src/main/java/com/loohp/interactionvisualizer/entities/DroppedItemSpatialIndex.java'
12+
- 'common/src/main/java/com/loohp/interactionvisualizer/entities/VisibilityTokenBucket.java'
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
benchmark:
19+
name: Paper 26.1.2 A-B benchmark
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Java 25
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: temurin
31+
java-version: "25"
32+
33+
- name: Set up Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
36+
- name: Build disposable benchmark plugin
37+
run: ./gradlew benchmarkJar --no-daemon --no-build-cache --rerun-tasks
38+
39+
- name: Download stable Paper 26.1.2
40+
env:
41+
PAPER_USER_AGENT: InteractionVisualizer-Benchmark/1.0 (https://github.com/EllanServer/InteractionVisualizer)
42+
run: |
43+
mkdir -p benchmark-server/plugins
44+
BUILDS=$(curl --fail --silent --show-error \
45+
-H "User-Agent: $PAPER_USER_AGENT" \
46+
https://fill.papermc.io/v3/projects/paper/versions/26.1.2/builds)
47+
PAPER_URL=$(echo "$BUILDS" | jq -r 'first(.[] | select(.channel == "STABLE") | .downloads."server:default".url) // empty')
48+
test -n "$PAPER_URL"
49+
curl --fail --location --show-error \
50+
-H "User-Agent: $PAPER_USER_AGENT" \
51+
--output benchmark-server/server.jar "$PAPER_URL"
52+
cp build/libs/InteractionVisualizer-*-benchmark.jar benchmark-server/plugins/
53+
54+
- name: Configure isolated benchmark server
55+
working-directory: benchmark-server
56+
run: |
57+
echo 'eula=true' > eula.txt
58+
cat > server.properties <<'EOF'
59+
online-mode=false
60+
level-name=benchmark-world
61+
level-type=minecraft:flat
62+
generate-structures=false
63+
spawn-protection=0
64+
view-distance=3
65+
simulation-distance=3
66+
max-players=1
67+
max-tick-time=-1
68+
sync-chunk-writes=false
69+
EOF
70+
71+
- name: Run alternating A-B measurements
72+
working-directory: benchmark-server
73+
run: |
74+
java -Xms2G -Xmx2G -XX:+UseG1GC -jar server.jar --nogui | tee benchmark-server.log
75+
test -f plugins/InteractionVisualizerBenchmark/benchmark-results.jsonl
76+
test -f plugins/InteractionVisualizerBenchmark/benchmark-complete.txt
77+
EXPECTED_RESULTS=$(cat plugins/InteractionVisualizerBenchmark/benchmark-complete.txt)
78+
ACTUAL_RESULTS=$(wc -l < plugins/InteractionVisualizerBenchmark/benchmark-results.jsonl)
79+
test "$ACTUAL_RESULTS" -eq "$EXPECTED_RESULTS"
80+
81+
- name: Publish benchmark results
82+
if: always()
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: interactionvisualizer-ab-${{ github.sha }}
86+
path: |
87+
benchmark-server/plugins/InteractionVisualizerBenchmark/benchmark-results.jsonl
88+
benchmark-server/plugins/InteractionVisualizerBenchmark/benchmark-complete.txt
89+
benchmark-server/benchmark-server.log
90+
if-no-files-found: warn
91+
retention-days: 30

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,59 @@ jobs:
2929
- name: Set up Gradle
3030
uses: gradle/actions/setup-gradle@v4
3131

32+
- name: Validate performance tooling
33+
shell: pwsh
34+
run: |
35+
$ErrorActionPreference = 'Stop'
36+
$scripts = @(
37+
'tools/perf/phase2-pktmon.ps1',
38+
'tools/perf/analyze-presentmon.ps1',
39+
'tools/perf/analyze-minecraft-debug-profile.ps1',
40+
'tools/perf/analyze-jfr-socket-writes.ps1',
41+
'tools/perf/analyze-phase2-abba.ps1',
42+
'tools/perf/analyze-phase2-pcap.ps1'
43+
)
44+
foreach ($script in $scripts) {
45+
[void][scriptblock]::Create((Get-Content -Raw -LiteralPath $script))
46+
}
47+
$pktmonSelfTestJson = & ./tools/perf/phase2-pktmon.ps1 selftest | Out-String
48+
$pktmonSelfTest = $pktmonSelfTestJson | ConvertFrom-Json
49+
if (-not $pktmonSelfTest.passed) {
50+
throw 'PktMon wrapper self-test did not report passed=true.'
51+
}
52+
$selfTestJson = & ./tools/perf/analyze-presentmon.ps1 -SelfTest | Out-String
53+
$selfTest = $selfTestJson | ConvertFrom-Json
54+
if (-not $selfTest.passed) {
55+
throw 'PresentMon analyzer self-test did not report passed=true.'
56+
}
57+
$debugProfileSelfTestJson = & ./tools/perf/analyze-minecraft-debug-profile.ps1 -SelfTest | Out-String
58+
$debugProfileSelfTest = $debugProfileSelfTestJson | ConvertFrom-Json
59+
if (-not $debugProfileSelfTest.passed) {
60+
throw 'Minecraft debug-profile analyzer self-test did not report passed=true.'
61+
}
62+
$jfrSelfTestJson = & ./tools/perf/analyze-jfr-socket-writes.ps1 -SelfTest | Out-String
63+
$jfrSelfTest = $jfrSelfTestJson | ConvertFrom-Json
64+
if (-not $jfrSelfTest.passed) {
65+
throw 'JFR socket-write analyzer self-test did not report passed=true.'
66+
}
67+
$abbaSelfTestJson = & ./tools/perf/analyze-phase2-abba.ps1 -SelfTest | Out-String
68+
$abbaSelfTest = $abbaSelfTestJson | ConvertFrom-Json
69+
if (-not $abbaSelfTest.passed) {
70+
throw 'Phase 2 ABBA analyzer self-test did not report passed=true.'
71+
}
72+
$pcapSelfTestJson = & ./tools/perf/analyze-phase2-pcap.ps1 -SelfTest | Out-String
73+
$pcapSelfTest = $pcapSelfTestJson | ConvertFrom-Json
74+
if (-not $pcapSelfTest.passed) {
75+
throw 'Phase 2 pcap analyzer self-test did not report passed=true.'
76+
}
77+
78+
- name: Validate runtime harness syntax
79+
shell: bash
80+
run: |
81+
bash -n tools/perf/prepare-phase2-protocol-client.sh
82+
bash -n tools/perf/run-phase2-runtime-once.sh
83+
node --check tools/perf/phase2-protocol-client.js
84+
3285
- name: Run checks and build production jar
3386
run: ./gradlew clean check shadowJar --no-daemon --no-build-cache --rerun-tasks
3487

0 commit comments

Comments
 (0)