Skip to content

🐞 Threading Issues #86

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

Closed
nanashili opened this issue Mar 19, 2022 · 8 comments
Closed

🐞 Threading Issues #86

nanashili opened this issue Mar 19, 2022 · 8 comments
Labels
bug Something isn't working help wanted Extra attention is needed performance This is performance related

Comments

@nanashili
Copy link
Contributor

nanashili commented Mar 19, 2022

When opening a large file the editor takes a massive hit in performance and ends up using a lot of resources on thread one. Also when you try to scroll it needs to load the file every time due to its size.

Screenshot 2022-03-19 at 13 28 07

Tabs

Screenshot 2022-04-14 at 22 10 03

When trying to close multiple tabs fast the editor breaks due it not being able to remove the tabs fast enough.

You can reproduce this by opening multiple tabs and closing them fast.

@nanashili nanashili changed the title Threading Threading Issues Mar 19, 2022
@lukepistrol lukepistrol added bug Something isn't working help wanted Extra attention is needed performance This is performance related labels Mar 19, 2022
@lukepistrol lukepistrol changed the title Threading Issues [BUG] - Threading Issues Mar 21, 2022
@austincondiff austincondiff changed the title [BUG] - Threading Issues 🐞 Threading Issues Mar 31, 2022
@heyvito
Copy link

heyvito commented Apr 14, 2022

Hi there @nanashili! I'd like to take a swirl on this one!
Would you be so kind as to explain what comprises a large file? Would it be large as in the quantity of columns, lines, or just overall size? How can I attempt to reproduce this issue?

Thanks!

@nanashili
Copy link
Contributor Author

Hi there @nanashili! I'd like to take a swirl on this one!
Would you be so kind as to explain what comprises a large file? Would it be large as in the quantity of columns, lines, or just overall size? How can I attempt to reproduce this issue?

Thanks!

Hi @heyvito, i think it might be the amount of lines as the issue that caused that was a very small file but had a lot of lines.

Steps to reproduce would to just be open a file with that spands a few hundered lines and see if the issue occurs.

@nanashili
Copy link
Contributor Author

@heyvito looks like that issue has been fixed.... But I did find another threading issue you might want to attempt
Screenshot 2022-04-14 at 22 10 03

When trying to close multiple tabs fast the editor breaks due it not being able to remove the tabs fast enough.

You can reproduce this by opening multiple tabs and closing them fast.

@heyvito
Copy link

heyvito commented Apr 14, 2022

Got it! I opened a relatively small file (14.5+k lines), and didn't noticed any hang, but it indeed consumed 100-110% of CPU for a brief moment. Taking a spindump, the responsible was AttributedString + JSCore, which are used by Highlightr. A better approach would be to use something more native to handle syntax highlighting altogether, and perhaps only try to stylise what is on the viewport (and what is about to become visible), together with Tree Sitter (leveraging viktorstrate/swift-tree-sitter, for instance) or any other engine. I have a small background on that, so lmk in case you folks need help. 🌻

Regarding the tabs, I'll take a look! Thank you for reporting! ♥️

@nanashili
Copy link
Contributor Author

Got it! I opened a relatively small file (14.5+k lines), and didn't noticed any hang, but it indeed consumed 100-110% of CPU for a brief moment. Taking a spindump, the responsible was AttributedString + JSCore, which are used by Highlightr. A better approach would be to use something more native to handle syntax highlighting altogether, and perhaps only try to stylise what is on the viewport (and what is about to become visible), together with Tree Sitter (leveraging viktorstrate/swift-tree-sitter, for instance) or any other engine. I have a small background on that, so lmk in case you folks need help. 🌻

Regarding the tabs, I'll take a look! Thank you for reporting! ♥️

@MarcoCarnevali @pkasila might want to looks at this.

@lilingxi01
Copy link
Member

I believe that Highlightr is causing a lot of issues right now like freezing while loading large file, lagging while scrolling, color-flashing while inputing, etc. And I agree that a real native editor should not come up with a solution involving JSCore. If you would like to rebuild current syntax highlighting feature by using a native engine, or (probably) build one from ground-up, I would like to join and help.

@lilingxi01
Copy link
Member

lilingxi01 commented Apr 15, 2022

Screen Shot 2022-04-14 at 9 17 57 PM

This is the CPU usage while opening a file that has 30k lines. It freezes for around 2 seconds (totally frozen) and then has some scroll-lags in the next ten seconds. After that, it runs smooth, but it is not an acceptable experience while opening the file. (Device is running on Apple M1 Pro with 16GB memory)

@lukepistrol
Copy link
Member

lukepistrol commented Apr 15, 2022

@heyvito @lilingxi01 Thanks for your input! We know that Highlightr is not very efficient and we are evaluating other options. I'm not quite sure what the current state is but I think we will be going the Tree Sitter route. Please get in contact with @MarcoCarnevali and @pkasila on that matter. We appreciate your help and are looking forward to what you come up with.

Also have a look at issue #36

@austincondiff austincondiff moved this from 🆕 New to 🏁 Complete in CodeEdit Project Feb 14, 2023
xinix909 pushed a commit to xinix909/CodeTransfer that referenced this issue Sep 7, 2024
[chore]: Refactor to use binary framework for `tree-sitter` language grammars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed performance This is performance related
Projects
Status: 🏁 Complete
Development

No branches or pull requests

4 participants