Skip to content

Speed up furnace external test by fast-forwarding CookTime - #3990

Merged
rom1504 merged 2 commits into
masterfrom
speed-up-furnace-test
Sep 5, 2026
Merged

Speed up furnace external test by fast-forwarding CookTime#3990
rom1504 merged 2 commits into
masterfrom
speed-up-furnace-test

Conversation

@u9g

@u9g u9g commented Aug 23, 2026

Copy link
Copy Markdown
Member

The furnace external test spent ~10s per version waiting out a real 200-tick smelt (getStackCookTime is a hardcoded 200 with no gamerule or recipe hook, all the way back to 1.8.8), making it the second-slowest test in the suite (~12.4s).

This keeps the test end-to-end but skips the idle ticks: after the existing assertions that a real smelt is in progress (0 < progress < 1), it merges CookTime:195s into the furnace's block entity and waits on the furnace window's update event until the output slot populates, replacing the wait(progressSeconds * 1000 + 500) sleep. Both /blockdata and /data merge block merge into existing NBT, so the loaded input/fuel are untouched, and the output is still produced by the vanilla tick()craftRecipe() path — input decremented, fuel consumed — so every assertion is unchanged.

Version details, verified empirically against real servers on all 28 tested versions:

The remaining 5 ticks complete in 250–320ms on every tested version, so the await uses a tight 500ms timeout as a guard: if a future version renames the field or command again, the merge is silently ignored and the test fails fast instead of sitting out the real 10s smelt.

Timing across the matrix: ~12s → ~3s per version (the cook await itself is 249–319ms on all 28 versions), roughly 4.5 minutes saved per full-matrix run.

@u9g
u9g force-pushed the speed-up-furnace-test branch from a37fca4 to f6f0bd9 Compare August 23, 2026 22:52
@rom1504

rom1504 commented Aug 27, 2026

Copy link
Copy Markdown
Member

CI fails

@u9g
u9g force-pushed the speed-up-furnace-test branch from f6f0bd9 to 4b90ad1 Compare August 27, 2026 01:15
@u9g
u9g changed the base branch from master to ci/minecraft-wrap-json-fix August 27, 2026 01:17
@u9g
u9g force-pushed the speed-up-furnace-test branch 3 times, most recently from 2bff326 to 167b6ab Compare August 27, 2026 02:08
Comment thread test/externalTests/furnace.js Outdated
@u9g
u9g changed the base branch from ci/minecraft-wrap-json-fix to master August 27, 2026 04:32
@u9g
u9g force-pushed the speed-up-furnace-test branch 2 times, most recently from bdbb173 to 5726c84 Compare August 29, 2026 14:11
@u9g

u9g commented Aug 29, 2026

Copy link
Copy Markdown
Member Author

Switched to bot.supportFeature — the version boundaries now live in minecraft-data as hasDataCommand (1.13+) and furnaceNbtUsesSnakeCase (1.21.4+): PrismarineJS/minecraft-data#1260. CI here will fail until that lands and the minecraft-data dep is bumped (unknown features resolve to false, which falls through to /blockdata on 1.13+).

u9g added a commit to u9g/minecraft-data that referenced this pull request Aug 30, 2026
/blockdata was replaced by /data merge block in 1.13, and the furnace
block entity's CookTime key was renamed cooking_time_spent in 1.21.4
(1.21.3 still accepts CookTime). Needed by PrismarineJS/mineflayer#3990
to fast-forward a furnace without hardcoding version comparisons.
rom1504 pushed a commit to PrismarineJS/minecraft-data that referenced this pull request Aug 31, 2026
/blockdata was replaced by /data merge block in 1.13, and the furnace
block entity's CookTime key was renamed cooking_time_spent in 1.21.4
(1.21.3 still accepts CookTime). Needed by PrismarineJS/mineflayer#3990
to fast-forward a furnace without hardcoding version comparisons.
@u9g
u9g force-pushed the speed-up-furnace-test branch 2 times, most recently from 2d26020 to cf15cea Compare September 4, 2026 18:18
u9g added 2 commits September 4, 2026 17:11
The furnace test spent ~10s per version waiting out a real 200-tick
smelt. Instead, after asserting the smelt has genuinely started
(0 < progress < 1), merge CookTime:195s into the furnace block entity
and wait for the output slot to populate — the output is still produced
by the vanilla tick path, so all assertions are unchanged. Cuts the
test from ~12s to ~3s per version, ~4.5 minutes across the matrix.

The await runs 250-320ms on every tested version, so it uses a tight
500ms timeout: if the merge silently does nothing (wrong field name or
command for a future version), the test fails fast instead of sitting
out the real smelt.

Verified against real servers on all 28 tested versions (1.21.4+
placement verified on top of PR #3960, which master needs for those
versions regardless of this change).
Replaces the hardcoded version comparisons with hasDataCommand and
furnaceNbtUsesSnakeCase (PrismarineJS/minecraft-data#1260).
@u9g
u9g force-pushed the speed-up-furnace-test branch from cf15cea to 200fac9 Compare September 4, 2026 21:11
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Tests more than 1.5x slower than master (durations are noisy, so this is informational):

   8820ms ->   14764ms  mineflayer_external 1.16.5v nether

@rom1504
rom1504 merged commit 561491c into master Sep 5, 2026
11 checks passed
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.

2 participants