Skip to content
Tcl Source Code History Of Ticket 1860727fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1860727fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1860727fffffffffffffffffffffffffffffffff

  1. Ticket change [53085a4f61] (rid 126413) by hobbs on 2007-12-30 01:12:44:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Attached is a diff that adds a configure --with-pcre option, as well as -type classic|pcre -binary options to [regexp] (available in either build, only functional with --with-pcre).
      
      --with-pcre=/path/to/pcre (or have it installed in a "default" location).
      
      Initial testing shows that PCRE is significantly faster in all cases the the classic Spencer engine.
      
    4. foundin initialized to: "TIP Implementation"
    5. is_private initialized to: "0"
    6. priority initialized to: "6"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "hobbs"
    10. subsystem initialized to: "43. Regexp"
    11. title initialized to: "PCRE optional regexp"
    12. type initialized to: "Patch"
  2. Ticket change [f3bb30049c] (rid 129770) by hobbs on 2007-12-30 08:12:44:

    1. icomment:
      
      
      File Added - 260122: pcre.diff.gz
      
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  3. Ticket change [b2c67e7e94] (rid 98401) by hobbs on 2007-12-30 09:04:25:

    1. icomment:
      
      
      File Added - 260151: pcre.diff.gz
      
      Logged In: YES 
      user_id=72656
      Originator: YES
      
      Updated version that adds:
          interp regexp {} ?classic|pcre?
      
      So set the default engine with [interp regexp {} pcre].  I've also added support in Tcl_RegExpExecObj to recognize compiled PCREs so that the compile case works.  It currently assumes -binary operation by default.
      
      In the lmbench grep.tcl code, you need to add:
      
      if {![catch {interp regexp {}}]} {
          puts stderr "PCRE regexp"
          interp regexp {} pcre
      } else {
          puts stderr "TCL regexp"
      }
      
      and then it will work as before, just faster.
      File Added: pcre.diff.gz
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  4. Ticket change [7899e87141] (rid 89986) by hobbs on 2007-12-30 09:04:26:

    1. icomment:
      
      
      File Deleted - 260122: 
      
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  5. Ticket change [b8e6b00c22] (rid 129041) by hobbs on 2007-12-31 09:15:23:

    1. icomment:
      
      
      File Added - 260247: pcre.diff2.gz
      
      Logged In: YES 
      user_id=72656
      Originator: YES
      
      Updated version that has cleaner integration.  The conversion of RE compile flags is done at the caching of the object.
      
      This version includes fully correct handling in [regsub] (you'll find the it is mostly transparent to Tcl_RegsubObjCmd), with support for the whole Tcl_GetRegExpFromObj/Tcl_RegExpExecObj/Tcl_RegExpGetInfo path of execution being handled 100% transparently for classic or PCRE REs.
      
      The translation of flags needs to be better reconciled between Spencer's flag meanings and PCREs (like TCL_REG_NLSTOP TCL_REG_NLMATCH == ??? in PCRE).
      File Added: pcre.diff2.gz
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  6. Add attachment "pcre.diff3.gz" [64f150b685] (rid 92864) by hobbs on 2008-01-01 03:16:17.

  7. Ticket change [88fc0ca243] (rid 131954) by hobbs on 2008-01-01 03:16:18:

    1. icomment:
      
      
      File Added - 260318: pcre.diff3.gz
      
      Logged In: YES 
      user_id=72656
      Originator: YES
      
      New patch that calms some tests, fixes [lsearch -regexp] crash condition.  Note that any calls that use Tcl_GetRegexpFromObj with NULL interp can't check the [interp regexp {} pcre] state (as lsearch -regexp does).
      
      In this version, you can set environment TCL_REGEXP_PCRE to have PCRE enabled by default in Tcl interps.
      File Added: pcre.diff3.gz
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  8. Add attachment "pcre.diff4.gz" [e3e26ccb4e] (rid 87872) by hobbs on 2008-01-03 05:16:04.

  9. Ticket change [946dcf02e2] (rid 105982) by hobbs on 2008-01-03 05:16:04:

    1. icomment:
      
      
      File Deleted - 260247: 
      
      
      
      File Added - 260524: pcre.diff4.gz
      
      Logged In: YES 
      user_id=72656
      Originator: YES
      
      Updated version that doesn't leak the study'd pcre info, corrects more tests and is generally better, so just use it.
      File Added: pcre.diff4.gz
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  10. Add attachment "pcre-20080121.diff.gz" [3ac68a8df6] (rid 112619) by hobbs on 2008-01-22 11:47:36.

  11. Ticket change [f4aca4319d] (rid 129960) by hobbs on 2008-01-22 11:47:36:

    1. icomment:
      
      
      File Added - 263244: pcre-20080121.diff.gz
      
      Logged In: YES 
      user_id=72656
      Originator: YES
      
      Updated to have --enable-pcre=yes|no|default.  If default is used, then PCRE will be the default engine.  --with-pcre still exists to point to a non-standard location.
      
      Fixed a -indices issue, and updated the test suite.  The remaining test issues mostly represent differences in line anchor styles.
      File Added: pcre-20080121.diff.gz
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  12. Ticket change [363cfe7d7a] (rid 158575) by sebres on 2017-11-17 14:52:47:

    1. assignee changed to: "aku"
    2. closer changed to: "nobody"
    3. comment changed to:
      Attached is a diff that adds a configure --with-pcre option, as well as -type classic|pcre -binary options to [regexp] (available in either build, only functional with --with-pcre).
      
      --with-pcre=/path/to/pcre (or have it installed in a "default" location).
      
      Initial testing shows that PCRE is significantly faster in all cases the the classic Spencer engine.
      
    4. icomment:
      I've rebased it to newer 8.5 (many conflicts resolved) relative my branch sebres-8-5-timerate (in order to test performance also).
      
      Currently available on my github (see artificial PR <a href="https://github.com/sebres/tcl/pull/5">sebres/tcl#5</a>).
      
      Compared to original variant provided von Jeffrey with patch pcre-20080121, it is complete:-<br/>
      many bugs fixed, regsub working as expected now, more robust and faster<br/>
      and has better backwards compatibility to the classic NFA-regexp of tcl, 
      e. g. UCP (Unicode properties for \d, \w, etc.) and many others.<br/>
      
      Additionally:<ul>
        <li>better UTF8 and UCP support;</li>
        <li>types are compiled now;</li>
        <li>I've fixed all known bugs (of the classic regexp) for this new engine;</li>
        <li>added DFA type (still draft, but it works well), thus for example<br/>
      `regexp -type dfa -inline {a|ab|abc} -abc-` returns dfa-alternatives `{abc ab a}` ;)</li>
        <li>new test-cases added in order to explain differences (advantages and disadvantages) of all 3 variants.</li>
        <li>I've also a build for windows resp. auto-scripts and makefile for windows, thus if somebody needs, just ask :)</li>
      </ul>
      
      Todo's:<ul>
        <li>I should review and rewrite a few of code pieces for better understanding and to avoid code duplication;</li>
        <li>`regexp -binary` for real binary capability through PCRE;</li>
        <li>`regexp -dict` for capturing named groups of PCRE;</li>
        <li>provide real DFA-workspace (ATM fixed in stack) with reallocate on demand if to small;</li>
        <li>docu.</li>
      </ul>
      
      As regards the performance, the PCRE as well as DFA are very faster as classic NFA of tcl (up to 10 times and on large regexp still faster).
      Here an excerpt as a foretaste:<code><pre>
      % timerate -calibrate {}
      
      % foreach t {c p d} { 
          proc test_$t {} \
          [string map [list _REENG_ $t] \
            {puts _REENG_:[timerate {regsub -type _REENG_ -all -line {^((\d{2})-(\d{2})-(\d{2,4})|NULL)$} "10-10-2017\nNULL\n20-10-2017" {**\1**\2**}}]} 
      ]; puts "% [info body test_$t]"; test_$t }
      % puts c:[timerate {regsub -type c -all -line {^((\d{2})-(\d{2})-(\d{2,4})|NULL)$} "10-10-2017\nNULL\n20-10-2017" {**\1**\2**}}]
      <b style="color:red">c:38.3610 µs/# 26049 # 26068.1 #/sec 999.266 nett-ms</b>
      % puts p:[timerate {regsub -type p -all -line {^((\d{2})-(\d{2})-(\d{2,4})|NULL)$} "10-10-2017\nNULL\n20-10-2017" {**\1**\2**}}]
      <b style="color:green">p:1.413072 µs/# 693365 # 707677 #/sec 979.775 nett-ms</b>
      % puts d:[timerate {regsub -type d -all -line {^((\d{2})-(\d{2})-(\d{2,4})|NULL)$} "10-10-2017\nNULL\n20-10-2017" {**\1**\2**}}]
      <b style="color:green">d:1.205143 µs/# 810168 # 829777 #/sec 976.368 nett-ms</b>
      </pre></code>
      Note DFA has not realy a back-references here (but match alternatives), just the regsub used in order to minimize overhead of some tcl internal by measure (round about setting of variables or creating the lists by -indices or -inline).
      
      Tested with PCRE 8.40.
      
      If interested by TCT I'll rebase it to fossil as soon as possible and provide my 8.6th and 8.7th branches for this.
      I'll just spare this work (rebase) if nobody needs it.
      
      Ah, yes, don't forget: Thanks to Jeffrey for the original work!
      
    5. login: "sebres"
    6. mimetype: "text/x-fossil-wiki"
    7. severity changed to: "Minor"