Hey, I see people that struggle with Item Container shift bugs so I'm here to give you 2 (4) ways of shifting your items without bugs!
This is just some simple code that allows you to shift all of your items LEFT. An example usage would be the bank. Take out the first item, all items now shift left. That's what this does.
ItemContainer is a super simple container that literally only has the shift functions. A much more fully featured Container is coming soonish.
The two shifts:
- Memory Friendly
- This one is much more memory friendly but also much slower (~twice as slow) for Containers over 155 items.
- Fast Shift
- This one is much faster (~twice as fast) for containers over 155 items but also uses a lot more memory (because of the partitionJoin mainly).
In reality, the time difference is not big at all. As long as you aren't doing hundreds of shifts per second on randomly distributed Containers, performance shouldn't be too big of a problem for you if you aren't worried about memory.
Bank size (450-500 items) is ~0.03ms for memory friendly, ~0.0065ms for fast shift
Sorry if the java is sloppy, what I wrote is more than I've written in the last year. Juck Fava.
Repo: [Only registered and activated users can see links. ]
The performance test was written in kotlin, executed on amd64 Ubuntu 18.04, R7 1800X.
Performance Graph - Plot.ly: [Only registered and activated users can see links. ]
Spoiler for New kt Container Peek:
|« Diagonal Combat Fix | [KT] Safe and Easy Container »|
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
|Tags for this Thread|