Dolphin, the GameCube and Wii emulator - Forums

Full Version: Caching entire ISO to RAM before booting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(11-02-2023, 02:19 AM)mbc07 Wrote: [ -> ]Even the slowest HDD outperforms the data throughput of a GC/Wii disc, so your stutters are likely caused by something else...

Hmm I don't think so. I am fairly certain that it happens whenever the game reads from the ISO file. Otherwise it not have happen significantly more often when e.g. my torrent client is active on the same disk or I am running a defrag on it, but it does. It is quite reproducible.

Since my original post sort of disappeared in the last page, I feel like I should reiterate: I am requesting a "Cache entire ISO/RVZ/WBFS to RAM" feature.
Dolphin already has to slow down disk reads as hard drives are way too fast and some games crash if reads don't take long enough. It's not just bandwidth, as random seeks are far slower in an optical drive thanks to needing a stepper motor to turn a lead screw to move a carriage rather than just swinging an arm. There are other ways to run Dolphin with the disk image in RAM, like ramdisk software or simply the fact that your OS will notice if you keep accessing the same file and cache it in RAM if you've got enough spare, so you don't need to wait for Dolphin to implement anything to simulate the impact of the feature. Try running the game from a ramdisk - if the stutters are still present, then your proposed change wouldn't help, and if they're gone, there's a good chance it would (although make sure your shader cache is consistent between the two tests - if it's shader compilation causing the stutter, which is likely, then whichever test you run later will have less stutter if the cache isn't clear).
Thanks for the replies so far, and I know that all of you want to help me here, but at the same time I really hope that a dev sees this and agrees that it may be good idea to implement this. Otherwise it feels like the message is getting lost in all this back and forth.

Looks like I forgot a 'not' in my reply above, what I was trying to say is that it happens reproducably more often if for example my torrent client is active on the same drive, with transfers no faster than a few MB/s. It even happens without any other software using it, and with Dolphin running as the only app. This is a very clean install of Windows 11 BTW, and I used to see this same problem on another machine, with another HDD. The pauses are anywhere between like 0.2 of a second to a few seconds. It is not due to hard drive spinning down as I have that disabled. Maybe it is due to some kind of head parking. But that's besides the point, the hard drive seems fail to serve up the data within a low enough latency.

I have already mentioned that I am using exclusive uber shaders and am not using any HD texture packs. You touched on an important point which I forgot to say in my last reply - I think the random access latency is the problem here. Of course the disk has more than enough throughput, but I get the feeling that the random read access latency during the game is the culprit.

More importantly, I've never seen this happen when I tested with the RVZ copied to my NVMe. So without having to test this off a RAMdrive (which will never be a practical solution for general usage), I can tell you that it only happens when the ISO/RVZ is read from the disk. The disk is a 8TB 3.5'' model with a read speed of easily over 100 MB/s (tested). It has been recently defragged as well.

Currently I'm playing NFS Underground a lot and this happens regularly in it. But it does happen in other games too. 99% of the time it's a sub-second stutter, but it does ruin the experience. Also definitely worth mentioning that it happens when the game tries to do 'something new'. I'm seeing this way more often just before a recorded sound plays. For example, when selecting the new race on the NFS:U menu right before a character 'talks' the prerecorded line, if that makes sense.

So maybe it's time we zoom out of the specific hardware part and focus more on the feature request itself: An option to enable caching of full game image into memory on load. This will also make use cases such as ISO/RVZ files getting loaded off a NAS via WiFi actually viable.
It's been something people have asked about for years, and whenever anyone bothers to do the ramdisk test, they find there's no difference to the stutters. There are people who play the games off a NAS that don't find it increases stutters. You're not having a novel idea, and when it was a novel idea, it was taken seriously until it was determined not to be productive.
It is not an idea, and I don't care about how novel you find it either way.

It is a feature request that would prevent less than ideal storage setups from hindering the general experience.
(11-03-2023, 06:41 PM)bLUEbYTE Wrote: [ -> ]The pauses are anywhere between like 0.2 of a second to a few seconds.
"A few seconds" is kind of insane for a drive response that's currently spinning. Maybe average response time in task manager could give a hint?

(11-03-2023, 08:31 PM)AnyOldName3 Wrote: [ -> ]It's been something people have asked about for years, and whenever anyone bothers to do the ramdisk test, they find there's no difference to the stutters.

TBF, they are claiming that it was working fine off the NVMe. So that's one person (assuming their methodology is sound and it isn't something else like shader compiles).
Thread was split. The original request was left at the Feature Request thread, you can resume the discussion pertaining the usefulness of the feature here.

@bLUEbYTE, as others already mentioned, disc access time is not the cause of your stutters. Please do the suggested RAM Disk test before insisting this would solve your problem.

Other things to keep in mind, you're running at an insanely high IR, with Exclusive Ubershaders enabled (as mentioned in the tooltip of that option, it should be used only if Hybrid Ubershaders caused issues, which I highly doubt it's your case, since you mentioned having an RTX 4090). If, on top of that, you're also using RVZ with non-default options (e.g. too big block size & LZMA2 compression), you're also putting more load on your CPU on every disc access the game does, which might then cause the stutters you're experiencing.

Anyway, do the RAM Disk test. If your stutters persist (very likely will), then try testing again with Hybrid Ubershaders instead of Exclusive, also try testing with a plain, uncompressed ISO (assuming you're using RVZ). I highly suspect your CPU might be the bottleneck when those stutters happen...
If I remember correctly, the wii disc drive has a read speed of something around 6-8 MB/s and even slow HDDs should manage more than 100 MB/s read speeds. And the difference between seek times should also be at least one order of magnitude difference. Under normal circumstances it just does not make sense to have stuttering in Dolphin reading an iso from hdd, compared to reading a game disc on a wii. There was even quite some work put in to artificially slow down the reads, because reading too fast caused issues. If hdd vs ssd actually causes stuttering, there's either some external cause, or an actual bug in Dolphin. If it was a bug in Dolphin, I hope that bug is addressed instead of using a crutch like caching the full iso.

Is your hdd by any chance one of the stupid ones with shingled magnetic recording (SMR)? If so, this might be your issue. On a hdd with SMR I would suspect that writes take a long time to finish, and block the queued up reads until the slow writes are finished. Your issue would still be a niche, limited to specific kind of hardware and flooding it with work(torrent client) in the background.

If your HDD external? If so, how is it configured in windows? There's a setting for external drives that allow to remove them without safe remove. It should be called "enable write caching on the device" and is found in the device manager properties of the hdd, policies. If that setting is disabled, that should be the cause of your issue.
I had problems in the past with a HDD in my previous laptop... after some time with low disk usage, the device went into a power saving mode.
Getting out of that state required 1-2 seconds in which the activity seemed to lag, followed with some clicking noise.

The lag lasts pretty much the same, no matter if we're talking of a 8GB ISO or a 10KB txt file.

I solved it with this resident program that stopped the HDD from enter that state: https://appnee.com/quiethdd/
(11-05-2023, 06:08 AM)Intruso Wrote: [ -> ]I solved it with this resident program that stopped the HDD from enter that state: https://appnee.com/quiethdd/

Having a background app running all the time for this seems a bit overkill. Just set the APM setting to 128 (lowest power saving mode without standby -- which is what causes the long delay) with an app of your preference, and you're done. The setting gets persisted in the HDD's firmware, so you don't need to ever touch it again...