aziz / SublimeANSI

ANSI escape codes color highlighting for SublimeText 3
225 stars 40 forks source link

Dramatic performance improvement for large static content #45

Closed jfcherng closed 6 years ago

jfcherng commented 7 years ago

After some profiling, I found that almost all time is spent on erasing the ansi codes. I guess that's because we have rendered (i.e., view.add_regions()) the content before erasing ansi codes and that makes ST do lots of extra calculations and renderings during the erasing step. Thus, I tried to do erasing first, calculate/correct offsets by myself and move the rendering step to the last. Eventually, I feel like 5~10x speedup on my machine with the given test case mentioned later.

Techniques:

Fix https://github.com/aziz/SublimeANSI/issues/42 with the test case.

Another test case from official ST's package git log sublime_package_git_log.log.

d4nyll commented 6 years ago

Anything blocking this PR from being merged?

jfcherng commented 6 years ago

Hmm. I could perform the merge operation actually. But I was hoping at least one of another Collaborator/Admin to do some code reviewing just because of politeness (I was the last one to be added as an Collaborator here).

d4nyll commented 6 years ago

Makes sense :+1: @aziz @jakkubu @matt1003 If you have some time please take a look at this! I guess a lot of the use cases for this extension is to parse log files, most of which tend to be very long! So this performance improvement is going to be very useful for many! Thank you for your work on this thusfar.

jfcherng commented 6 years ago

Merged because of project inactiveness. Released in 0.2.0.