Skip to content

use binary searching algorithm if max font value set#12

Open
RMaksymczuk wants to merge 1 commit intomichikono:masterfrom
RMaksymczuk:use_binary_algorithm_for_searching_font_size
Open

use binary searching algorithm if max font value set#12
RMaksymczuk wants to merge 1 commit intomichikono:masterfrom
RMaksymczuk:use_binary_algorithm_for_searching_font_size

Conversation

@RMaksymczuk
Copy link

Hey,

We have this project in which we're using infinity scrolling with your boxfit plugin. I noticed that for a large number of components which are using this solution, it is noticeably for a user that text is blinking. I also noticed that for searching proper font size, for each element, I need to make ~25 loop steps. So the idea was to use some searching algorithm to reduce number of steps and comparisons. For that I used the binary searching algorithm, whereby the number of steps decreased to ~3. The only requirement is to have both, minimum and maximum font size set.

In pull request I depend my algorithm to settings.maximum_font_size, so it will run only for user who have set that value and for another situations, the old algorithm will be used. If you like my solution, I think we can go on. Maybe there is a possibility to set some default number for maximum_font_size, so it can always use binary algorithm.

Would be nice to know your opinion,

Greetings,
Rafal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant