History

Chunk computation seems alright, what about realistic values

Sebastian Thiel committed 6 years ago

Commit 973e6bb1 parent a1b5d562 files · +5 −7Browse files

Showing the changes to git-features/src (1 of 2 files). Show all

Unified · Split

git-features/src/parallel.rs+4−6
@@ -134,16 +134,14 @@ pub fn optimize_chunk_size_and_thread_limit( · 133 unmodified lines
134134 let desired_chunks_per_thread_at_least = 2;
135135 let (chunk_size, thread_limit) = num_chunks
136136 .map(|num_chunks| {
137− let thread_limit = if num_chunks <= available_threads * desired_chunks_per_thread_at_least {
137+ let items = num_chunks * desired_chunk_size;
138+ let chunk_size = (items / (available_threads * desired_chunks_per_thread_at_least)).max(1);
139+ let num_chunks = items / chunk_size;
140+ let thread_limit = if num_chunks <= available_threads {
138141 (num_chunks / desired_chunks_per_thread_at_least).max(1)
139142 } else {
140143 available_threads
141144 };
142− let chunk_size = if num_chunks / thread_limit > desired_chunks_per_thread_at_least {
143− (desired_chunk_size * (num_chunks / thread_limit / desired_chunks_per_thread_at_least)).max(1)
144− } else {
145− desired_chunk_size
146− };
147145 (chunk_size, thread_limit)
148146 })
149147 .unwrap_or((desired_chunk_size, available_threads));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t