This weekend I was diving deep into current programming. In order to learn that, I decided to write a parallel file compressor, which will not only compress files concurrently but also limit the memory usage. I have implemented this in GoLang, but these concepts can be implemented in any language.
Was going through the code, good idea and nice implementation.
One thing maybe we can improve is that currently, within the compress function, we check if the context has been cancelled till that point or not, which is at the start of the compress function, and only then we start processing the file and compressing it.
If the user cancelled while the file is being processed midway, we will have to wait until that for loop is complete, even though we want it to be over sooner.
Was going through the code, good idea and nice implementation.
One thing maybe we can improve is that currently, within the compress function, we check if the context has been cancelled till that point or not, which is at the start of the compress function, and only then we start processing the file and compressing it.
If the user cancelled while the file is being processed midway, we will have to wait until that for loop is complete, even though we want it to be over sooner.