Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Improve matching algorithm #34

Closed
hrsh7th opened this issue Nov 25, 2020 · 5 comments · Fixed by #39
Closed

Improve matching algorithm #34

hrsh7th opened this issue Nov 25, 2020 · 5 comments · Fixed by #39
Labels
enhancement New feature or request

Comments

@hrsh7th
Copy link
Owner

hrsh7th commented Nov 25, 2020

We need tests for lua...

@hrsh7th hrsh7th added enhancement New feature or request high-priority labels Nov 25, 2020
@kkharji
Copy link
Contributor

kkharji commented Nov 25, 2020

Its a bit hard and you will need custom shell and lua scripts, if you want I can walk through running your first test busted framework

@hrsh7th
Copy link
Owner Author

hrsh7th commented Nov 28, 2020

I'm implementing it...

benchmark

v1: elapsed time: 2.401
v2: elapsed time: 0.342

local M1 = require'compe.completion.matcher'
local M2 = require'compe.completion.matcher2'

local attempts = 100000

x = os.clock()
for j = 1, attempts do
    tmp = M1.score('nvimgetbufline', 'nvimgetbufline', 'nvim_g_et_b_uf_line')
end
elapsed = os.clock() - x
print(string.format("V1: elapsed time: %.3f", elapsed))

x = os.clock()
for j = 1, attempts do
    tmp = M2.score('nvimgetbufline', 'nvim_g_et_b_uf_line')
end
elapsed = os.clock() - x
print(string.format("V2: elapsed time: %.3f", elapsed))

@kkharji
Copy link
Contributor

kkharji commented Nov 28, 2020

Oh wow 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 😍 Nice well done @hrsh7th

@hrsh7th
Copy link
Owner Author

hrsh7th commented Nov 29, 2020

I will add the feature of remaining char match.

Currently, nvim-compe does not match fnamemodify with fmodify.
This feature makes matching it.

@hrsh7th
Copy link
Owner Author

hrsh7th commented Nov 29, 2020

I will add the feature of remaining char match.

Currently, nvim-compe does not match fnamemodify with modify.
This feature makes matching it.

Sorry. It bit hard to implement. So I will merge performance improvements before implementing them.

This was referenced Nov 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants