humanmade/hm-rewrite — pull request #13 by rmccue (2014-07-08 05:06:47+00:00)
Title: Add automatic flushing of rewrites

This automatically flushes rewrite rules when they need to be. It does this by "generating" them on every request, which could potentially theoretically be slow.

In practice, the slowest part of rewrite rules is deleting the option, and then saving it again, which WP does every time you call `flush_rewrite_rules`. If your rewrites haven't changed, deleting the option is unnecessary, as `update_option` can work out whether it needs to actually update the DB/object cache.

This PR automatically flushes rewrite rules for you, if you define `HM_REWRITE_AUTOFLUSH` as true. This currently defaults to false for backwards compatibility reasons, but setting it to true would be my preferred option.

My findings in practice: there are 179 rules in use on Happytables. This adds ~3ms to page loads, which is negligible at best.