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] A lot of CPU time consumed in tcell's CanDisplay()
#3227
Comments
The best would be to optimize tcell in that case, since the API...
...doesn't deny or suggest to don't use it as it's done. Maybe there is some room in |
Actually we can try just disabling its usage in micro (at least just as a test hack to see its actual impact on performance):
I've tried, and haven't really noticed any impressive improvement so far. The CPU usage when continuously scrolling the buffer (e.g. by pressing and holding Down key) is maybe 22% instead of 25%, and that's it (that is still a magnitude higher than in vim). Which doesn't mean that there is no significant improvement in some cases (profiling suggests that there should be), I just haven't found any yet. If we manage to reduce/eliminate map accesses (per #3228), it would be really interesting to see how much improvement it gives us, compared to removal of Also it would be interesting to see micro's performance on a really low-end CPU (like on the Raspberry in #2970) and how does it improve after removing |
In fact I've a old Raspberry Pi 1B in productive use as PiHole. 😉 |
|
CPU profiling via
micro -profile
shows that among the CPU time consumed by micro, a large fraction of time is usually spent inside tcell'sCanDisplay()
function (which is called fromscreen.SetContent()
which is called fromdisplayBuffer()
).In particular, most of the time inside
CanDisplay()
is spent inruntime.makeslice()
->runtime.mallocgc()
, i.e. when allocating memory when creating slices. Most probably it is this code inCanDisplay()
:Micro calls
screen.SetContent()
for virtually every character on the screen (including blank space), every time when updating the screen, so as a result, it spends time to repeatedly allocate memory for these 2 small temporary slices thousands of times every time.Commit hash: 828871a
OS: Unix systems
Terminal: any
The text was updated successfully, but these errors were encountered: