mekanism / Mekanism

A mod for Minecraft
MIT License
1.35k stars 512 forks source link

FPS drop #1762

Closed XentoniX closed 9 years ago

XentoniX commented 9 years ago

I dont want to be a whiner but in my Mekanism room i drop to like 13-16 fps while i normaly have 50-60 fps. Purely when i look @ Mekanism i already see a FPS drop. The server has no TPS drop so its purely Graphical related. I dont know if it can be optimized or something.

If i have to guess its due to the Gasses pressurized pipes that are the cause. since that part lags the most. And u have allot if u have the 5x Ore processing system.

I wish the FPS drop would be less severe cause i love the mod its just a bit of a nausance to walk arround with such low FPS.

Mekanism 7.1.0.90

bochen415 commented 9 years ago

You can try to copy your Mekanism room to a creative flat world (redstone profile) to exclude any outside sources of lag.

marduv commented 9 years ago

I am experiencing the same problem with FPS drop on 5x ore processing, after connecting up the pressure pipes. If I remove all multiparts by using "/removeall multipart" my FPS get back to normal. I did not find a way to remove just the pressure pipes, so I am open for proposals. After rebuilding all the pipe networks I get the same issue.

Note: I'm using glass and solid covers to separate pipes so I can place them side by side.

If there is something I can check in Opis or VisualVM let me know.

Forge Multipart 1.1.0.300 Mekanism 7.1.0.92

luchokoldo commented 9 years ago

I Have fps drop too but with ultimate energy conduit

luchokoldo commented 9 years ago

But only happen when i connected to energy acceptor ( AE2 ) for ME Controller

marduv commented 9 years ago

Iuchokoldo, try to disable "FancyUniversalCableRender" in the Mekanism.cfg (Client side) What version of the AE2 and Mekanism are you using?

unpairedbracket commented 9 years ago

@luchokoldo Issues with AE2 are known, have been fixed as far as we know. Which versions of both mods are you using?

luchokoldo commented 9 years ago

Last versión for AE and MK.. also I Have FancyUniversalCableRender in false

luchokoldo commented 9 years ago

Before update mekanims ( 0.75) all work fine..

luchokoldo commented 9 years ago

Tested in server

XentoniX commented 9 years ago

I have tried single player with no difference. Either with seperatie with covers or just using more pipes is no difference. Tried with of without optifine (with is a bit better). Also tried with fancy cables off and machine animations off. But what ever i try the me kanis room eats fes. If I just turn 180 degree I jump back up to 60+

jthile commented 9 years ago

This is also happening to me, exactly as described -- severe FPS drop, but only on the client, no apparent server lag -- any time I lay down anything more than very basic Universal Cable layouts.

Ikabodo commented 9 years ago

I tried disabling cable animations and machine animations and it did help somewhat, but not all the way. Still having some drops. I noticed it happens a lot more if the machines have a lot of speed upgrades, as if the cables are updated to fast or something.

I'll see if I can notice something on the rendering on OPIS.

aidancbrady commented 9 years ago

Any more activity on this? I still have a hard time believing this is due to Mekanism, TPS is one thing, but we really don't do much that would affect FPS.

XentoniX commented 9 years ago

Dont know what i can say. Still have the fps drop and the moment i remove the mekanism part its back to normal. Currently waiting for mystcraft so i can rebuild it in a void age so i can use it but wont suffer fps drop

marduv commented 9 years ago

I still have massive FPS drop, if I do remove all my multipart like pressure pipes the FPS get back to normal, this is NOT a TPS issue. I'm used to track down TPS issue but not FPS so if you have some suggestion on what you want me to try let me know. This happen to all of my players on the server, running on various OS configured systems.

Mekanism v: 7.1.1.97

unpairedbracket commented 9 years ago

I think Opis can now profile rendering handlers, you might want to try that.

XentoniX commented 9 years ago

True Opis can do that, but since it shows every tube seperate its hard to see what its collaborated. I did notice that the Extra Util pipes use like 1 uS and Pressured/Energy abot 5-20 uS each. I was also wondering if its maybe cause of the graphics of filling the tubes with the nice colour of the gas, cause i keep it maxed but maybe it swaps between 99% and 100% texture? Although i also had fps issues when everything stood still (aka tubes empty).. hmmm

Ikabodo commented 9 years ago

Yeah, I'm getting the feeling it's about the tubes too. I'm having such low fps in my base now I can hardly play.

The problem is I'm having a separate timeout issue (at least I think it's seperate), so I'm having trouble meassuring the fps since I get kicked out all the time.

Kazzamkablam commented 9 years ago

I did some testing and found out that when I removed my mekanism energy cube and replaced it with power storage from other mod my fps skyrocketed. There is something fishy going on with them.

unpairedbracket commented 9 years ago

It's the energy cubes then? Can anyone else confirm this? @Kazzamkablam, if you put them back I'm assuming it gets worse again? Are you able to test it out with Opis' render handler integration?

XentoniX commented 9 years ago

I tried replacing the cube or removing it all together but hardly made a difference in my case.

unpairedbracket commented 9 years ago

It seems that actually the transmitters are among our most efficient renders, by far. I took a look at some of our other renderers and a lot of them are taking like 200-600µs to render on my development laptop - transmitters are taking 0-1µs when empty, and only going up to around 6µs when rendering their innards as well. I might work on moving the static parts of the renders to ISBRHs, which would, I think, do a lot to alleviate this.

Kazzamkablam commented 9 years ago

When I place them again my fps goes down the drain, sorry i have no idea about any of the Opis stuff.

Ikabodo commented 9 years ago

I've run a few tests with opis, and as far as I can tell, it doesn't really tell me what the fps comes from.

Would it help running visualVM and handing you a log? Perhaps it's something else causing the fps? Like sound or something.

Ikabodo commented 9 years ago

Regarding OPIS, I actually get nothing when clicking Run render on the handlers tab. I wonder why...

unpairedbracket commented 9 years ago

I think that might only apply to static block renderers that run when block updates happen, not sure exactly how it works.

If you've got any TileEntities showing up with high render times in the Client TileEnt tab in opis (I think anything nearing 500µs would be serious cause for concern), that would be a sign that something is wrong. If you're able to find anything with VisualVM that would definitely be useful as well, would help to diagnose anything not caught by opis.

Ikabodo commented 9 years ago

I'm not so sure it's actually a rendering-issue. The highest timing for tileents in opis is around 60-70 (from mekanism) and a few things from ae2 around similar timing. Malisis door had a door spiking, I removed it, and it was not what caused the fps.

Here is a log from visualvm (sampler). http://filer.ikabodo.se/sampler_client_fps.nps

Ikabodo commented 9 years ago

It's more of a stutter than anything really. Want me to record it?

unpairedbracket commented 9 years ago

The TESR times there are all about 1000x more than opis would suggest, all almost exactly 100ms (including the AE2 one that shows up in the profile), but the total time taken by rendering TileEntities is only 112ms on average so I would posit that that isn't the issue. World rendering is taking almost 200ms on average, which seems like a lot, considering it should just cache it until there's a block update...

unpairedbracket commented 9 years ago

Ah, on further investigation it seems that the world renderer update function is being called way more often than it should be. Not sure why but it might be our fault. The VisualVM profile has been very helpful, could you possibly profile based on the class mekanism.common.util.MekanismUtils? If we're causing too many chunk render updates, that's where it'll be.

Ikabodo commented 9 years ago

Sure I'll help! I'm kind of a newbie when it comes to the profiling. But I'll figure it out. Glad I could help!

I pointed AlgorithmX2 from AE2 here too, I've been having a seemingly unrelated issue with his network causing time-outs. It's a long shot, but it could be related. It it isn't, no harm done in pointing it out!

Ikabodo commented 9 years ago

Hmm, I'm not sure how to profile only the class you mentioned. found a setting on the profiler-tab that had "profile only classes" and entered class mekanism.common.util.MekanismUtils.*

I got it running, but I'm not sure that's the file you wanted. http://filer.ikabodo.se/profiler_client_fps_mekanismonly.nps

I tried doing the same setting on the sampler tab, but got nothing.

I'm sorry I am doing something wrong.

Ikabodo commented 9 years ago

I've been getting some wierd rendering errors. Is this related? http://filer.ikabodo.se/2014-09-11_17.14.02.png

unpairedbracket commented 9 years ago

Hmm, no. Not even sure if what I'm looking for is possible, really - I'm not that much of an expert with VisualVM myself. The rendering error isn't something I've ever seen before, I don't think it can be our fault. Looks like someone might not be popping a GL matrix they've pulled or something...

Ikabodo commented 9 years ago

[20:34:25] [Client thread/ERROR]: @ Post render [20:34:25] [Client thread/ERROR]: 1283: Stack overflow [20:34:25] [Client thread/ERROR]: ########## GL ERROR ##########

Ikabodo commented 9 years ago

I just found this in the client-log. Never seen it before. Related?

unpairedbracket commented 9 years ago

Almost certainly. Still not sure what the problem is though...

Ikabodo commented 9 years ago

I'm getting the FEELING it has something to do with the pressurized cables, the lag lessened a lot when I removed them. Still experimenting

Ikabodo commented 9 years ago

Is there anything else that can be done to help find information?

unpairedbracket commented 9 years ago

The actual static render handler for transmitters might be taking a while to render - this shouldn't be a problem as it shouldn't need to do it very often. I something is causing constant render updates it might cause issues though.

Ikabodo commented 9 years ago

