`zap` example

faster `zap` implementation

This page follows the zap function benchmark example from the Fastester ReadMe. The benchmarks are defined in this file, while the options (including this very text you are now reading) are defined in this file. To generate this html page, evaluate Fastester's main function with the :documents argument. For example, with Leiningen, run this.

$ lein run -m fastester.core :documents zap_options.edn

The hyperlink immediately preceding this preamble ('faster `zap` implementation') is a one-element table of contents. Clicking that link whisks us to the html section for that benchmark group name. In a performance document like this one with only one group, it's not terribly useful. Real life documents will have multiple groups with longer sections and that table of contents will provide some handy navigation. Try clicking the link; it will scroll us only to the immediate next section.

faster `zap` implementation

This is the comments section for our single benchmark group, 'faster `zap` implementation'. We designated two benchmarks to that group, zap-inc and zap-uc. We don't see those names here because they are merely bookkeeping and not relevant for communicating the performance changes between version 11 and version 12.

What we can see are the actual benchmark function expressions that were measured by Criterium, i.e., the doall/zap expressions. We defined two benchmarks, and after running the benchmarks and generating the documents, we see two charts summarizing the results.

We simulated a performance improvement from version 11 to version 12 by giving the older version more work to do at each step. In both charts, all of version 12's data points are lower, i.e., shorter evaluation times, than version 11's respective data points, across the full range of argument sequence lengths (which span one element to ten-thousand elements). Given this, in the release notes, we might say:

The new implementation of zap offers more than 25% speedup across four orders of magnitude input length for processing both integers and strings.

This page merely shows an example. Actual performance reports ought to involve a wider span of inputs, and additional benchmarks to cover the majority of common use cases.

(fn [i] (doall (zap str/upper-case (abc-cycle-of-length-i i))))

Benchmark measurements for expression `(fn [i] (doall (zap str/upper-case (abc-cycle-of-length-i i))))`, time versus 'n' arguments, comparing different versions.

(fn [n] (doall (zap inc (range-of-length-n n))))

Benchmark measurements for expression `(fn [n] (doall (zap inc (range-of-length-n n))))`, time versus 'n' arguments, comparing different versions.