Futurepack Mod - Now with flyable Spaceships!

Futurepack Mod - Now with flyable Spaceships!

1M Downloads

1.12.2 some laggy machines

Zygus42 opened this issue ยท 38 comments

commented

I used an excellent new analysis tool mod called LagGoggles on our existing 1.12.2 server and some of the worst performing blocks/items were a couple of blocks from futurepack. Notably the Industrial Neon Furnace and the Normal Pipes connected between 2 Optibenches.

Further testing established that a base Industrial Neon Furnace is bad, but not totally bad until you enhance it's motherboard to go faster, and that the lag is present even if the Industrial Neon Furnace is not doing anything - my guess is that you have it checking for something even when not operational.

The Optibenches are connected together with a vanilla hopper and some Normal Pipes, and the high speed they're processing at seems to be the deciding factor on how much lag the Normal Pipes are producing - they're essentially going too fast. My guess here is that you expected them to be used with a Pusher removing the items, which would limit the speed severely as the Pusher can only be pulsed so fast due to vanilla redstone limitations.

On a side note, we were using Futurepack-1.12.1-26.2.17 until quite recently, and we were getting duplication errors on the Optibenches, possibly because we were using them too fast, so that you could get more output than you had input, essentially allowing item creation and if you had a closed system with 2 Optibenches and some material that had a block - diamonds for example - you could start with a couple of stacks of diamonds and end up with infinite amounts eventually. I'm uncertain whether this has been fixed in later versions or not, as testing is difficult on new world as you need to do the research in order to be able to use the Optibenches.

commented

the optibench "bug" is a feature, you should look at all the optibench aspects and should get what is causing more output.

Ehm to the lag, well if they are overclocked then its pretty normal if they need more time per tick, also have you the time results. Also why is such a mod needed if there is already /tps ?

commented

Ok - didn't know about the Optibench - seems a very easy way to produce rare materials.

To put it in perspective, the pipe attached to the Optibench was the equivalent of keeping a pen of 150 chickens, and the Industrial Neon Furnace was the equivalent of 100 chickens, so just with those 2 items, that particular area of my base was like a chicken pen with 250 chickens in it. Now, if I actually had a pen with 250 chickens I would know what was causing the lag, but in this instance I knew there was lag, but not what was causing it.

I'm not saying it's a gamebreaker or that we'll stop using the mod because of it, but I just thought you might like to look at it and perhaps have a think if there's anything you could do to change the behaviour of the items in question to be more server friendly - especially in the case of the Industrial Neon Furnace that was causing the lag while it wasn't even running.

You should try the LagGoggles mod - is SO Much more useful than /tps, because you can SEE the lag visually and easily and can pin it down to individual items. I'm using it to vet all mods now before I add them to our modpacks, and our players are going to be able to use them as they build bases and will remove items or change setups that are especially laggy. As we had to stop playing our last server because the lag was so extreme that we were getting corrupt world chunks due to Minecraft not being able to save enough data quickly enough, this is something we're kind of happy about.

commented

Well in the last version I tried LagGoggles, it only displayed client perfomance and not server perfomance and it was laggy because of that mod (fps from over 100 goes down to about 15 because of the mod). Also what chips are installed in the machines and how are they connected to each other?

commented

Ok, I was able to improve the neon industrial furnace when not operating. For the optibench and th pipe I was not able to produce any lag.

commented

we will add (once it has proper textures) a "syncronizer" so you can automate recipes were you need different items, eg neon industrial furnace, right now it tends to consume 1 item fully and then pipes push the wrong item in there so the recipe is no longer working, In out test cases this was very usefull.

commented

Cool - it's quite possible that the issue with the Optibench/Pipe system was the input from the Hopper.

As Hoppers are causing stupid amounts of lag in all kinds of situations, we plan to find a mod that adds proper extractors so that we can stop using Hoppers. If you want to see some impressive lag, hook a Hopper up to a full box and then put items in the Hopper - was producing as much lag as 13,000 entities with AI.

A large amount of the problems we had in that build was that many of the machines we were using had to have items extracted from them but also had to have some items left in them, so you need an extractor with a filter which looks at the items it's drawing in before it draws them in.

A large amount of the problems we had in that build was that many of the machines we were using had to have items extracted from them but also had to have some items left in them, so you need an extractor with a filter which looks at the items it's drawing in before it draws them in or you have to set up a filter which inputs back into the container you're drawing from, which tends to be quite bulky and awkward. And of course Futurepack only provides the Pusher which (a) needs to be redstone toggled, (b) only goes in a straight line and (c) does not filter. I did use your Filter in some places, but it (a) doesn't filter until an item has already gone into it and (b) doesn't draw from containers.

Love your mod though ! We've all used it quite substantially and had many hours of amusement. It has the correct balance between difficulty, time consumption, cost and utility.

commented

DOes lag googles support the vanilla default profiler ? If not try the command /debug start, wait a while and then /debug stop, this will help me

commented

in your minecraft folder (or in the server folder) should be a debug folder with a profiler_date.txt

commented

Crud, I already reverted to the curse release, I will set it back up.

commented

thanks :)

commented

It's nice to see people work with LagGoggles.

When developing LagGoggles, i too noticed this behavior, but for vanilla chests (of course, those cause a ton less lag, but in early development were also being profiled, but there wasnt a min threshold yet).

I noticed that one chest is always more nano seconds than the other (not micro! Nano is 1000x less than micro!)

This is probably due to caching. (Google: JVM caching)
In short: if it just used your methods inside the ticked block, it'll be faster the second time. The more often a method is used, the faster it becomes.

