My question is about the write times of the RAW and JPEG file formats. A RAW file is larger than a JPEG and needs more time to write to the memory but it does not need to spend time on data compression. A JPEG file is smaller than RAW therefore it takes less time to write to the memory but it requires time to do data compression. From the time the camera shutter button is pressed to the time the picture is completed storing in the memory card, which file format takes less time?
First - do you have a specific problem? The time to dump an image to the memory card varies a lot from camera to camera and the best solution for your problem is probably to try to investigate it yourself.
Also why are you focusing on the time it takes dump the file to the memory card? With the often large buffers of modern cameras you can often continue to take images while the camera processes and saves previously taken ones. The total time required to get the image written to the card is rarely a relevant measure.
To answer your question:
As a general rule the saving of a JPEG is probably a lot faster. Sure RAW files are less processed and can begin to get dumped to the memory card almost instantly but digital cameras that are set to render JPEG with the standard settings usually employ ASIC circuitry for the job. These have vastly better performance than general processors in terms of speed. Fancy picture styles that are not supported by the ASIC processors can therefore take a lot of time to process.
Note that when you increase speed of the memory card and controller (while retaining the same file size) the time to save the image to the memory card decreases to the RAW file's advantage. Imagine for example an infinitely fast transfer speed - an unprocessed file would take no time to get saved while the processed file still has to be processed. This may be a reality if the raw output file size settles in the future and that happens long before the maximum transfer speed possible is reached. I highly doubt that it will though since very few people require the instant dump to memory card feature.
JPEG are almost always faster. The bottleneck is the bus to the memory card, if not the memory card. A faster memory card only shifts the bottleneck from the card to the bus but that will be your limit in terms of speed.
This is because JPEG files are smaller by at least 50% and sometimes much more if you enable on of the lower-quality settings which compressed images even more. The processing of JPEG images takes some time but even RAW files need to be compressed, so it's not like they just bypass the processor.
There are cases when you will see JPEG images take longer and that is when you enable some intense processing options. A number of modern cameras now offer Distortion Correction which is costly and, in my experience, can slow down a camera significantly.
Depending on the camera, some options like Lateral Chromatic Aberration Removal can also be slow but others like Vignetting Compensation are not.
There is not only one factor.
- RAW also have compression (in generally), but lossless, like zip. And depend of entropy (how much different information you have in picture) can produce different files. For example my camera produce from 25MB to 38MB RAW files. High ISO produce more noise and as result bigger files
- JPG files are compressed with loss compression. Here it depend of the level of compression. And again from entropy, because images with high level of entropy can be compressed less. But because of loss compression JPG are usually small, compared to RAW
- One more point about JPG. When camera produce JPG it apply filters, styles and so on on the image which also take some time
P.S. But as general rule you can get: JPG write 1.5 to 2 times faster to the card