Improvement: Create less threads when there isn't enough data to transfer (#2838)

* Improvement: Create only necessary threads when there isn't enough data to transfer

* Update sdk/storage/azure-storage-common/inc/azure/storage/common/internal/concurrent_transfer.hpp

* CL
This commit is contained in:
JinmingHu 2021-09-07 14:42:17 +08:00 committed by GitHub
parent 47d04c3ff9
commit 6611b8f03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,8 @@
### Other Changes
- Create less threads if there isn't too much data to transfer.
## 12.1.0 (2021-08-10)
### Features Added

View File

@ -54,7 +54,7 @@ namespace Azure { namespace Storage { namespace _internal {
};
std::vector<std::future<void>> threadHandles;
for (int i = 0; i < concurrency - 1; ++i)
for (int i = 0; i < std::min<int64_t>(concurrency, numChunks) - 1; ++i)
{
threadHandles.emplace_back(std::async(std::launch::async, threadFunc));
}

View File

@ -12,6 +12,8 @@
### Other Changes
- Create less threads if there isn't too much data to transfer.
## 12.1.0 (2021-08-10)
### Features Added

View File

@ -12,6 +12,8 @@
### Other Changes
- Create less threads if there isn't too much data to transfer.
## 12.1.0 (2021-08-10)
### Bugs Fixed