Skip to content

Farmers Delight

BonsUnleashed edited this page Oct 10, 2026 · 7 revisions

Farmer's Delight

Minecraft 1.20.1 / Forge: this page documents that build and its measurements. For the separate 205-control Minecraft 1.21.1 port, see Minecraft 1.21.1 NeoForge.

Two controls for Farmer's Delight 1.20.1-1.3.4 (mod id farmersdelight): tool-action ingredients scan the item registry once per action and recipe load instead of once each, and the HUD listeners reuse their overlay lookup. Every switch checks the code it would change against the tested build; another build is left untouched with one WARN line (see How the patches are applied).

Key Target Side Since Kind
farmersdelight_overlay_lookup_memo Farmer's Delight 1.3.4 (on Forge 47.4.16) CLIENT 1.0.30 opt
farmersdelight_tool_action_items Farmer's Delight 1.20.1-1.3.4 BOTH 1.0.26 opt

farmersdelight_tool_action_items

Since: 1.0.26 · Target: Farmer's Delight 1.20.1-1.3.4 · Side: BOTH · Kind: opt

Mixins: ToolActionItemsMixin, ToolActionSerializerMixin, RecipeLoadPassMixin

The cutting board's tool ingredients ("strip with an axe", "cut with a knife") each built their item list by creating a stack of every registered item and asking whether it can perform the action. 625 recipes in this pack use them with 7 actions, so every recipe load (world load, server start, /reload, and a client reading the recipes when it joins a server) went through the whole item registry 625 times. Within one recipe load the first ingredient for an action now runs as before and records which items matched; the following ones create new stacks of exactly those items and check them again, so every ingredient gets the same items in the same order, as stacks of its own. What is skipped: the throwaway stacks of the items that do not match, and what three other mods do to such a stack while it is created (a random id, randomly rolled relic stats, a developer-only counter), none of which outlives the stack. It applies only when AllTheLeaks, AzureLib and Relics are installed as well (the combination it was audited and tested in); when one of them is missing the switch stays off and Farmer's Delight runs unchanged.

Measured: in game on this pack, with the switch off and on alternating in one game, rebuilding all recipes took 1.4 s instead of 5.5-6.4 s on the client and 1.2 s instead of 3.6 s on the server, and decoding the server's recipe list took 0.4 s instead of 8.8 s; the tool-action ingredients came out identical every time. Offline: 12 483 instead of 784 375 tool checks for the pack's 625 ingredients.


farmersdelight_overlay_lookup_memo

Since: 1.0.30 · Target: Farmer's Delight 1.3.4 (on Forge 47.4.16) · Side: CLIENT · Kind: opt

Mixins: NourishmentOverlayLookupMixin, ComfortOverlayLookupMixin

Farmer's Delight: the HUD listeners reuse their overlay lookup. Farmer's Delight's nourishment and comfort HUD listeners run for every HUD element Forge draws, every frame, and each looked its own element up again in Forge's overlay table to compare it with the element being drawn. Each listener now remembers its last answer together with the id it asked for and the table the answer came from, and hands it back while both are the very same objects. Forge's table can never change (a rebuilt table is a new object) and the id is a fixed ResourceLocation, so the answer is the one Forge gives; any other id or table, and every lookup before Forge has built its table, goes to Forge as before. -Dbons_and_furious.farmersdelightOverlayLookupMemo.shadow=true asks Forge on every reused answer and logs any difference (for testing).

Measured: offline on Farmer's Delight's own listeners and Forge's own table, 400,000 lookups and 47,500 HUD events with the table rebuilt, shortened and swapped and Farmer's Delight's ids reassigned, identical to the original; 7.0 -> 3.2 ns per listener call, and 124 -> 62 ns with the CPU's L1/L2 caches cleared before every call (median of 9 rounds), 0 bytes either way. About 100 listener calls per frame with 51 HUD elements. With Collections Of Optimizations (tested 4.6, client): its option farmersdelight.cacheOverlayLookup remembers the same overlay lookups. While that option is on, this switch steps aside; otherwise this switch applies and leaves COO's copy out. One log line says which (since 1.0.36).

Bons and Furious

Minecraft 1.20.1 / Forge 1.0.41

Compatibility

Controls by mod

Links

Clone this wiki locally