Fix game stutter on Win 10 1703-1809

Discussion in 'Videocards - NVIDIA GeForce Drivers Section' started by Mott, Apr 3, 2018.

  1. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    Research and development is fun, BUT have you guys (who affected by this issue) tried to configure Prefetch and Superfetch?
    In registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" values EnablePrefetcher and EnableSuperfetch can be:
    • 0 - disable
    • 1 - enable for apps, disable for boot
    • 2 - disable for apps, enable for boot
    • 3 - enable for apps, enable for boot
    Plus you can clean Superfetch "database" - all files in %SystemRoot%\Prefetch folder. (But I suspect it needs the stopping of Superfetch service.)

    Plus, execute in elevated PowerShell (https://docs.microsoft.com/en-us/powershell/module/mmagent/disable-mmagent?view=win10-ps)
    Disable-MMAgent -ApplicationLaunchPrefetching -ApplicationPreLaunch

    Imo, Superfetch looks like main suspect in this issue with growing standby lists.
     
  2. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super

    But have you tried to disable prefetching ?
     
  3. JonasBeckman

    JonasBeckman Ancient Guru

    Messages:
    17,485
    Likes Received:
    2,874
    GPU:
    MSI 6800 "Vanilla"
    Superfetch whether set to 1 or 2 or 3 doesn't seem to change the cache behavior and there's a lot of varying info on if 1 or 2 is app or boot mode for either prefetcher or the superfetcher.
    I tried each though but it didn't affect how it caches stuff, tries to use as much RAM as possible even now after 2 days with no actual gaming activity (Browser then I guess is most of what the cache consists of.) though it does leave a bit free so it's not entirely overtaken by the cache which seems to be when performance drops as it keeps unloading and loading new cache data instead of keeping a buffer of entirely empty space in RAM.

    EDIT: Disabling superfetch should work though so a value of 0 and maybe checking so the SysMain service is not currently running or even a combination of 0 and setting SysMain to disabled? (If it's not a protected service.)

    But that also impacts performance a bit on HDD's and possibly even SSD's although from my own testing it's minimal.
    (Then again that's gaming and they always load a lot of data back and forth whereas an application might be more lightweight. Still say folder or program exclusions for what you wouldn't want in the cache or being fetched wouldn't hurt if it's in excess of available RAM.)


    EDIT: Hmm wonder if the OS is a bit different in newer builds of Windows 10 in general in regards to prefetching data or using the superfetch function.

    1 or 2 both seem to create prefetch (.pf) files for software even if one of these should only be for boot mode and as the OS is starting up and keeping these loaded and initialized early.

    And superfetch seems to be the same plus the addition of using cached memory to jam in a lot of other data. :p
    Not a bad idea I suppose if the OS or well the system is fast enough HDD and RAM wise for the operation but some program several Gigabytes large is going to take a while to load into memory and it's only going to be partial due to size constraints.

    And with multiple games it'll have to dump the data anyway so it can load the new stuff though I doubt it's intended for gaming really compared to storing applications and software that have a smaller footprint in memory.
    (Well mostly, some apps can also be pretty memory hungry ha ha.)
     
    Last edited: Oct 3, 2018
  4. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    @Dynarush_333 It is not clear whether you solved the issue with OP tool(s) or it was fixed by MS...
     

  5. gl0w

    gl0w New Member

    Messages:
    1
    Likes Received:
    1
    GPU:
    GTX 1070
    @Dinarush_333

    Could you clarify how you fixed it?

    Hi everyone, I have been following this topic for a while, as I'm the ones affected by the standbylist issue, mainly on BF1.

    First I have used the schedule bat file, which does not work as I would like (sometime is doesnt initiate on startup) and i always had to check manually if the task is active, etc etc.

    So, for now i'm using the app tool by wagnard, which is very good as it keeps the standby memory / free memory in a good size not causing any stuttering in BFV.

    So thank you all for temporary helping me fixed my issue! :)
     
    Smough likes this.
  6. AveYo

    AveYo Member

    Messages:
    43
    Likes Received:
    48
    GPU:
    8800GS 384MB
    Something is wrong, maybe a copy-paste issue?
    Use the download button on pastebin link to directly download the script as .bat,
    or the download ZIP button from gist https://git.io/FreeStandbyMemory.bat
    Run the script to create the schedule, don't add it yourself by hand!
    It's possible a lame antivirus might interfere with the setup (for no other reason than creating a system task)
    for example Defender smartscreen will initially block it, so just pick run anyway and it will be fine from then on

    Anyway glad these are now almost obsolete.
    MS will surely back-port any fixes to older versions in future cumulative updates.
    Btw, I've made a MediaCreationTool.bat wrapper for all RedStone versions 1607-1809
    (if you need an older ISO/USB or upgrade to intermediary versions - business channel too)
     
    Last edited: Oct 3, 2018
    Mott likes this.
  7. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    OK, finished the testing, now need some time for the refactoring...
     
  8. SpookySkeleton

    SpookySkeleton Member Guru

    Messages:
    145
    Likes Received:
    19
    GPU:
    RTX 3090
    8 hours of uptime on 1809 baking some fluids on blender, and the overall performance degradation over time is not as bad as 1803, is not fluid as a fresh system restart but i guess is a little fixed now, i can game or do other stuff while i wait to the bake to finish and not in need to restart the system to do other stuff after the bake is finished of course a restart is suggested for a better performance but at least 1809 apparently fixed this a little..
     
    AveYo likes this.
  9. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Updated ISLC to 1.0.0.5
    Nothing much...

    Changes since 1.0.0.4
    - Code cleanup and several optimization on the GUI updating (WPF binding)
    - Others misc stuff not worth to mention.


    SHA1: 411216788D75656DA4C9A841B4B909D296B10A31


    Note: I was asked by some if it add registry key for settings or anything.
    No, ITSC doesn't add anything to the registry or files, it play only with what it has in it's own directory.
    No playing around with task Scheduler either.
    The app is portable.
    Only need .NET 4.6+ (can lower requirement if asked)
     
    Last edited: Oct 3, 2018
    Koniakki, joe187, gl0w and 1 other person like this.
  10. joe187

    joe187 Master Guru

    Messages:
    485
    Likes Received:
    20
    GPU:
    Nvidia GTX1070 FE
    Thanks so much for this tool. I love it!
     
    Wagnard likes this.

  11. Mott

    Mott Master Guru

    Messages:
    911
    Likes Received:
    206
    GPU:
    MSI 6800XT GXT
    I am on 1809 and do not have any stuttering anymore... looks like they fixed it in that patch on 1803.
     
  12. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    It's not completely fixed on my end when playing BF1. I do get occasional stutter if my free memory is 0 and I have a few GB of standby list. It's definitely better than the old version of Windows but when I clear the list the stutter is completely gone.
     
    Dynarush_333 likes this.
  13. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    *Updated to 1.0.0.6*
    Changes since 1.0.0.5
    - Free Memory and Standby list value now more precise (same as task manager)
    - More CPU efficient.
     
    Shakur92 likes this.
  14. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    @Wagnard

    Btw, you can use attribute System.Security.SuppressUnmanagedCodeSecurity for methods which call unmanaged functions (or COM, WMI ones) to speed up a bit. And attribute System.Runtime.ExcpetionServices.HandleProcessCorruptedStateExceptions to intercept exceptions when something went wrong in P\Invoke layer itself (like memory corruption).

    Example:
    Code:
    using System.Security;
    using System.Runtime.ExceptionServices;
    ...
    [SuppressUnmanagedCodeSecurity]
    [HandleProcessCorruptedStateExceptions]
    public void Execute()
    {
       try {
          ...
       }
       catch(Exception ex)
       {
          ...
       }
       ...
    
    https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ett3th5b(v=vs.100)

    Without HandleProcessCorruptedStateExceptions try - catch in your code will not catch such P/Invoke raised exceptions.
     
    Last edited: Oct 5, 2018
    Wagnard likes this.
  15. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Thanks for the tip man, I'll sure try it out
     

  16. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    I wrote a system service some time ago which utilized ETW. (The amount of P/Invoke code was staggering.) And tester noted me that service was stopped due to error several times. Only after I applied HandleProcessCorruptedStateExceptions to methods I managed to intercept exceptions from ETW P/Invoke code preventing the abrupt stopping of whole service.
     
  17. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Ill probably not use it unless necessary as there is some security risk associated with this.
     
  18. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    There is not. Do you use Win API functions which can bring harm being called through your code?
     
  19. Wagnard

    Wagnard Ancient Guru

    Messages:
    2,662
    Likes Received:
    341
    GPU:
    MSI Geforce GTX 1080
    Maybe NtSetInformationProcess
    But I checked only really fast what you told me, maybe I didn't understand it all.
     
    Last edited: Oct 5, 2018
  20. mbk1969

    mbk1969 Ancient Guru

    Messages:
    10,910
    Likes Received:
    8,163
    GPU:
    GF RTX 2070 Super
    This security check is not about monolith standalone application which your tool is. It is about multi-layered multi-component systems like Web-services, WCF-services, hosted by some servers. Say you create assembly with component which calls some unmanaged function from server API. To do that this component should be labelled as full trust. But since component can be visible to many other components (hosted nearby) they can access it and call its public code. To protect from execution of full-trust-code (which calls unmanaged code) by another not-full-trust-code, .Net framework right at run time checks whole call stack for the level of trust, and if somewhere up the call stack there is less trusted code framework will fail the call.
    When you apply SuppressUnmanagedCodeSecurity attribute to your code (which calls unmanaged code),.Net framework instead of full call stack walk and check at run time checks the level of your code only during JIT-compilation from IL-code to native code.

    May be this optimization does not gain much, but considering this call stack walk and check as completely unnecessary because for your application it will never fail the call, even little gain is a win.
     
    Last edited: Oct 5, 2018
    Wagnard likes this.

Share This Page