# Scripting Kakoune with external tools

**URL:** <https://discuss.kakoune.com/t/scripting-kakoune-with-external-tools/1779>\
**Category:** Terminal Tools\
**Tags:** scripting, awk, gawk\
**Created:** [June 15, 2021, 5:13am UTC](https://discuss.kakoune.com/t/scripting-kakoune-with-external-tools/1779 "2021-06-15T05:13:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![TeddyDD](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/teddydd/32/21_2.png) [@TeddyDD](https://discuss.kakoune.com/u/TeddyDD)\
**Post date:** [June 15, 2021, 5:18pm UTC](https://discuss.kakoune.com/t/scripting-kakoune-with-external-tools/1779/3 "2021-06-15T17:18:51Z")

</div>

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](http://www.inf.puc-rio.br/~roberto/lpeg/)). And we already have nice integration [plugin](https://discuss.kakoune.com/t/a-lua-command-for-kakoune/1003).

* * *

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.

```auto
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

```

---

_[View the full topic](https://discuss.kakoune.com/t/scripting-kakoune-with-external-tools/1779)._
