Conversation
This should probably support compression too. And be overridden if the number of threads is explicitly set with |
|
That's a good point. |
|
Yeah, I think we should combine the functionality with We can default compression to Currently, Point being, we should think carefully about the interactions between |
This seems strange to me, likely an overlook. Another candidate policy could be "last one wins", meaning that Lastly, a last policy could be to refuse to work in presence of a discrepancy. I tend to prefer the first policy ( |
terrelln
left a comment
There was a problem hiding this comment.
Overall this is looking great!
Could you also add some benchmark figures to the PR summary?
programs/fileio.c
Outdated
| POOL_ctx* writerPool; | ||
| ZSTD_pthread_mutex_t writeJobsMutex; | ||
| void* jobs[DECOMPRESSION_MAX_WRITE_JOBS]; | ||
| volatile int availableWriteJobs; |
There was a problem hiding this comment.
availableWriteJobs does not need to be volatile.
But can you add a newline before writeJobsMutex and after availableWriteJobs, and a comment explaining that the mutex protects jobs and availableWriteJobs?
programs/fileio.c
Outdated
|
|
||
| static void FIO_writePoolSetDstFile(write_pool_ctx_t *ctx, FILE* dstFile) { | ||
| assert(ctx!=NULL); | ||
| // We can change the dst file only if we have finished writing |
There was a problem hiding this comment.
nit: These need to be /* */ comments. // comments are C99.
programs/fileio.c
Outdated
| return job; | ||
| } | ||
|
|
||
| static void FIO_writePoolCreateThreadPool(write_pool_ctx_t *ctx, const FIO_prefs_t *prefs) { |
There was a problem hiding this comment.
nit: naming: Can you name the functions FIO_WritePool_createThreadPool()? Or just WritePool_createThreadPool() since they're all static. That makes it clear its the function createThreadPool() for the object/concept/group WritePool.
programs/fileio.c
Outdated
| } | ||
| } | ||
|
|
||
| static write_pool_ctx_t* FIO_writePoolCreate(FIO_prefs_t* const prefs) { |
programs/fileio.c
Outdated
| } } | ||
| } | ||
|
|
||
| static void FIO_writePoolSetDstFile(write_pool_ctx_t *ctx, FILE* dstFile) { |
There was a problem hiding this comment.
WritePool_setDstFile(), etc.
programs/fileio.c
Outdated
| FIO_WritePoolWriteJobExecute(job); | ||
| } | ||
|
|
||
| static void FIO_writePoolQueueWriteJobAndGetNextAvailable(write_job_t **job) { |
There was a problem hiding this comment.
For all the functions you intend to be "public", e.g. not the helper functions only used by the other WritePool functions, could you add documentation? You could also add docs for the helpers, but that is less necessary.
I agree that If we decide that |
If we decide that There is a catch though. Thoughts ? |
|
Could you add a test featuring multi-frames files ? Bonus point for files with multiple heterogeneous frames (also currently supported). |
|
I've actually tested this manually, but it makes sense to add an automated test. Will do it. |
|
Updating here that we've spoken about
|
tests/playTests.sh
Outdated
| testAsyncIO lz4 | ||
| addTwoFrames lz4 | ||
| fi | ||
| cat tmp_uncompressed | shasum > tmp2 |
There was a problem hiding this comment.
We use $MD5SUM to designate the checksum program,
which generally translates into md5sum, but not always (freeBSD uses gmd5sum, macos uses md5 -r, etc.).
There was a problem hiding this comment.
Thank you, pushed a fix.
7d64b55 to
2ce5c4c
Compare
|
I like the new code path. The last issue is about the It may seem a unrelated secondary topic, but we'll nonetheless need a solution to this situation before the merge. |
c3817cc to
bfc188d
Compare
|
|
- Added --[no-]asyncio flag for CLI decompression. - Replaced dstBuffer in decompression with a pool of write jobs. - Added an ability to execute write jobs in a separate thread. - Added an ability to wait (join) on all jobs in a thread pool (queue and running).
bfc188d to
30152d4
Compare
Changes:
--[no-]asyncioflag for CLI decompression.Benchmarked total runtime (real time) of decompression on 3 machines, these are the runtime improvements in %:
Notes: