Leave Shortcode functions early, if there's no Shortcode delimiter
|Reported by:||TobiasBg||Owned by:||nacin|
The main Shortcode processing functions (like do_shortcode()) all make several function calls to build the Shortcode RegEx, with a lot of array handling and string concatenation, before finally using a comparably expensive preg_replace() - and that's for every post that is shown on a page, even if there's no Shortcode in the post.
With a quick check for the opening bracket [, that is required for every Shortcode, we can skip that extra work and leave those functions early to save some processing time.
The attached patch adds that to do_shortcode(), strip_shortcodes(), and has_shortcode().
(Hat tip to bobbingwhite, who suggested this in this comment before, but it didn't gain traction as the ticket dealt with a different aspect of Shortcodes.)