ourzora / offchain

NFT Metadata made easy
MIT License
109 stars 27 forks source link

Added test coverage for batched_parmap #105

Open atapin opened 2 months ago

atapin commented 2 months ago

Description

Added test coverage for batched_parmap function and improved its readability by simplifying the implementation. Also improved the performance by utilizing list.extend method instead of + concatenation. Extension modifies a list in place, instead of creating a new list by +

Motivation and Context

Currently batched_parmap has unnecessary cyclomatic complexity, because it has to check for trailing chunks of batches in case when size of args is not divisible by batch_size. Even though the check is implemented, this case is not covered by tests. Also, memory consumption of this function can be reduced by replacing list concatenation with list extension.

Fixes #104

How has this been tested?

I provided a unit test and ran all other tests.

Types of changes

Checklist: