This block of code (responsible for detecting what the maximum size of text that would be smaller than spacing / 1.7) could be optimised by using a binary search instead of a linear search:
|
while |
|
let TextDimensions { width: test_width, offset_y: test_y, .. } = measure_text(text, None, scale, 1.0) && |
|
test_width > spacing / 1.7 |
|
{ |
|
scale -= 1; // could be optimised with binary search instead |
|
text_width = test_width; |
|
offset_y = test_y; |
|
}; |
This block of code (responsible for detecting what the maximum size of text that would be smaller than
spacing / 1.7) could be optimised by using a binary search instead of a linear search:matrix-visualiser/src/main.rs
Lines 382 to 389 in 94ee3b9