Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement suggestion #11

Open
rdbende opened this issue Apr 7, 2023 · 1 comment · May be fixed by #35
Open

Performance improvement suggestion #11

rdbende opened this issue Apr 7, 2023 · 1 comment · May be fixed by #35
Labels
duplicate This issue or pull request already exists enhancement New feature or request help wanted Extra attention is needed

Comments

@rdbende
Copy link
Owner

rdbende commented Apr 7, 2023

@Moosems:

@rdbende I think you might want to consider this. Currently chlorophyll highlights the entire text box. For small amounts of code of moderately sized snippets this works fine but with large amounts of code it grinds to a halt. My suggestion is to only highlight what's in the current view and remove the other tags to save speed. The locations of the other tags can be kept in a list but by not highlighting them all at the same time it saves a ton of time. As the Tcl Core itself has noted tags are very slow so minimizing the amount of active tags is very important.

Sample code to test with:

from tkinter import Tk
from chlorophyll import CodeView
root = Tk()
text = CodeView(root)
text.pack()
text.insert("end", "text = BaseText(root, lexer=lexers.PythonLexer, undo=True, font=(\"Courier New bold\", 15), indentation_type=\"space\", indentation_amount=4, bind_string=\"Command\", comment_type=(\"# \", \"\\\"\\\"\\\"\"))\n"*100)
root.mainloop()

@rdbende:

I'm afraid it wouldn't make it much faster, but would make it much more laggy, because it has to constantly highlight everything.

@Moosems:

Why do you say it wouldn't get much faster? And for highlighting everything that's the issue I am trying to avoid by not using as many tags

@rdbende:

Because it has to constantly re-add the tags, as you scroll. The same thing happens in Porcupine, so I know, it's laggy, and doesn't really reduce CPU usage.

@Moosems:

Not if it doesn't move outside the view

@Moosems
Copy link
Collaborator

Moosems commented Apr 7, 2023

Merge with #9 for a performance update

@Moosems Moosems added duplicate This issue or pull request already exists enhancement New feature or request help wanted Extra attention is needed labels Apr 10, 2023
@Moosems Moosems linked a pull request May 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants