Padishar

[1.2.x/1.3] MemGraph 1.1.0.3 - with Stutter Reduction

Recommended Posts

12 hours ago, leatherneck6017 said:

@CanOmer I see you have Contract Configurator installed. In my experience, it generates more garbage for collection than it's worth. That was on 1.3 for me, haven't used it on 1.4.2.

Yeah contract configuration had a bit of a garbage bug back in 1.3, but ever since that got pointed out and fixed, I haven’t seen it again. 

If you do see it, then ofc point it out and try to pinpoint the problem. But let’s try and not give mods a bad name based on “well I had a problem with it a few years back” because let’s face it: mods have bugs now and then. 

  • Like 1

Share this post


Link to post
Share on other sites

Guys, I was merely speculating based on my previous experience. I was not trying to bash Contract Configurator, and I did point out that I was referring to 1.3. I don't remember whether I reported any issues a year ago, and my experience could have very well been caused by a bad contract pack. @nightingale I would say that I'd install CC and a few contract packs to test right now, but with the notification spam issue I'm not doing any contracts.

  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, leatherneck6017 said:

Guys, I was merely speculating based on my previous experience. I was not trying to bash Contract Configurator, and I did point out that I was referring to 1.3. I don't remember whether I reported any issues a year ago, and my experience could have very well been caused by a bad contract pack. @nightingale I would say that I'd install CC and a few contract packs to test right now, but with the notification spam issue I'm not doing any contracts.

Heh - there's a workaround built into Contract Configurator - so if you install it (even without contract packs) you'll get rid of the notification spam. :wink:

  • Like 2

Share this post


Link to post
Share on other sites
On 8/4/2018 at 7:41 AM, nightingale said:

I did a pretty huge pass at some performance cleanup some time back, much of it around preventing contract generation from even occurring during flight.  Although there's plenty of things that I'd like to clean up (lots of string concat garbage, the expression parsing stuff is a huge mess), most of the really bad stuff has been fixed.  The statement of Contract Configurator creating lots of garbage is something that gets thrown around every now and then, but very rarely with useful supporting evidence, and never with a pull request to fix anything.

I have very limited time for modding these days (and there's a reason I almost completely disappeared from the KSP community for over a year).  I'm happy to look into performance issues as I have time, and with appropriate priority.  But not based on heresay from previous versions of the mod, or simply based on the fact that garbage collection is running.  The other thing to keep in mind is that Contract Configurator is (to some degree) a scripting engine - someone can come along and write a really bad contract (performance-wise).  I've done what I can to limit the impact of that (ie. limiting it to the space center scene), but there's only so much I can do without significant re-writes.

So yeah, in short - show me where it's having a meaningful performance impact outside of the space center, and tell me what contract packs are installed, what contracts are active - then I have something to go off of.

(@leatherneck6017 - please don't take this as an attack on you personally, my comments on this are meant to be more general and not directed at anyone in particular)

If contract confegurator is not running in flight, then I don’t it be generating much garbage. Anyways, it is primarily in flight that it is really important. 

  • Like 2

Share this post


Link to post
Share on other sites

Clearly I'm very late to this party, but DUDE!  This heap padding feature changes EVERYTHING!  Without it my red bars were spaced a millimeter apart or so and my game was frequently dragging down to 3fps and even lagging out and crashing.  Once I hit Mod-End (alt-end for me) my red bard went to about half an inch apart and it is playable even with my 95ish mods... AWESOME!!!  Just totally AWESOME!!!  I hope Squad hires you to clean up performance in future versions!!

Thanks,

Danny!

 

P.S.  Here's a pic... the right quarter of the screen show the difference that this mod is making for me!

Album https://imgur.com/a/MRvls will appear when post is submitted

Edited by CrashTestDanny

Share this post


Link to post
Share on other sites
17 hours ago, CrashTestDanny said:

I hope Squad hires you to clean up performance in future versions!!

Well..... most performance issues actually stems from mod not being optimized more than Squad not doing their jobs. I have gained a lot of performance by recompiling mods with changes, and removing some of the worst ones I've identified in my installation.

  • Like 1

Share this post


Link to post
Share on other sites

So after a little tweaking with memgraph, I decided to poke around in the settings.cfg file and discovered that if I set "applyPadding = true", then I get the padding during startup, which decreases my load time significantly!  This thing is awesome!

@Warezcrawler I would be very interested to learn about how you have gained performance by changing and recompiling mods, or how you've identified which ones have the biggest performance hit, or even what some of the biggest performance hits were, if you'd be willing to share any of that.

Thanks!

Danny

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, CrashTestDanny said:

I would be very interested to learn about how you have gained performance by changing and recompiling mods, or how you've identified which ones have the biggest performance hit, or even what some of the biggest performance hits were, if you'd be willing to share any of that.

I have no documentation or anything.... So I can't remember which mod I just deleted.... But I've messed around with some mods; KER, X-Science (this one can be found in the treads), scansat, bon voyage. I've basically tried to change how often they update, reduce garbage collection by following advise I got (remove foreach, don't create reference variables often like in update() and so on) - and I've messed around with threading, knowing that KSP is not actually constructed with thread safety. (And I live with bugs introduced by myself in my quest to gain performance)

My way of identifying which mods, have been by looking at the code, and by installing one and looking at the difference in MemGraph (this was mostly for the garbage thing). It is my experience that GC is the most annoying thing in KSP. Only when constructing very large vessels/spacestations does actual framerate get hit. That is also why I love mods like Fuel switches and other mods that let me reuse parts for more operations, so that I can reduce part count. On that last note, introducing threading in KER reduced my CPU utilization with 10 percentage points on the main thread but I got it producing ridiculous amounts of garbage I had to deal with as well.

The last point is why I run an old version of KER, which I compile myself, incl. any other bugs it might have. This is not something I would like to support though.....

On a note of sharing, I find all that licencing in-transparent, so I have not clue if I can....

My advise is to be aware which plugins you get installed, and look out for if they are reducing you performance significantly. There are modder out there that knows something about profile and stuff.... I'm still too big of a amateur for that....

Share this post


Link to post
Share on other sites

Wow, thats the first time i've loaded a mod to increase game performance and actually get performance :)

I've allocated 16384 MB of extra heap space and was able to launch an SSTO without a single GC during the ascent (without this mod a got like 3 GC spikes just on the runway). On the othe hand, as soon as the GC kicks in, the screen freezes up for 1.5 - 2 seconds, but i prefer this more than the endless stuttering.

edit: Well, after playing for ~2 hours the game crashed, telling me there are too many sections for the GC. So, i guess, i have to reduce the heap size a bit^^

Edited by 4x4cheesecake

Share this post


Link to post
Share on other sites

It's not exactly related to Garbage Collector, but it also hurts as memory is consumed: if you are a helpless Mac user, since El Captain you are forced to tolerate this abomination called Memory Compression (zram for the mobile users).

Do you remember Ram Doubler, QRAM and other "ram doublers" on the Windows 3 era? Same thing. Same crap.

Compressing memory before swapping it to disk is a nice idea, since the lesser time you spend on I/O is far worths the extra time spent on compression - but as an alternative for swapping, it hurts gaming. Badly.

Take this in consideration when gaming on Mac and before hunting down what can be a Unicorn on your mod.

Share this post


Link to post
Share on other sites
On 4/12/2018 at 9:20 AM, Warezcrawler said:

Well..... most performance issues actually stems from mod not being optimized more than Squad not doing their jobs. I have gained a lot of performance by recompiling mods with changes, and removing some of the worst ones I've identified in my installation.

No need to worry about licensing problems; just pass the changes on up to the devs and let them incorporate them if they want.

Share this post


Link to post
Share on other sites

For some reason This mod doesn't load for me. When I first installed this, game crashed almost immediately. When I uninstalled, restarted. loaded fine. Reinstalled this mod, and the game didnt crash immediately, but loaded till main menu was going to show, then crashed.
 

This was what was consistent between the log files. First log file was pretty short, as it crashed early-on, so i didnt bother saving it. But I did see this string in there, maybe its related?

Spoiler

[LOG 15:15:56.160] [AddonLoader]: Instantiating addon 'ModuleManager' from assembly 'ModuleManager'
[EXC 15:15:56.163] MissingMethodException: Method not found: 'UnityEngine.Texture2D.LoadImage'.
    UnityEngine.GameObject:AddComponent(Type)
    AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup)
    AddonLoader:StartAddons(Startup)
    <LoadObjects>c__Iterator1:MoveNext()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    <CreateDatabase>c__Iterator0:MoveNext()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    GameDatabase:StartLoad()
    <LoadSystems>c__Iterator0:MoveNext()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    LoadingScreen:Start()

 

