module Roda::RodaPlugins::DelayBuild

  1. lib/roda/plugins/delay_build.rb

The delay_build plugin does not build the rack app until is called, and only rebuilds the rack app if! is called. This differs from Roda's default behavior, which rebuilds the rack app every time the route block changes and every time middleware is added if a route block has already been defined.

If you are loading hundreds of middleware after a route block has already been defined, this can fix a possible performance issue, turning an O(n^2) calculation into an O(n) calculation, where n is the number of middleware used.