Formatter Caching In Newcomen

A new release of Newcomen is available. It introduces a mechanism to cache the results of formatter backends, improving the performance, as promised.

Formatters were applied to every content item before. Different content items made from the same source items would cause the formatter to run once for every item, even though the output would be the same for the same input. The new release fixes this and caches the results, to be reused if some content appears on another page. It shouldn’t cause any problems, but if it does, it can be disabled.

Here are some numbers. On the left, processing an example project with caching turned off, on the right with caching enabled (time in seconds):

samples: 50             samples: 50
total:   115.92949      total:   80.15429

mean:    2.3185898      mean:    1.6030858
median:  2.3082475      median:  1.5998295

minimum: 2.303442       minimum: 1.588271
maximum: 2.395656       maximum: 1.648774

Of course, actual numbers may differ depending on the project, number of sources, templates, pages etc.

Unfortunately, there is still the startup overhead caused by Moose. But this change should at least improve newcomen’s “monitor mode” a bit.

The new version is available on the download page, and — for developers — on Bitbucket.

Update: Template objects will now also be cached by default. Not that much of an improvement as the formatter cache, but better than nothing (time in seconds):

samples: 50
total:   73.025783

mean:    1.46051566
median:  1.4597545

minimum: 1.455288
maximum: 1.477835

I’ll try to improve it even more. Wait for the next update…

Update: Please use the repository at Gitlab from now on.