this is the log file for when it almost loaded up completely.

I understand this technically isnt for 1.4.3..but I see people have this working in 1.4.1 n such. so just trying to help, even if I dont end up using this mod in the end. I appreciate what this mod can do. 

Edited by Jesusthebird

Share this post


Link to post
Share on other sites

I've adopted this and have a new release here:  

New release now includes the ability to write the data to a log file

Edited by linuxgurugamer
  • Like 2

Share this post


Link to post
Share on other sites

Thanks for the update!

 

Any way to have an option to track / profile individual mods performance? See how each impacts things like mem/garbage/load/scene/graphics?

Share this post


Link to post
Share on other sites

so I'm a bit unclear on how to tune this... when I push alt-end with default settings, it actually makes the stutter problem about 10x worse.  Going through the messages here I'm trying changing all the 0s to 1s in padheap.cfg and changing the total to 4096, but that's just a guess... is this file documented?  If so, where, or failing that, what's an appropriate way to configure this on a 32gb system with a lot of mods installed...?

Share this post


Link to post
Share on other sites

Just change the total to 4096 and save the file.

Since you have 32GB of RAM, you could go higher than this, but I personally found that large amounts of RAM allocation = longer garbage collection stutters. Too little RAM allocation and you get stutters too frequently, but too large and the stutter takes long enough you start wondering if the game crashed and it's almost equally as annoying.

So I prefer sticking with 4096.

Share this post


Link to post
Share on other sites

@ss8913, @Boersgard, look up a couple posts.  @linuxgurugamer has adopted this mod and has a version out for KSP 1.4.5.  If you're running the current KSP, I'd suggest you use that one and post in its topic to get the best assistance.  @Padishar hasn't been on the forums since April.

Share this post


Link to post
Share on other sites

oh ok yeah... pretty sure I'm using his 1.4.5 right now.  will look in that thread, thanks

Edited by ss8913

Share this post


Link to post
Share on other sites

Since there have been no posts from OP for about a year and @linuxgurugamer has adopted this mod (see a few posts up in this thread), we can lock this one for now, to avoid confusion.

@Padishar, if you resume development or would like us to unlock this thread for any reason, please report this post and we will be more than happy to open it again. Thanks for your wonderful work on this mod!

  • Like 1

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.