Android Code Snippet Concept for VERY fast temporary IO

SubName: N/A its simply a concept/idea that would appear very easy to implement, with possibly great benefits for performance. But totally untested, only created it and put a file in it, and it acted just like normal storage.

Description: Historically, I have seen my IO access on storage around 4-20mb/s ignoring any cache

I briefly tested an idea that we can create a ramdisk from the actual very fast RAM, which from memory is normally closer to 900+mb/s On this disk, one could do any normal IO functions such read/write files (ie after creating it the code is basically unchanged), or even move an SQL dB, onto the disk and have pretty darn fast responses

Apart from it being RAM, it also uses a very efficient disk format to boost it further. I checked my Media DB, and that has something like 30000 rows in the main table (64gb SDCard), and it only takes <20mb of storage (when steady state)

Code: Just some shell commands, needs to be wrapped with java to get a temp dir, or maybe use a path off the app cache to avoid root.

So for 100mb one:
B4X:
su;   
mkdir /mnt/ramdisk;
mount -t tmpfs -o size=100m tmpfs /mnt/ramdisk;
And to be polite, but the actual RAM would be released on shutdown, and so too your files.
B4X:
umount /mnt/ramdisk;
rmdir /mnt/ramdisk;
You cold even share large chunks of data between aps with intents on location of the files/ramdisk etc etc

Dependencies: Just a concept for me, didn't have a commercial use right now, so did not look for any dependencies. Tested on oreo and Pie.
 

JohnK

Active Member
Licensed User
Longtime User
A quick update. I actually did a quick check of speeds on my current daily device, and found that:

SDCard
Read Speed: 17.64 MB/s
Write Speed: 4.5MB/s​

RAM
Copy: 3714.55MB/s​

Thats a theoretical factor of up to 825 (210x for read)!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…