Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which USB read pattern is more efficient: Multiple reads or one big read?

Which one is more efficient (= fastest) implementation for transferring data through USB and writing it on memory for further processes:

  1. reading a little data from USB and write on memory repeatedly multiple times.
  2. reading one huge data from USB and write it on memory.
like image 444
Mojtaba Ahmadi Avatar asked Jan 01 '23 00:01

Mojtaba Ahmadi


1 Answers

In my Experience it's better to read a lot of data from USB in order to reduce latency from OS. Long time ago I was writing an application which had to write data to a device using USB in raw mode. The device was using a 128 bytes array to store data from the other part (Windows in my case). When I increased tha data size on the the device part, allocating 1 MB of space, I got a great increase of performance

like image 132
Rudy Barbieri Avatar answered Jan 26 '23 00:01

Rudy Barbieri