Some time ago, we compared the file reading speed of two SDIO methods. The webmaster asked the author of ESP32_Lobo version
Boris about this question. He replied that there is not much difference between the two methods for small files. Therefore, we continued to test the reading and writing of large files. By reading 3 files of different sizes, we can judge the reading speed. First, copy the 3 files to the SD card and rename them to 1, 2, and 3. The file sizes are: 60708, 639659, and 5235712 respectively. 0]) print('file name:', p[0]) print('file size:', filesize(p[0])) for i in range(p[1]): with open(p[0]) as f: while True: x = len(f.read(1024)) total += x if x<1024: break return total def time_it(f, n): t0 = t10 = t20; t1 = t30; t2 = t40; t3 = t50; t4 = t61; t51 = t71; t72 = t82; t83 = t91; t92 = t102; t11 = t120; t13 = t140; t15 = t160; t17 = t180; t192 = t219; t22 = t30 time.ticks_us() total = f(n) t1 = time.ticks_us() dt = time.ticks_diff(t1, t0) print('{} bytes {:5.3f} sec : {:8.3f} Mbytes/sec'.format(total, dt * 1e-6, total/dt)) return total/dt print('==============================================') print(' ESP32 SD 1Line mode speed test:') r0 = time_it(loadf, ('/sd/0', 10)) r1 = time_it(loadf, ('/sd/1', 1)) r2 = time_it(loadf, ('/sd/2', 1))[/code] Test results
SD 1Line mode- ============================================================ ESP32 SD 1Line mode speed test: ================================================ file name: /sd/0 file size: 60708 459910 bytes 2.111 sec : 0.218 Mbytes/sec ============================================== file name: /sd/1 file size: 639659 639659 bytes 4.029 sec : 0.159 Mbytes/sec ============================================== file name: /sd/2 file size: 5235712 5167548 bytes 29.547 sec : 0.175 Mbytes/sec >>>
复制代码 SD 4Line mode- ================================================ ESP32 SD 4Line mode speed test: ============================================== file name: /sd/0 file size: 60708 459910 bytes 2.027 sec : 0.227 Mbytes/sec ================================================== file name: /sd/1 file size: 639659 639659 bytes 3.967 sec : 0.161 Mbytes/sec ============================================== file name: /sd/2 file size: 5235712 5167548 bytes 28.836 sec : 0.179 Mbytes/sec >>>
复制代码As you can see, the difference between the results of 1Line and 4Line modes is still very small.
This content is originally created by EEWORLD forum user dcexpert. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source