On Fri, Dec  8, 2023 at 21:18 (+0100), Hans Hagen wrote:

> On 12/8/2023 7:51 PM, Jim wrote:

>> Hi Hans (and anyone else interested in synctex),
>> 282a284,285
>>> locate( 0, s) if fi ~= 0 then tl = s ; goto done end
>>> locate( 0,-s) if fi ~= 0 then tl = s ; goto done end

>> and then wrote the following quick and dirty shell script to create log
>> files for comparison:

> ok

>> Admittedly, with the other two directions added in, a more extensive test
>> (a total of a bit under 14 minutes CPU time on a Ryzen 4700U) showed the
>> new version is about 0.5% slower, so there is a very minor downside.  (I'd
>> happily spend the extra matches for the minuscule amount of CPU time, but
>> others may not.)
> the .5% precen tis no big deal, also because this script is not that time
> critical (the code could be made a bit faster anyway) so i'll add the few
> lines

Great.  If nothing else, it will keep other people from asking the same
question in the future. :-)

> so those 14 minutes, was that N times a file or 1 time a huge file?

N times a file:

I swiped the code from the program and defined two functions, one
(test_old) one for the current code and one for the new code:

test_new ()                           
{
    for x in $=x_vals
    do
        for y in $=y_vals
        do
            printf "%3d, %3d: " $x $y
            out=`mtxrun --script mtx-synctex-jd.lua --goto --direct \
                --page=$page --x=$x --y=$y --tolerance=$tolerance $st_file`
            echo $out
        done
    done
}

(The test_old was the same except for the argument to --script, which is
'synctext'.)

I defined $page=15, $tolerance=300 and $st_file to be a file with 3441
lines (there are 19 pages in total, so I was skipping a lot of stuff) and
changed x_vals and y_vals to create a lot of iterations:

x_vals=`seq 100 5 550`
y_vals=`seq 100 5 700`

and finally I ran

time (test_new > /dev/null)

and

time (test_old > /dev/null)

So mtxrun was called for each of these 11,011 times.

Not the best possible benchmark, but probably good enough to show that
adding the other two cases isn't hurtful.

Cheers.
                                Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to