pkmnfrk / equivalentintegrations

Equivalent Integrations - expanding EMC to the rest of the Minecraft ecosystem
Other
7 stars 4 forks source link

Tome of Knowledge + Transmutation Chamber is no good! #25

Closed MrPopannes closed 5 years ago

MrPopannes commented 5 years ago

As said. after using the tome of knowledge, the game was unplayable with the chamber and its use deeply integrated into my ME system. This should be expected, but a warning might be nice. Maybe in the tooltip to not use this with the tome of knowledge.

Edit: I play PO3. i posted a similar Ticket at their github. Just so you know.

pkmnfrk commented 5 years ago

Well, this is very tricky. I've not played PO3, but the cause is almost certainly that it has a lot of items. But, the question is, who is the bottleneck? Is it Equivalent Integrations, Applied Energistics or ProjectE? To that end, I did a little test.

I hacked EI to register 250,000 dummy items, to simulate a very bloated mod pack. If you're wondering, in a maximized window, that's 480 pages of items in JEI, give or take. image

Sure enough, as soon as I created a very simple setup with a Storage Bus hooked up to a Transmutation Chamber, and added a Tome of Knowledge, things started to lag. With the symptoms reproduced, I started to dig.

The good news is that it's not Applied Energistics. The same thing happens without it; the lag is triggered when your EMC changes.

The less good news is that the bottle neck is inside ProjectE, not inside Equivalent Integrations. Basically, the function that reports the EMC values of items is slightly slow. Not incredibly slow, or even pretty slow, but just slow enough that calling it for the 250,000 items takes a total of about 7 seconds. As an experiment, I changed the code to not call ProjectE and just pretend everything costs 100 EMC, and it took 97ms instead of 6,936ms.

Profiling, with ProjectE:

image

After, without ProjectE:

image

(Note that these are not directly comparable, I had to refresh the inventory about 20 times to get it to show up at all, because of how quick it is)

All that said, it is theoretically possible for me to fix this, I think. It would require me to add caching, which hopefully I could do properly. EI had caching in it before, but I determined that it was not necessary. Perhaps I will revisit this.

pkmnfrk commented 5 years ago

This is fixed for version 0.3.0, I hope. I tested it under artificial circumstances, since large mod packs are a very painful thing to debug with, but it demonstrated the symptoms and the resolution, so I'm confident.