Sepals

Sepals

Mod

An extremely radical and experimental optimization for Minecraft server performances.

Server Optimization

522 downloads
27 followers
Follow Save
90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!

Sepals is a experimental optimization mod for minecraft server, aims to minimize latency in game-ticking simultaneously keeping the vanilla features unchanged.

Installation

Sepals needs fabric-language-kotlin, fabric-api, and Sepals features always following the newest version of Minecraft, please ensure you are installed any version of fabric, fabric-api, farbic-language-kotlin and the Minecraft that matched to Sepals required version.

Issues

Sepals is not very stable well, a lots of potential bugs is not not yet found.

So please report all not vanilla behaviors to sepals's github issues that was happening, and could attach a spark profiler result, thanks!

Performance

Sepals has been tested on Intel i7-14700K, 4G RAM for java, Minecraft 1.21, there are 800 frogs cramming in a 7x7 space:

Biased long jump task
Environment keepRunning Percent(Avg.)
Vanilla
(LongJumpTask)
43.1 ms 100 %
With Lithium
(LongJumpTask)
7.5 ms 17 %
With Sepals
(SepalsLongJumpTask)
0.2 ms 0.4 %
With Sepals+Lithium
(SepalsLongJumpTask)
0.05 ms 0.1 %
Environment getTarget Percent(Avg.) Percent(in keepRunning)
Vanilla
(LongJumpTask)
43.1 ms 100 % 100 %
With Lithium
(LongJumpTask)
3.6 ms 9 % 48 %
With Sepals
(SepalsLongJumpTask)
N/A ms 0 % 0 %
With Sepals+Lithium
(SepalsLongJumpTask)
N/A ms 0 % 0 %
Quick sort in NearestLivingEntitiesSensor
Environment sort (NearestLivingEntitiesSensor#sense) Percent(Avg.)
Vanilla 3.8 ms 100 %
With Lithium 3.6 ms 94 %
With Sepals 2.2 ms 57 %
With Sepals+Lithium 2.2 ms 57 %
Frog attackable target filter
Environment time Percent(Avg.)
Vanilla (FrogAttackablesSensor#matches) 10 ms 100 %
With Lithium (FrogAttackablesSensor#matches) 5.7 ms 57 %
With Sepals (SepalsFrogBrain#attackable) 0.1 ms 1 %
With Sepals+Lithium (SepalsFrogBrain#attackable) 0.1 ms 1 %
Frog look-at target filter
Environment findFirst Percent
Vanilla
(LookAtMobWithIntervalTask$$Lambda#findFirst)
2.7 ms 100 %
With Lithium
(LookAtMobWithIntervalTask$$Lambda#findFirst)
2.5 ms 92 %
With Sepals
(SepalsLookAtMobWithIntervalTask$$Lambda#findFirstPlayer)
0.1 ms 3 %
With Sepals+Lithium
(SepalsLookAtMobWithIntervalTask$$Lambda#findFirstPlayer)
0.1 ms 3 %

and 800 villagers cramming in a 7x7 space:

Villager miscellaneous optimizations

at noon:

Environment Brain#tick (Total) Percent Brain#startTasks Percent(startTasks) Brain#tickSensors Percent(tickSensors) Brain#updateTasks Percent(updateTasks) Brain#tickMemories Percent(tickMemories)
Vanilla 18 ms 100 % 9.3 ms 100 % 5.2 ms 100 % 3 ms 100 % 0.5 ms 100 %
With lithium 12.4 ms 68 % 4.8 ms 51 % 5.9 ms 113 % 1.2 ms 40 % 0.5 ms 100 %
With Sepals 9.7 ms 53 % 3.6 ms 38 % 3.7 ms 71 % 2 ms 66 % 0.4 ms 80 %
With Sepals and lithium 10 ms 55 % 3.4 ms 36 % 3.7 ms 71 % 2.5 ms 83 % 0.4 ms 80 %

at night:

Environment Brain#tick (Total) Percent Brain#startTasks Percent(startTasks) Brain#tickSensors Percent(tickSensors) Brain#updateTasks Percent(updateTasks) Brain#tickMemories Percent(tickMemories)
Vanilla 16.7 ms 100 % 8.2 ms 100 % 6 ms 100 % 2 ms 100 % 0.5 ms 100 %
With lithium 10.2 ms 61 % 3.2 ms 24 % 6 ms 113 % 0.5 ms 25 % 0.5 ms 100 %
With Sepals 9 ms 53 % 3.3 ms 16 % 4.7 ms 78 % 0.7 ms 35 % 0.3 ms 60 %
With Sepals and lithium 8.7 ms 52 % 2.9 ms 11 % 4.6 ms 76 % 0.7 ms 35 % 0.5 ms 100 %

and 1390 villagers cramming in a 7x7 space:

Entities cramming
Environment tickCramming Percent(Avg.)
Vanilla 53.6 ms 100 %
With Lithium 54.4 ms 101 %
With Sepals 10.2 ms 19 %
With Sepals+Lithium 8.5 ms 15 %

What was it doing

  1. Used Catheter to replaced java stream, The newest version Catheter has more quite stunning performance and scalability than Stream
  2. Cached tasks, activities, running tasks and memories to improves starting and updating task
  3. Use sepals composite task to replaced vanilla composite task
  4. Whenever possible, find opportunities to skips more raycast and useless predicates
  5. Use 'SepalsLivingTargetCache' to replaced vanilla cache, At the cost in sensors tick make less cost in finding interaction target or look at mob task
  6. Rearranged predicates and extra lower cost predicate, The purpose of this is do higher cost predicate later or best don't do that, Skip the remaining high cost predicates in advance
  7. Copied and modified 'SerializingRegionBasedStorage' optimizations from lithium
  8. With more targeted task, don't use the generics to reduce useless operations
  9. Used binary search list to replaced hashset search
  10. Use quick sort (fastutil) to replaced tim sort (java std)
  11. Precalculate and cache any useful data, avoid unnecessary repetitive calculations
  12. Do more cache, space for time

Notes

  1. Sepals just try to minimizing the game-ticking latency, it won't help with network latency!
  2. Sepals are currently not extensive long-term testing, occur bugs it is possible
  3. Only fabric, no forge, no quilt, and no other any modloader supported

Project members

cao-awa

Member

Details

Licensed GPL-3.0-only
Published a month ago
Updated 23 days ago