Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
115 lines
2.6 KiB
Lua
115 lines
2.6 KiB
Lua
|
|
local nf_finder = function(data)
|
|
local results = {}
|
|
|
|
if data == nil then
|
|
if results[#results] == '' then
|
|
table.remove(results, #results)
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
local line, last_start, start, found_newline, result_index
|
|
|
|
last_start = 1
|
|
result_index = #results + 1
|
|
repeat
|
|
start = string.find(data, "\n", last_start, true) or #data
|
|
found_newline = start ~= #data
|
|
|
|
line = string.sub(data, last_start, start - 1)
|
|
|
|
if results[result_index] then
|
|
results[result_index] = results[result_index] .. line
|
|
else
|
|
results[result_index] = line
|
|
end
|
|
|
|
if found_newline then
|
|
result_index = result_index + 1
|
|
end
|
|
|
|
last_start = start + 1
|
|
until not found_newline
|
|
|
|
return results
|
|
end
|
|
|
|
local prev_nf_finder = function(data) -- {{{
|
|
local results = { '' }
|
|
|
|
if data == nil then
|
|
if results[#results] == '' then
|
|
table.remove(results, #results)
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
local line, last_start, start, found_newline
|
|
|
|
last_start = 1
|
|
repeat
|
|
start = string.find(data, "\n", last_start, true) or #data
|
|
found_newline = start ~= #data
|
|
|
|
line = string.sub(data, last_start, start - 1)
|
|
|
|
results[#results] = (results[#results] or '') .. line
|
|
|
|
if found_newline then
|
|
table.insert(results, '')
|
|
end
|
|
|
|
last_start = start + 1
|
|
until not found_newline
|
|
|
|
return results
|
|
end -- }}}
|
|
local old_nf_finder = function(data) -- {{{
|
|
local results = {}
|
|
|
|
if data == nil then
|
|
if results[#results] == '' then
|
|
table.remove(results, #results)
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
local line, start, found_newline
|
|
repeat
|
|
start = string.find(data, "\n", nil, true) or #data
|
|
found_newline = string.find(data, "\n", nil, true)
|
|
|
|
line = string.sub(data, 1, start - 1)
|
|
data = string.sub(data, start + 1, -1)
|
|
|
|
line = line:gsub("\r", "")
|
|
|
|
results[#results] = (results[#results] or '') .. line
|
|
|
|
if found_newline then
|
|
table.insert(results, '')
|
|
end
|
|
until not found_newline
|
|
end -- }}}
|
|
|
|
local disp_result = false
|
|
local to_test = vim.fn.system('fdfind')
|
|
|
|
|
|
if disp_result then
|
|
print(vim.inspect(nf_finder(to_test)))
|
|
else
|
|
local test_amount = 100
|
|
print(#to_test * test_amount)
|
|
print(require('plenary.profile').benchmark(test_amount, nf_finder, to_test))
|
|
print(require('plenary.profile').benchmark(test_amount, prev_nf_finder, to_test))
|
|
print(require('plenary.profile').benchmark(test_amount, old_nf_finder, to_test))
|
|
end
|
|
-- print(require('plenary.profile').benchmark(100, nf_finder, to_test))
|
|
-- print(require('plenary.profile').benchmark(100, nf_finder, to_test))
|
|
-- print(require('plenary.profile').benchmark(100, nf_finder, to_test))
|