Scripting Kakoune with external tools

Let’s not forget about Lua. It’s small, readable and available on almost every distro. While UTF-8 story is not great (you need external library) it has other advantages. It starts very quickly. There is fantastic PEG library for parsing (lpeg). And we already have nice integration plugin.


I did some extremely unscientific benchmark. I compared awk, Lua 5.4 and Python 3.9. I also compared launch time with shell and raw exec.

go test -bench . -benchtime 5s -cpu 1                                                                                                                                                                  2m 5s
goos: linux
goarch: amd64
pkg: tst
cpu: AMD Ryzen 9 5900X 12-Core Processor
BenchmarkRaw/Lua         	   14853	    404017 ns/op
BenchmarkRaw/Awk         	    4809	   1240155 ns/op
BenchmarkRaw/Python      	     808	   7380447 ns/op
BenchmarkShell/Lua       	    9108	    681058 ns/op
BenchmarkShell/Awk       	    3782	   1597863 ns/op
BenchmarkShell/Python    	     786	   7720292 ns/op
PASS
ok  	tst	42.209s
4 Likes