I'm going on a limb here, but I suspect the update methods inside the furnaces are very big (this includes forge's internal code!)

commented

yeah the JVM optimises itself while running (forge had issues with it with dimmensions), so this is possible. Also loading the classes to CPU takes time

commented

ok, I ran a laggoggles profile first to verify baseline-
2018-02-16_13 32 25

Then when that was complete I ran a /debug.

https://gist.github.com/ProsperCraft/3d13038d47a7c2f32a6c63e2ffc53afc
profile-results-2018-02-16_13.35.04.txt

commented

interesting, the efurnace if missing a profiler section ("machine tick") so lag googles is doing some creepy ASM here.

commented

Do the efrunaces even have neon energy ?

commented

LagGoggles ASM can be found here:
https://github.com/TerminatorNL/LagGoggles/tree/master/src/main/java/cf/terminator/laggoggles/mixin

LagGoggles doesn't remove and code added by forge, and even works across different builds! This is due to the usage of @Inject, rather than @overwrite.

I'm sure that if you're familiar with Mixin, you'll know that LagGoggles isn't removing or replacing any code with its own.
(Tiny exception on EventBus: only when profiling the method redirected)

So no, LagGoggles isn't responsible.
I personally don't use /debug, as the information provided isn't specific enough.

commented

it is as specific as the mod supports the vanilla profiler (I do but I know alot dont, sadly)

commented

Also I cant read any of your AMS because I only know "real" ASM, so manipulating the hex dumps of the bytecode itself, thus I have no experience with Mixing and how it works or what it does.
Edit: I think my tone sound more rude then it is, if I have somehow insulted you, sorry this was not my intension.

commented

That's okay,

I used 'real' asm at first in LagGoggles too. It's the LEGACY class in my source. What I noticed was that SpongeForge @Overwrites nearly all methods I was using. (Bad bad programming! BAD!). Meaning I wasnt able to use bytecode manipulation the 'real' way, because SpongeForge simply deleted all edits I did. I decided to migrate to Mixin. This is the same libary SpongeForge uses, but I followed coding conventions defined by the Mixin author (Mumfrey).

Long story short: Mixin does bytecode manipulation AND checking if it's compatible with the other transformers. If it's not compatible, the bytecode isn't applied.

Mixin itself is a great libary, and I think everyone should move to this, as it would get rid of all the different 'scattered bytecode manilulation code' written by many different mod authors. I highly suggest you take a look at it, it's worth your time.

Anyways:
Im simply inserting a couple of lines, and this is the general idea:

long start = System.nanoTime();
UPDATE_METHOD();
laggoggles_record(System.nanotime() - start);

It's safe to say, LagGoggles is not a source of bad ASM.
If you think someone is overwriting a forge method, check the SpongeForge source first, and if they don't edit your method... Look at other mods in the pack.

commented

Yeah I know sponge tends to crash because of our dimensions or completly brakes the world gen (randomly chunks everywhere wich random biomes looks like soemone just moved chunks randomly accros the world) . And yes if I ever have to use ASM again I will defintly look as Mixin, but I think my stuff would be not possible (dynamicly joining classes and interfaces of my own mod for better crossmod tileentiy combatibility, not this mod it was an experiment ^^)

commented

None of the furnaces in the picture have anything in them at all.

The goal being to get all machines to 0 tick because they are not doing anything.

commented

I think this "base lag" is because of our temperature system.

commented

I am no programmer, but perhaps it could only check if someone opens the gui, or it has work to do?

commented

The machine are overheating overtime, so this amount of time needs the very bare bound of the complety upgrade system, I will see what I can do to imrpove this (the current state is not acceptable)

commented

ok, so this is interesting.

Three Neon furnaces and three industrial neon furances all with absolutely nothing in them, not touching anything but the dirt below.

3 different profiles.

2018-02-16_11 10 04
2018-02-16_11 10 52
2018-02-16_11 11 40

For some reason the white varient is a problem and not the other two colors.

commented

if they also have the chips in them then the problem is clear: lag goggles dont works as they should.

commented

Chips? I pulled them out of creative and placed them, there is nothing in them.

commented

Ran the placement in reverse...its not the color, its the order of placement.

Placed the black then grey then white and the black one is ticking higher now.

2018-02-16_11 59 40

commented

Could this be related to these block breakers that are idle ticking high?

One is high the other 4 are lower.

2018-02-16_12 01 21

commented

2018-02-16_12 08 30
Holds true, even after placing 24 more furnaces.

commented

Here is a performance comparison of Thermal expansion furnaces vs Neon furnaces.

The idle thermal expansion furnaces are not ticking at all, except for the first one placed which is slightly ticking.

2018-02-16_12 10 49

commented

2018-02-16_12 14 35

I didn't expect this result, industrial foregoing who has really high ticking blocks, in general, is faring better than the neon furnace.

All at idle.

commented

ok, I went a little overboard, but this is fun...here is another result with many furnaces from many mods.
2018-02-16_12 28 34

And to verify, I broke all neon furnaces, then replaced them.

2018-02-16_12 30 04

2018-02-16_12 32 51

commented

what ever lag googles is showing it is not realy relyable, (I mean why is the first ticking longer? this makes no sense at all)

commented

After tinkering the whole night I thing it is better now: 26.3.108

commented

You nailed it!! Push the update.

2018-02-17_08 14 55

commented

๐ŸŽ‰

commented

You'd be suprised with what you can do with Mixin. I am actually Joining an existing Forge class with an interface to get the mod container of the ASMEventHandler class without reflection.

You can peek around in my code, should be self explainatory.

There's also a really extensive wiki https://github.com/SpongePowered/Mixin/wiki you can check out :p