[Question] speed of imwrite
18 views (last 30 days)
Show older comments
I am using imwrite to write the .bmp file, and wondering some information about its speed.
I was writing 1024 x 768 bmp, which is 768 KB, and matlab finished the writing on my computer with about 8 ms, which is equal to 93 MB/s. I have tested the writing speed of my hard disk, which is about 100 MB/s. So, it is fair.
And then, I used the Ram disk (there are softwares supportting to use the ram as an extra temporal hard disk while the computer is on.). The writing speed of it is about 3 GB/s. (I use some hard disk testing software to measure.) However, when I use matlab to write the file in that Ram disk, the necessary time is still about 8 ms. It seems to me that matlab is limited to something else, not just the hard-disk physical limitation.
In this case, I am wondering how could I write it with a higher speed on the ram disk? since its physical limitation is much higher. Could anyone answer me?
Many thanks
0 Comments
Answers (3)
Walter Roberson
on 23 Jan 2013
If speed during main program execution is the critical factor, then consider writing out the images as binary files using fwrite(), and then at a later time when main program execution is finished, do a pass that fread() and imwrite() them.
4 Comments
Jhen-Si Chen
on 24 Jan 2013
2 Comments
Image Analyst
on 24 Jan 2013
Edited: Image Analyst
on 24 Jan 2013
This is not an answer and should have been added to your comment above.
So why don't you write directly to your ramdisk then? Why use the hard disk during image acquisition? Originally you said you tried this, now you're saying you are using imwrite to go to "some buffer maybe in the hard disk" - well, what is the file name in that call to imwrite that you're giving it? Is it a filename on the ramdisk?
Jan
on 24 Jan 2013
When you write 768kB to a hard disk, the data is stored in the RAM also at first, e.g. in the write cache of the harddisk. It is not trivial to measure the time, which is required until the data are written physically to the disk.
3 Comments
Jan
on 24 Jan 2013
@Jhen-Si Chen: No, this means that writing small files, e.g you <1MB file, to a hard disk is at first buffered in DRAM, such that the processor can proceed its work until the slow hard drive has written the data to the disk physically.
Therefore I think that the similarity of 93 MB/s for IMWRITE and 100 MB/s for the hard disk speed is a pure accident. The timing with the RAM disk seems to be a further argument for this claim.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!