Closed nigelnquande closed 1 year ago
This is a very important topic
From what I understand,
pdfsizeopt.single
doesn't support using multiple threads. Is it possible to use the application from multiple threads (concurrent execution of multiple instances)?
This is already possible. The reason why it works is that for each temporary file, pdfsizeopt adds the process ID to the filename, so concurrent executions don't try to read and write the same file.
I have written a wrapper application (in Java) that, given a root directory, extracts a list of paths to PDFs in that directory and subdirectories. It then creates a
Process
call for each file in the list. Currently, it usespdfsizeopt.single
in a single thread. Given that I have a large number of files (over 2000), I would like to create a new thread for each file (using some sort of thread management to ensure that no more thancpuCoreCount -1
threads are running at any one time) to speed up the process (which can spend over an hour per file on large files, upwards of 200 MB).From what I understand,
pdfsizeopt.single
doesn't support using multiple threads. Is it possible to use the application from multiple threads (concurrent execution of multiple instances)? Would using a unique--tmp-dir
flag for each file be sufficient to prevent clashes?