如果处理一个图像比从磁盘读取 N 个图像花费的时间更长,那么同时处理多个图像是一个胜利。如图所示,您可以在 100 毫秒(包括寻道时间)内从磁盘读取 2 MB 文件。图一秒将8张图片读入内存。
因此,如果您的图像处理每张图像花费的时间超过一秒,那么 I/O 就不是问题。同时进行。如果需要,您可以按比例缩小(即如果处理需要 1/2 秒,那么您最好只使用 4 个并发图像)。
You should be able to test this fairly quickly: write a program that randomly reads images off the disk, and calculate the average time to open, read, and close the file. Also write a program that processes a sample of the images and compute the average processing time. Those numbers should tell you whether or not concurrent processing will be helpful.