Virtual file for fast I/O?

Jul 23, 2009
3
0
Is there any way to create a virutal file in tcc? Disk-based file processing (creation, manipulation, searches, deletion) takes a lot of time. If my scripts could create & manipulate temporary files in memory, I expect processing time would improve.
 
May 20, 2008
9,199
60
Syracuse, NY, USA
The short answer is "no". You can create (huge) arrays with TCC and manipulate text in them, but not with the typical text-manipulation commands, and external apps wouldn't be able to access them.

A "ram drive" would be a perfect (and perfectly seamless) solution. There are many available, a few free. Given Windows' dexterity at file cacheing, you might be surprised at how little there is to gain.
 
Aug 3, 2016
368
9
Netherlands
Is there any way to create a virutal file in tcc?
Windows has a special way to create files just in memory (well, sort of) by specifying attribute FILE_ATTRIBUTE_TEMPORARY as part of the CreateFile function in Kernel32.dll.
This will essentialy create a zero byte disk-file, with it's contents in RAM (when you run out of RAM, contents will be written to disk).

With @WINAPI you can call this function.
But this isn't very practical, as you would have to recreate your scripts: you can only access the contents of the file through the %@file.... functions (but that may also be caused by me passing the wrong attributes to the function)

As @vefatica already mentioned: just take a test-drive (no pun intended :-) with a RAM disk (for example Dataram's RAMDisk; free for RAM disks up to 1 GB).
And please let us know if you find differences in performance (I'm very curious about that, but don't have file I/O intensive scripts to test this)