Sleepium 1.1.8 for 1.20.1 (Forge)
Curse Maven Snippet
What's new
Dropped items are drawn by the graphics card. Items on the ground, in item frames and in mobs' hands no longer rebuild their 3D model every frame: the model is kept in video memory and only its position is sent. A field of 1 128 dropped items and 1 081 experience orbs: 1 066 -> 2 094 fps (1.21.1), 980 -> 1 621 fps (1.20.1); vanilla 182 / 128. The picture can differ from vanilla in a few pixels (float rounding on the graphics card). It switches itself off next to Iris and ImmediatelyFast (items are then drawn the vanilla way) and can be turned off in the settings (Entity rendering -> ItemGpu).
Experience orbs and other moving entities collide with blocks for less. Sleepium now knows, per chunk section, which blocks can never collide (air, grass, flowers...) and skips them without reading them; experience orbs, which ask about collisions every tick without saying who asks, now use Sleepium's collision memory too; and an entity's move no longer builds lists and objects for every block it passes. Every result is the same as vanilla's, checked against vanilla tens of millions of times. A crowd of 2 000 orbs and 1 500 items being picked up: 194 -> 215 fps (vanilla: 1 fps); on an Intel N100 laptop-class PC 23 -> 25 fps (vanilla: 1 fps). Servers: 7-13 % less time per tick with many orbs, items, mobs or villagers (11-14 % on the N100).
Tip: Sleepium and Clumps work well together. Clumps merges experience orbs (it changes how orbs behave, which Sleepium itself never does). In the orb crowd above: Sleepium + Clumps 996 fps, Clumps alone 128; on the Intel N100 89 fps against 29 with Clumps alone.
Less garbage per frame: shader values, name tags of entities whose name is not shown, and the vertices of every renderer no longer create throwaway objects.
Servers:
config/sleepium.propertiesis created on the first start (it was only written by the in-game settings screen, which servers do not have), with every switch, what it does and its default, all commented out so new defaults keep reaching you. Remove the#in front of a line to change it, then restart (GitHub issue by I3AT5).1.20.1: the settings screen was missing 56 switches (chunk rendering, entity batching, GeckoLib and others): they were on, but could not be switched off. They are all there now.
Entity analysis could fail next to a mod that patches the bytecode library (ASM) ("analysis failed: method.tryCatchBlocks is null" in the log; those entities then simply ticked the vanilla way). Sleepium now handles it (reported by I3AT5).
Block-entity sleep: mods' machines are analysed the whole way. A mod's ticker that calls its block entity through an interface (Industrial Foregoing and Functional Storage machines, PneumaticCraft blocks) was skipped by the analysis, and those machines were allowed to sleep on what Sleepium observed while they ran alone. They kept working the same as in vanilla (checked), but without a proof; now their tick is analysed, and a machine sleeps only when it is proven it may. Found by placing every block of 13 popular mods (1 843 blocks) and reading the verdicts.
Block-entity sleep is checked by value where a mod's block entity bypasses Sleepium's hooks, so a sleeping machine wakes up exactly when its items change, whatever way the mod changes them; a block entity whose items cannot be read that way does not sleep.
Two small costs found in a 200-mod pack's profile: Sleepium's tick timer built the name of every dimension as a string every tick, and its event bus read one flag the slow way on every event (together about 1.5 % of the server thread in that pack).
Help wanted: checking Sleepium against mods. Sleepium lets a block entity sleep only when it can prove from the code that skipping its tick changes nothing, and every release is checked against vanilla scene by scene. Mods are where that proof is hardest: a mod's machine may keep its state in its own objects, use its own inventories and energy, or tick in ways our tests have not seen yet. This release found and closed one such gap (machines whose tick goes through an interface) by placing every block of 13 popular mods and reading what the analysis made of them. Next we want an automatic check that works for any mod: every machine fed and drained through the standard item / energy / fluid connections, put to sleep and woken in every way a player can, and compared with vanilla tick by tick.
If you know a mod whose machines behave differently with Sleepium, know a good way to test this kind of thing, or want to help run such checks on your pack, please open an issue on GitHub or leave a comment - we will be grateful. A link to the mod or the pack is enough: we download mods only from their official pages.
This mod has no additional files

