in reply to Re^4: LiBXML: New markup while preserving earlier tags?
in thread LiBXML: New markup while preserving earlier tags?

Oh sorry, I didn't have enough testing data. Thank you for providing them.

Does the following line fix the optimized version?

$from += $from == $to++ ? 1 : 2;
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^6: LiBXML: New markup while preserving earlier tags?
by Samantabhadra (Acolyte) on Jun 27, 2018 at 09:16 UTC
    oh.my.holy.pope -- sorry bishop ;-) yes it does!

    test-6

    file: 6_sample_file2
    Size of document to string: 4354
    Number of queried items: 1
    ---
    96 item(s) tagged with both methods.
    Unique item(s): a
    ---
    Benchmark: timing 1000 iterations of Method One, Method Two...
    Method One: 19 wallclock secs (18.96 usr + 0.00 sys = 18.96 CPU) @ 52.74/s (n=1000)
    Method Two: 5 wallclock secs ( 5.01 usr + 0.00 sys = 5.01 CPU) @ 199.60/s (n=1000)
    Rate Method One Method Two
    Method One 52.7/s -- -74%
    Method Two 200/s 278% --

    All other tests also successfull. With iterations all timed over 5 wallclock seconds, better rates of method 2 are now: 287%, 300%, 435%. -- The longer it takes, the better the rates.
    Finally, the test where every letter a is marked in the document:

    a-test

    Size of document to string: 65715
    Number of queried items: 1
    ---
    9103 item(s) tagged with both methods.
    Unique item(s): a
    ---
    Runtime method 1: 77 wallclock secs (77.06 usr + 0.12 sys = 77.18 CPU)
    Runtime method 2: 0 wallclock secs ( 0.43 usr + 0.00 sys = 0.43 CPU)

    An optimized version indeed. Thank you.