Skip to content
Tcl Source Code Artifact [363cfe7d7a]
Login

Artifact [363cfe7d7a]

Artifact 363cfe7d7aabb1b9f0219bab9056fc64b2c2ffacce747d0ffa3d0f5f3318e1d6:

Ticket change [363cfe7d7a] - Ticket [1860727fffffffff|1860727fff] <i>PCRE optional regexp</i> status still Open with 7 other changes by sebres on 2017-11-17 14:52:47.
D 2017-11-17T14:52:47.162
J assignee aku
J closer nobody
J comment Attached\sis\sa\sdiff\sthat\sadds\sa\sconfigure\s--with-pcre\soption,\sas\swell\sas\s-type\sclassic|pcre\s-binary\soptions\sto\s[regexp]\s(available\sin\seither\sbuild,\sonly\sfunctional\swith\s--with-pcre).\r\n\r\n--with-pcre=/path/to/pcre\s(or\shave\sit\sinstalled\sin\sa\s"default"\slocation).\r\n\r\nInitial\stesting\sshows\sthat\sPCRE\sis\ssignificantly\sfaster\sin\sall\scases\sthe\sthe\sclassic\sSpencer\sengine.
J icomment I've\srebased\sit\sto\snewer\s8.5\s(many\sconflicts\sresolved)\srelative\smy\sbranch\ssebres-8-5-timerate\s(in\sorder\sto\stest\sperformance\salso).\r\n\r\nCurrently\savailable\son\smy\sgithub\s(see\sartificial\sPR\s<a\shref="https://github.com/sebres/tcl/pull/5">sebres/tcl#5</a>).\r\n\r\nCompared\sto\soriginal\svariant\sprovided\svon\sJeffrey\swith\spatch\spcre-20080121,\sit\sis\scomplete:-<br/>\r\nmany\sbugs\sfixed,\sregsub\sworking\sas\sexpected\snow,\smore\srobust\sand\sfaster<br/>\r\nand\shas\sbetter\sbackwards\scompatibility\sto\sthe\sclassic\sNFA-regexp\sof\stcl,\s\r\ne.\sg.\sUCP\s(Unicode\sproperties\sfor\s\\d,\s\\w,\setc.)\sand\smany\sothers.<br/>\r\n\r\nAdditionally:<ul>\r\n\s\s<li>better\sUTF8\sand\sUCP\ssupport;</li>\r\n\s\s<li>types\sare\scompiled\snow;</li>\r\n\s\s<li>I've\sfixed\sall\sknown\sbugs\s(of\sthe\sclassic\sregexp)\sfor\sthis\snew\sengine;</li>\r\n\s\s<li>added\sDFA\stype\s(still\sdraft,\sbut\sit\sworks\swell),\sthus\sfor\sexample<br/>\r\n`regexp\s-type\sdfa\s-inline\s{a|ab|abc}\s-abc-`\sreturns\sdfa-alternatives\s`{abc\sab\sa}`\s;)</li>\r\n\s\s<li>new\stest-cases\sadded\sin\sorder\sto\sexplain\sdifferences\s(advantages\sand\sdisadvantages)\sof\sall\s3\svariants.</li>\r\n\s\s<li>I've\salso\sa\sbuild\sfor\swindows\sresp.\sauto-scripts\sand\smakefile\sfor\swindows,\sthus\sif\ssomebody\sneeds,\sjust\sask\s:)</li>\r\n</ul>\r\n\r\nTodo's:<ul>\r\n\s\s<li>I\sshould\sreview\sand\srewrite\sa\sfew\sof\scode\spieces\sfor\sbetter\sunderstanding\sand\sto\savoid\scode\sduplication;</li>\r\n\s\s<li>`regexp\s-binary`\sfor\sreal\sbinary\scapability\sthrough\sPCRE;</li>\r\n\s\s<li>`regexp\s-dict`\sfor\scapturing\snamed\sgroups\sof\sPCRE;</li>\r\n\s\s<li>provide\sreal\sDFA-workspace\s(ATM\sfixed\sin\sstack)\swith\sreallocate\son\sdemand\sif\sto\ssmall;</li>\r\n\s\s<li>docu.</li>\r\n</ul>\r\n\r\nAs\sregards\sthe\sperformance,\sthe\sPCRE\sas\swell\sas\sDFA\sare\svery\sfaster\sas\sclassic\sNFA\sof\stcl\s(up\sto\s10\stimes\sand\son\slarge\sregexp\sstill\sfaster).\r\nHere\san\sexcerpt\sas\sa\sforetaste:<code><pre>\r\n%\stimerate\s-calibrate\s{}\r\n\r\n%\sforeach\st\s{c\sp\sd}\s{\s\r\n\s\s\s\sproc\stest_$t\s{}\s\\\r\n\s\s\s\s[string\smap\s[list\s_REENG_\s$t]\s\\\r\n\s\s\s\s\s\s{puts\s_REENG_:[timerate\s{regsub\s-type\s_REENG_\s-all\s-line\s{^((\\d{2})-(\\d{2})-(\\d{2,4})|NULL)$}\s"10-10-2017\\nNULL\\n20-10-2017"\s{**\\1**\\2**}}]}\s\r\n];\sputs\s"%\s[info\sbody\stest_$t]";\stest_$t\s}\r\n%\sputs\sc:[timerate\s{regsub\s-type\sc\s-all\s-line\s{^((\\d{2})-(\\d{2})-(\\d{2,4})|NULL)$}\s"10-10-2017\\nNULL\\n20-10-2017"\s{**\\1**\\2**}}]\r\n<b\sstyle="color:red">c:38.3610\sµs/#\s26049\s#\s26068.1\s#/sec\s999.266\snett-ms</b>\r\n%\sputs\sp:[timerate\s{regsub\s-type\sp\s-all\s-line\s{^((\\d{2})-(\\d{2})-(\\d{2,4})|NULL)$}\s"10-10-2017\\nNULL\\n20-10-2017"\s{**\\1**\\2**}}]\r\n<b\sstyle="color:green">p:1.413072\sµs/#\s693365\s#\s707677\s#/sec\s979.775\snett-ms</b>\r\n%\sputs\sd:[timerate\s{regsub\s-type\sd\s-all\s-line\s{^((\\d{2})-(\\d{2})-(\\d{2,4})|NULL)$}\s"10-10-2017\\nNULL\\n20-10-2017"\s{**\\1**\\2**}}]\r\n<b\sstyle="color:green">d:1.205143\sµs/#\s810168\s#\s829777\s#/sec\s976.368\snett-ms</b>\r\n</pre></code>\r\nNote\sDFA\shas\snot\srealy\sa\sback-references\shere\s(but\smatch\salternatives),\sjust\sthe\sregsub\sused\sin\sorder\sto\sminimize\soverhead\sof\ssome\stcl\sinternal\sby\smeasure\s(round\sabout\ssetting\sof\svariables\sor\screating\sthe\slists\sby\s-indices\sor\s-inline).\r\n\r\nTested\swith\sPCRE\s8.40.\r\n\r\nIf\sinterested\sby\sTCT\sI'll\srebase\sit\sto\sfossil\sas\ssoon\sas\spossible\sand\sprovide\smy\s8.6th\sand\s8.7th\sbranches\sfor\sthis.\r\nI'll\sjust\sspare\sthis\swork\s(rebase)\sif\snobody\sneeds\sit.\r\n\r\nAh,\syes,\sdon't\sforget:\sThanks\sto\sJeffrey\sfor\sthe\soriginal\swork!
J login sebres
J mimetype text/x-fossil-wiki
J severity Minor
K 1860727fffffffffffffffffffffffffffffffff
U sebres
Z 866a4158e60c5b256a20358a6de41235