ox icon indicating copy to clipboard operation
ox copied to clipboard

Mouse selection (& scroll) is extremely sluggish and I don't know why

Open fooryo opened this issue 1 year ago • 13 comments

What is the bug? Mouse selection (& scroll) is extremely sluggish

What did you do to get the bug? I was selecting some text from 170 lines docker compose file where half of it is made of commented lines. ox 0.6.9 on Archilinux

What behaviour were you expecting? At least good as in other text editor (micro)

fooryo avatar Oct 29 '24 16:10 fooryo

Try adjusting scroll amount in your configuration file (~/.oxrc)

I like to use

terminal.scroll_amount = 4

in mine

This will shift up/down by 4 lines at a time.

I should probably update the default (currently 2) to a higher amount because you're right, I find it too sluggish too.

curlpipe avatar Oct 29 '24 17:10 curlpipe

Still sluggish for the mouse selection function.

About the scroll: yea, that will hide a bit the slugginess, still not so smooth, I need to say.

Try adjusting scroll amount in your configuration file (~/.oxrc)

I like to use

terminal.scroll_amount = 4

in mine

This will shift up/down by 4 lines at a time.

I should probably update the default (currently 2) to a higher amount because you're right, I find it too sluggish too.

fooryo avatar Oct 29 '24 17:10 fooryo

I have noticed that when selecting downwards past the viewport (i.e. moving the cursor down to the bottom of the editor to try to select text that is out of view) is a bit sluggish.

Is this what you are referring to?

Or are you referring to the skipping of multiple lines at once as not smooth enough?

Perhaps both?

curlpipe avatar Oct 29 '24 17:10 curlpipe

So I've performed a thorough investigation into Ox's performance and found the rendering process to be really slow - I just tried a simple optimisation and found the editor renders in the terminal ~3x faster than before, so I really hope this helps make it feel less sluggish. (It's due to be released in 0.6.10)

I'm also going to set the default scroll amount to 4 in 0.6.10.

curlpipe avatar Oct 30 '24 00:10 curlpipe

Is this what you are referring to?

Bottom-up, top-down, inside or outside the viewport: doesn't makes any differences.

Or are you referring to the skipping of multiple lines at once as not smooth enough?

Not clear to me what you are referring to.

Perhaps both?

I'm referring to select region of text with the use of the mouse. I could make a screen recording of it if you can point me some light weight tool for windows (or linux/wayland) ( I'm using ox over ssh over Windows Terminal, but it is sluggish also on the terminal emulator on the real machine )

I just tried a simple optimisation and found the editor renders in the terminal ~3x faster than before

NICE, looking forward to try it


Thinking of it I might use OBS, I'll post a small video if I will able to do it

fooryo avatar Oct 30 '24 09:10 fooryo

0.6.10 released (this might make scrolling smoother?)

curlpipe avatar Nov 02 '24 16:11 curlpipe

I'm sorry, man. It is basically the same as before. Look at the CPU usage while selecting, using a full core. I've tried both remotely (LAN) and locally, same behaviour except for one thing: while using ox remotely (windows terminal) the text changes color but I think it is a problem of mine and not ox's.

I'm not a good programmer and I cannot think of myself writing a text editor but I feel like there is something intrinsically wrong in this implementation of text selection. As I said before: other text editors (vim, nano, micro) do not have such a weird problem.

Am I the only one to have this problem?

https://github.com/user-attachments/assets/9f00f3fc-0bcd-4b1a-aaad-4bd523556c3d

fooryo avatar Nov 03 '24 23:11 fooryo

Thanks for sharing this. May I ask which terminal emulator you are using and how you installed Ox?

curlpipe avatar Nov 04 '24 01:11 curlpipe

Thanks for sharing this. May I ask which terminal emulator you are using and how you installed Ox?

Installed on Archlinux via AUR (paru), the package is ox-bin. The system is Archlinux with hyprland and foot terminal. What are you watching on that video is two Windows Terminal that ssh'd into the archlinux machine, one pane with ox and the other pane with htop, both processes of the archlinux machine, but as I said before the same behaviour can be seen on foot terminal (so locally)

fooryo avatar Nov 04 '24 08:11 fooryo

I greatly optimised the front-end with 0.6.10, so maybe the continued performance issues is because of inefficiencies in the back-end. I've already found some inefficiencies that I'm working on patching :+1:

curlpipe avatar Nov 07 '24 15:11 curlpipe

I've done some optimisations in 0.7.1 - not sure how much impact they will have - but I've tried targeting a few areas of blatant inefficiency so hopefully there should be at least some improvement.

curlpipe avatar Nov 15 '24 13:11 curlpipe

Cool! Indeed, the optimizations worked. Less sluggish by a ton in "native" (meaning: not thru ssh into the machine). CPU usage doing crazy mouse selection as the video I posted before is now not more than 62%, still VIM uses not more 14%. Using ssh into the machine (local network), the crazy mouse selection still lag behind. Still, very good improvement known that ox is brand new project

fooryo avatar Nov 17 '24 11:11 fooryo

That's great news! I'll keep looking at ways to optimise and hopefully, we can get Ox over SSH running more efficiently.

curlpipe avatar Nov 18 '24 12:11 curlpipe