I am debugging a program that depends on large file ~1GB. I am currently stuck in low performance PC without SSD. Each time I run the program after some edit. This 1GB has be loaded in memory which takes some time.
considering I need this 1GB file from the beginning and there is no way to load just what I need from it.
Is it possible in some way (does not have to be standard and portable) to load it just once in some place in the memory that is not destructed after exiting the program and then use it from the same place in memory each time (kind of pointer to memory chunk on the OS level) ?
I am using MSVC 2017 & Windows 10.
答案 0 :(得分:1)
Yes, try setting up a RAMDisk and storing this file in the RAMDisk. It will persist until you shut down your machine or delete it.
This will effectively allow your system to read from/write to this 1GB file as if it was stored on RAM - which is what you want. But it will only require a single load and a single unload.
A normal 7200RPM hard drive - what you're probably seeing by loading from HDD -> RAM upon each execution
A very usual SSD. As you can see, speeds are increased approximately fourfold in this benchmark.
Using a RAMDisk, in this case set up using the AMD Radeon RAMDisk software
In other words, this isn't a programming solution really - it's just a workaround for your machine not having an SSD to store this large file on for read/write purposes. Your code can probably stay the same, it will just read in the file from a RAMDISK that you'll have to set up.
Hope this helps!