Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dd629d3c95ec7af887729cb4f38799197020b4e778e076d49c42ebb76ffb7c06
Ticket: 446565ffffffffffffffffffffffffffffffffff
Capturing parens are very slow
User & Date: serhiy.storchaka on 2026-10-11 07:06:58
Changes

  1. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
  2. icomment:
    Still the same in 8.6, 9.0 and 9.1. Finding the submatch boundaries of this RE is much more expensive than finding the match, and <tt>regsub</tt> always asked the regexp engine for 10 submatches, even when the replacement string does not refer to any of them.
    
    Proposed fix in branch [/timeline?r=regsub-needed-submatches|regsub-needed-submatches]: <tt>regsub</tt> asks only for the submatches that the replacement string refers to, so the attached example now takes milliseconds instead of a second. A replacement with <tt>\1</tt> or <tt>\2</tt>, and <tt>regexp</tt> with submatch variables, are still slow with such REs. Tests regexp-31.1 to 31.5.
    
  3. login: "serhiy.storchaka"
  4. mimetype: "text/x-fossil-wiki"