Skip to content

refactor position to reduce allocations #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Conni2461 opened this issue Feb 18, 2022 · 0 comments · Fixed by #62
Closed

refactor position to reduce allocations #60

Conni2461 opened this issue Feb 18, 2022 · 0 comments · Fixed by #62
Assignees

Comments

@Conni2461
Copy link
Member

new signature. Rather than having

fzf_result_t fzf_fuzzy_match_v1(bool case_sensitive, bool normalize,
                                const char *text, const char *pattern,
                                bool with_pos, fzf_slab_t *slab);

lets do

fzf_result_t fzf_fuzzy_match_v1(bool case_sensitive, bool normalize,
                                const char *text, const char *pattern,
                                fzf_position_t *pos, fzf_slab_t *slab);

and if pos is NULL we dont add any. Otherwise we append the positions to the array. This should reduce the amount of malloc and realloc we need to call for more complex queries.

Also it should result in more streamlined code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant