New commands: provide-module and require-module

After some incubation time, the PR related to modules have been merged:

Here’s the relevant part in the doc:

provide-module [<switches>] <name> <commands>

declares a module name that is defined by commands . commands will be evaluated as if by source the first time require-module <name> is run.


allow the module to replace an existing one with the same name. Fails if the module has already been evaluated.

require-module <name>

guarantees the commands associated with name have been evaluated before continuing command execution. Fails if name has not been defined by a provide-module command. Does nothing if the associated commands have already been evaluated.

Which plugins in the current ecosystem will benefit from this new addition?

On my side I think I will use require-module to explicitely mark the (optional) dependency to from

1 Like

going to investigate the change, but I’ve revamped my script files to not strictly depend on each other.

Performance improvements are great :fireworks:

master 0cc89b, with my confg

Benchmark #1: kak -e 'quit' -ui dummy
  Time (mean ± σ):     535.4 ms ±  12.4 ms    [User: 419.7 ms, System: 175.7 ms]
  Range (min … max):   508.8 ms … 549.3 ms    10 runs

master 0cc89b, “stock” version (only default scripts)

Benchmark #1: kak -e 'quit' -ui dummy
  Time (mean ± σ):      38.1 ms ±   2.2 ms    [User: 32.5 ms, System: 12.3 ms]
  Range (min … max):    30.1 ms …  42.6 ms    74 runs

v2019.01.20, my config

Benchmark #1: kak -e 'quit' -ui dummy
  Time (mean ± σ):     864.8 ms ±  12.4 ms    [User: 748.4 ms, System: 181.6 ms]
  Range (min … max):   847.4 ms … 887.4 ms    10 runs

v2019.01.20, stock

Benchmark #1: kak -e 'quit' -ui dummy
  Time (mean ± σ):     244.5 ms ±   4.6 ms    [User: 226.9 ms, System: 35.0 ms]
  Range (min … max):   237.9 ms … 250.9 ms    12 runs

Other benchmark

I except even better loading times when language plugins adopt modules.

I wonder if modules are going to be used in default configs. Currently stock /rc configs are independent one of another (it’s probably good thing) but there is some code duplication in them that could be addressed now.

1 Like