Comments (4)
Most probably it is this code in
CanDisplay()
:if enc := t.encoder; enc != nil { nb := make([]byte, 6) ob := make([]byte, 6)
The best would be to optimize tcell in that case, since the API...
// CanDisplay returns true if the given rune can be displayed on
// this screen. Note that this is a best guess effort -- whether
// your fonts support the character or not may be questionable.
// Mostly this is for folks who work outside of Unicode.
//
// If checkFallbacks is true, then if any (possibly imperfect)
// fallbacks are registered, this will return true. This will
// also return true if the terminal can replace the glyph with
// one that is visually indistinguishable from the one requested.
CanDisplay(r rune, checkFallbacks bool) bool
...doesn't deny or suggest to don't use it as it's done. Maybe there is some room in micro
too, but currently tcell
seems to be the low hanging fruit:
Reserving these 12..16 byte within the tScreen
(+ simscreen
, etc.), structure, initialize it at Init()
and clear it at the usage with CanDisplay()
. No further allocation...
from micro.
Actually we can try just disabling its usage in micro (at least just as a test hack to see its actual impact on performance):
diff --git a/internal/screen/screen.go b/internal/screen/screen.go
index 16c011e6..ad369320 100644
--- a/internal/screen/screen.go
+++ b/internal/screen/screen.go
@@ -109,10 +109,6 @@ func ShowCursor(x, y int) {
// SetContent sets a cell at a point on the screen and makes sure that it is
// synced with the last cursor location
func SetContent(x, y int, mainc rune, combc []rune, style tcell.Style) {
- if !Screen.CanDisplay(mainc, true) {
- mainc = '�'
- }
-
Screen.SetContent(x, y, mainc, combc, style)
if UseFake() && lastCursor.x == x && lastCursor.y == y {
lastCursor.r = mainc
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 CanDisplay()
, as well as together with removal of CanDisplay()
.
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 CanDisplay()
... Do you happen to have a low-end ARM board that can boot Linux (to try to run micro on it)?
from micro.
In fact I've a old Raspberry Pi 1B in productive use as PiHole. 😉
I will do some tests when there is some time for that.
from micro.
- micro-master_rpi1b.prof.log: actual master - horrible slow
- micro-master-CanDisplay_rpi1b.prof.log: master with
CanDisplay()
disabled - still very slow, but already slightly better
from micro.
Related Issues (20)
- disable error HOT 2
- Confusion over missing bindings
- Differing copy-paste mechanics between tmux and non-tmux HOT 2
- Calling clipboard.Write in lua crashes micro HOT 6
- 2.0.13 micro-2.0.13-linux-arm.tar.gz may have been tampered with HOT 12
- Micro panics when cd-ing to root
- How to toggle softwrap + wordwrap in editor, and how to make it a default setting? HOT 2
- Colors in Color Schems appear wrong. HOT 2
- DeleteLine does not delete selected lines HOT 8
- Micro reindents settings.json files with spaces on open HOT 1
- Nightly builds are not the current master branch 😭 HOT 3
- Binding Backspace related keys do not work on Windows HOT 1
- Autosave locally HOT 22
- Scrolling does not always go down with the cursor HOT 2
- Cannot click to move cursor to first character of document HOT 6
- Panic with `open folder\` on Windows HOT 1
- Empty line for no reason HOT 3
- [Feature request] Proposal of functionality improvement HOT 5
- [Bug] Overwriting of configuration file HOT 1
- Detect and display keyboard shortcuts?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro.