Has anyone timed how long it takes to write 2 bytes using the SD library?

Just trying to determine if this will be fast enough for what i want to do.
Up til now, I've been just writing to memory and serial-transferring to a laptop. Obviously that means I can only log a small amount of data, then it has to stop while transferring the data to the laptop. I end up with small, discrete chunks of data.

In order to get a large, continuous chunk of data, I've been considereing storage onto an SD card, but in all of my searches, I can't find any info on how long it would take to log 2 bytes of data. (Or even one byte.)

I assume SPI is faster than transferring at 9600 baud to the laptop.

Has anybody measured it?

Doing a binary write of two byte can take as little as 40 microseconds or as long as 200 milliseconds.

It takes 40 microseconds if the data only needs to be moved to the buffer for the SD.

It can take 200 milliseconds if data is written to the SD and the SD needs to do a large flash erase or remap a bad spot.

Did some timings, not two bytes, but this thread may be of interest:

If you open a file like in the above thread

 logFile = SD.open("log.txt", FILE_WRITE);

writes will be incredibly slow.

You need to replace FILE_WRITE with other open flags. FILE_WRITE causes 2048 bytes of I/O to the SD for each byte written by a print().

Search the forum for a description of other flags that you can or together. These include O_WRITE, O_CREAT, O_TRUNC, and others.

Could someone please specify the alternative which is faster?
Of course it depends if you need to create the file first...

You can log 16-bit samples to an SD as fast as 40,000 samples per second. This requires very special techniques, writing binary data to a contiguous file in raw mode.

You can log about 2,000 samples per second to an SD as text but this requires special buffering.

I have posted two demo sketches here Google Code Archive - Long-term storage for Google Code Project Hosting. in the file fastLoggerBeta20110802.zip.

Several topics in this form discuss use of these sketches.

..what is the total amount of data?? Kilobytes? Megabytes?
If ~kBytes you may consider an external fram (spi, 8pin, 256kBytes). You can write ~800KBytes/second, as a bonus it is nonvolatile.
P.

FRAM is great for data logging.

Where do you find 256 KB (2 Mbit) SPI FRAM in an 8-pin package and what is the part number?

Mouser has 256 kbit parts in stock but this is only 32 KB. http://mouser.com/ProductDetail/Ramtron/FM25W256-G/?qs=sGAEpiMZZMtsPi73Z94q0IidxlBy6KhxDctIlbo1eg0%3D

When I log 16-bit data at 40,000 sps to a SD it uses 80 KB/sec. I allocate 100 MB for a data-set which is 20 minutes.

FM25H20
http://www.ramtron.com/products/nonvolatile-memory/serial.aspx
I am using it so I can confirm it works as advertised. P.

Thanks for all of the replies. So it looks like there are a lot of options with a wide range of speeds.

My plan was to wire the card myself just using the resistor dividers as described. As far as what library to use, I guess I'll just experiment with a few and see what I get.

At least it seems one way or another, it should be able to do most of what I want.

Is there an inexpensive shield or other hardware that will make it significantly faster than just wiring the SD card directly to the Arduino? Or is the resistor divider method about the same, as say, the Ethernet Shield? (Using one of the common SD libraries.)