jlaurens / synctex

Synchronization for TeX
MIT License
64 stars 19 forks source link

Optimizing synctex_edit by hand-write string-to-integer conversion #70

Closed user202729 closed 7 months ago

user202729 commented 7 months ago

Proof of concept: https://github.com/user202729/luatex/commit/005c6702489d3a06dd3eca15ab4dbe8a7c544f0c

Admittedly this is ugly, but this part is very time-critical in the code.

In my testing, this change alone improves 17% performance (after applying the optimization described in #69 )

What do you think?

Caveat of the quick implementation above:

user202729 commented 7 months ago

@jlaurens Thanks for the quick fix, although the new code has the issue that -INT_MIN (as written in the source code) will overflow and evaluate to INT_MIN. Maybe better to just put INT_MAX in both cases?

user202729 commented 7 months ago

Speaking of which I think there are two issues with the synctex_merge_strings function: