project - icon

LazyDFU

Universal mod

Makes the game boot faster by deferring non-essential initialization

optimization

111.4K downloads 941 followers
Created 2 years ago
Updated a month ago

External resources


Featured versions


Project members

profile-picture

Owner


Technical information

License
Client side
optional
Server side
optional
Project ID
hvFnDODi

LazyDFU is an optimization mod for Minecraft that defers unnecessary initialization work so that it is only performed if required. Specifically, it makes the initialization of DataFixerUpper "lazy" - that is, it will not immediately create the rules required to migrate data from older versions of Minecraft to newer versions until it actually needs to do so.

Sponsor me!

Did this mod make Minecraft playable for you? Chip in a bit of money so I can continue developing it.

Why hasn't LazyDFU been updated?

Unsurprisingly, LazyDFU is fundamentally a very simple mod. The code in question works all the way back to Minecraft 1.14 entirely unmodified, even though the mod is built against Minecraft 1.16.5 and Java 8, thanks to the use of intermediary mappings in Fabric.

Don't believe me? Try it! The mod worked out of the box on Minecraft 1.17 and its snapshots, and on Minecraft 1.18 and its snapshots without even so much as a recompile, and it is extremely likely (even with the fundamental changes Mojang is doing to the game) that LazyDFU will continue to work unmodified on future versions of the game.

Why does it work?

DataFixerUpper (often abbreviated to DFU) is the Minecraft component responsible for handling world upgrades from older versions of Minecraft to newer versions. DFU is initialized very early in the Minecraft startup process - in fact, it's initialized before the game window even appears. It is laughably overengineered and very slow, but it's what Mojang gives us to work with.

As part of the DFU initialization process, it caches rules required to convert from older versions to MInecraft through every version in between, up to the version of the game being launched. This process takes place in the background, but it is extremely slow, as it is both CPU and memory intensive. With Minecraft 1.16.5, I have measured this process take 9 seconds on a Ryzen 9 3900X desktop (a high-end desktop CPU released in 2019) and 57 seconds on a laptop with an i5-8250U (a mid-range laptop chip from 2017).

All LazyDFU does is stop this process - it lets DFU initialize, but it will force it to not cache all these rules. As a result, the DFU rules are only compiled when a world needs to be converted. This means it is possible you may see lag spikes if LazyDFU forces the game to compile migration rules, but once complete there is no performance penalty.

Prove it to me

I recorded a video that shows you how effective LazyDFU is.

Comparing it to other mods

In comparison to other mods, LazyDFU has the primary advantage of being simple, safe, and having low impact on the game.

  • LazyDFU is a very simple mod. The entire mod is about a dozen lines of code, about as uncomplicated as a mod can get, while still delivering huge benefits. (This means it's also an ideal mod to use to experiment with a new Mixin platform!)
  • LazyDFU is very safe. This mod is based on a similar patch in Paper that has been in use for over a year with no reported issues with migrating to newer versions of Minecraft.

It's also objectively better than other options out there:

  • LazyDFU and Cadmium are complementary to each other, however the improvements Cadmium makes are outweighed by LazyDFU avoiding DFU rule compilation as much as possible.
  • LazyDFU is superior to Smooth Boot by removing the primary source of game CPU usage in the first few seconds to minutes of Minecraft boot times.
  • LazyDFU is far safer than using a mod that removes DataFixerUpper entirely, which can lead to world corruption.