I'm not sure this is the same issue, but this is what the excellent AlgorithmX2 managed to figure out from my profiling from the server. Could these chunkloads causing rendering issues on the client? Or should I post another issue?

AlgorithmX2 wrote: It looks like the issue is a huge chain of chunk loading, AE2 is basically gone now; better then I was hoping for honestly.

So essentially whats happening, is the controller is changing its power state, this causes a neighbor update, this causes a mekanism cable to load and from the looks of of it; it then spirals outward loading your entire base or a least a pretty huge chunk of it; more then likely this then probably causes AE2 to get powered, then the chunks unload; then it loses power... then the cycle restarts.

Thats at least what i'm kinda guessing is happening, why the controller is staying loaded, is uncertain.

Two things could probably help; 1. Mekanism should probably not load chunks as it builds its network; this will cut it off before it spirals out of control. 2. You could chunkload your base so it stops unloading constantly.

You're correct that your CPU is spiking, More than likely the CPU spikes you're seeing are related to the loading/unloading going on.

juress commented 9 years ago

My FPS drop happens whenever there is energy drawn from the Energy cube. Doesen't matter what machine is using the energy (or what mod that machine is from).

Vid: https://www.youtube.com/watch?v=ohIFhoAlOHI

edit:

ok, tried to swap the cube for an energy cell, that did the trick...

Vid#2: https://www.youtube.com/watch?v=ObBTlqeSFHQ

unpairedbracket commented 9 years ago

@Ikabodo if you chunkload any areas with cables/tubes/whatever in, does it fix the lag? I've worked out that the "Is this block redstone-powered" method loads adjacent chunks when said block is on an edge - I'll see if I can fix it but being able to diagnose what's causing the chunks to load constantly would be nice.

@juress Does this still happen in a clean, superflat test world? Minimal situation, i.e. cube -> cables -> single machine would be a good idea. Is it happening in those videos on a server or in SSP?

XentoniX commented 9 years ago

I have my full base chunk loaded and it doest matter. I had a small system b4 with just the basic 2x ore procssing and basic power and didn't notice any fps drop then. It was after I made the big system with gas pipes and brine facilities that the fps drop started to occur. And since the most gas production is centered @ one place I can test by just turning around that I lose about 30 fps just from the major gas production. When I go outside and look @ the complete mekanism part of my base it's about 40 fps.

juress commented 9 years ago

Ok, did some testing: Clean map SMP&SSP - just cube, couple of cables and one machine - no drop.

The vids are from an SMP server. (you could join in and have a look if you want)

also: right clicking gas-burning generator after placing it down crashes the game. http://pastebin.com/fkrccHmu

Ikabodo commented 9 years ago

@unpairedbracket Yes! I kind of temporarily fixed the issue by putting creative chunkloaders all over the base. I'll help you any way you can with diagnosing, what can I do?

Edit: I just realised I might be misinterpreted here. The FPS-issue remains even with chunk-loaders.

Edit2: Some more news. It was definitely cable-related for me. I switched all cables (more or less) to ender-io version. Lag got a lot better.

birdspider commented 9 years ago

I'd like to confirm this particular issue, we (2 players - custom modpack) have fps drops on 2 machines:

around ~30->~12 and worse ~20->~5; any particular help we can offer (visualvm, opis, logs, modlists)?

I will try to reproduce it on a flatmap with mekanism and AE2 only soon-ish.

EDIT: I do have 2 visual vm profiles, if someone is interested; but apart from mekanism beeing somewhere at the top I don't see an obvious single problem

mekanism_cpu_prof mekanism_cpu_prof2_cable mekanism_cpu_prof2_cable_count

Universal Cable snapshot1_view2

EDIT 2: energy cubes and pipes in pull mode seem to be the main causes of fps drop in my setup

EDIT 3: I did a test setup with 3x3x3 dynamic tank and opis reports hundrets of orphaned tile entities - whatever that means, also hundrets of orphaned tile entities regarding salination block in my actual world

Telanor commented 9 years ago

I'm having this issue as well on 1.7.10. It seems largely related to chunk updates. If the machines are sitting there doing nothing, I'm at 120 fps with mostly 0 chunk updates. The instant I give the machines some work to do, my FPS drops to around 10 and the chunk updates sky rockets to 100.

The cables and gas tubes seem to be the ones causing the chunk updates. If I replace the cables with EnderIO ones and remove the gas tubes, I can run the machines and still get 120 FPS. The energy cube seems to have no impact on it at all, its entirely the cables/tubes.

AdamosX commented 9 years ago

I think that in nearly all of these cases the true problem were gastanks.

Telanor commented 9 years ago

Connecting a gas tank directly to a machine doesn't cause problems as far as I remember. The cables and tubes are what I determined to cause the absurd amount of chunk updates for me. The biofuel generators also seemed to cause some problems but I didn't test them too much.