Xi creator did an amazing work implementing ropes (<a href="https://github.com/google/xi-editor/tree/master/rust/rope" rel="nofollow">https://github.com/google/xi-editor/tree/master/rust/rope</a>)<p>The design documents (<a href="https://github.com/google/xi-editor/tree/master/doc/rope_science" rel="nofollow">https://github.com/google/xi-editor/tree/master/doc/rope_sci...</a>) explaining the concepts and implementation details is a must for those who want to understand its core.<p>But I still have my regards regarding input latency being accredited only to the text editor. I recently switched back to Linux (nvim running on alacritty with tmux) and the latency issues magically disapeared. During my iterm2 (and even terminal) period on OSX I felt horrible lag during operations which I don't even have time to blink with my current setup.<p>The last straw was once I found out iterm2 consuming 10% of my CPU in idle, the issue only happened when any non builtin font (menlo, monaco or courier) was used.
Presenter here, feel free to ask questions.<p>Also thanks to the awesome Recurse Center for inviting me to speak and making the recording, and the audience for their great questions.
"Platform text rendering (CoreText, DirectWrite) not performant enough"<p>That above needs some reliable proof to be honest.<p>I am testing this claim with Sciter (<a href="https://sciter.com" rel="nofollow">https://sciter.com</a>)... On Windows Sciter uses Direct2D/DirectWrite (with an option to render on DirectX device directly) and/or Skia/OpenGL.
On Mac it uses Skia/OpenGL with an option to use CoreGraphics. On Linux Cairo or Skia/OpenGL.<p>Here is full screen text rendering on DirectX surface using Direct2D/DirectWrite primitives. Display is 192 ppi - 3840x2160:<p><a href="https://sciter.com/temp/plain-text-syntax.png" rel="nofollow">https://sciter.com/temp/plain-text-syntax.png</a><p>On window caption you see real FPS that is around 500 frames per second for the whole screen for the sample. CPU consumption is 6% as it constantly does rendering in a "game event loop" style. In reality (render on demand as in sciter.exe) CPU consumption is 3% on kinetic scroll (120 FPS).<p>As you see platform text rendering is quite capable of drawing texts on modern hardware.<p>As of problems of text layouts ... Not that CPU and memory consuming too to be honest.<p>Sciter uses custom ::mark(name) pseudo-elements that allow to style arbitrary text runs/ranges without the need of creating artificial DOM elements (like <span> for each "string" in MS Visual Code), see: <a href="https://sciter.com/tokenizer-mark-syntax-colorizer/" rel="nofollow">https://sciter.com/tokenizer-mark-syntax-colorizer/</a><p>To try this by yourself: get <a href="https://github.com/c-smile/sciter-sdk/blob/master/bin/32/sciter-dx.exe" rel="nofollow">https://github.com/c-smile/sciter-sdk/blob/master/bin/32/sci...</a> (sciter on DirectX) and sciter.dll nearby. Download <a href="https://github.com/c-smile/sciter-sdk/blob/master/samples/%2Bcolororizer/show-master-css.htm" rel="nofollow">https://github.com/c-smile/sciter-sdk/blob/master/samples/%2...</a> and open it with the sciter-dx.exe.
There finally starts to be consciousness about input and output latency for GUI applications.<p>Xi sounds like an editor I'd love to use. Latency while typing is a jarring experience.
Pragmatically speaking the issue with switching editors is the fact that if it is not emacs or vi it is not a default install on whatever you sit down at.<p>I have tried tons of editors, and I always come back to vim. Heck, I have even moved my .vimrc to be the simplest possible with the smallest number of plugins.
I'm so conflicted about this. On one hand, having the "engine" written in Rust, and the frontend written in language suitable for writing a GUI, per platform, is a sound architectural choice. On the other hand, if there's one type of open source applications we have enough to choose from already, it's editors. If it's for fun and the educational process, then by all means, that's swell.<p>Bui if it's because the world needs yet another editor, just because it can be written in Rust, I'm not so sure.
Just today I was trying to edit a 15MB JSON file and it was so terribly slow with Sublime Text and wondered if there was something faster out there.<p>Edit: So I built Xi-Mac and the file opens in a fraction vs ST3 but once it's open performance is just as bad or maybe even worse.
Async and CRDT to coordinate between core and plugins is super clever and seems scalable to future design choices. Levien calls out that there is a high complexity overhead to this architecture, but that it's probably worth it to maintain performance.
> Separation into front-end and back-end modules.<p>That solves a lot of the Emacs trouble iiuc. (Same for the Async first design).<p>> The xi editor will communicate with plugins through pipes, letting them be written in any language,<p>That's caused a lot of trouble for vi/vim, has it not? I get the separation of concerns, but intermingling the concerns has helped emacs in a certain way.
Great stuff, and awesome to see this coming from Google (and in Rust instead of Go). Interesting historical note: The author of Sublime Text left Google to work on it by himself when he couldn't get it approved as a 20% project.
If I understand this correctly Xi and Alacritty are both using OpenGL to do the rendering and recently I heard that Rust supports compiling to Web Assembly.<p>Sounds as if it should be easy to port those apps to the browser world (WebGL + Web Assembly)? Does anybody know of any plans to do just that?
I'm glad `xi` is separating the editor core from the UI.<p>This feels more correct. So the GUI authors can work on the chrome and polish, while the editor team focus on performance and all the nitty-gritty memory operations.
Never I would have guessed that "xi" is pronounces "gsai". I would pronounce it "shee" (like chinese) or "ksai" (english) or "ksee" (german).<p>Also, I don't thin we need another editor with a pluggable focus. It's not true that you need plugins to a text editor. It is plugged into an environment that also contains all the other things you need. It interacts via "open file", "read file", "write file" and "close file" with the other tools. It basically _IS_ the plugin for editing files.<p>And if you really want an editor containing plugins, then there's a load of it out there. You can start with all the IDEs, you can start with Emacs, you can start even with Neovim or Atom. This is not a feature that needs another project.
Comment of the author of iterm2 on HN, about latency optimization: <a href="https://news.ycombinator.com/item?id=14800195" rel="nofollow">https://news.ycombinator.com/item?id=14800195</a>
I sure did like the core<—>core communicating idea for multiple users of a single document. It seemed like an easy trap to imagine X11 as the f/e, b/e, plugins, async were talked about, but not “just” using a remote f/e to communicate w a remote core was sort of enlightening (having fell into the X11 trap as the talk was progressing).<p>Question re: json communication though: is there a space for something like protocol buffers here, or is that a case of YAGNI, or simply ill-suited?
Great work. I love the plug-ins not being tied to a specific language. Surprised about doing rpc within a text editor but it was well argued in the presentation. If I consider it within the context of the tooling in an IDE it totally makes sense.<p>Text editors running on the desktop that are based on web browsers was a big step backwards. It encouraged features/plugins but now my text editor and my chat client each take gigabytes to run!
How small the binaries are, with a GUI (GTK, KDE, or QT), if I need to install in a system with no root permissions (local install) that's what I like about sublime, I can install it in home directory without needing admin help.<p>would you support plugins in a scripting language like python?
What methods and tools were used to capture and collect the per-frame tracing? It looked cool and really clearly presented, I would love to use that myself.
Trying to build it, but I get<p>error: could not find `Cargo.toml` in `/home/xyz/Downloads/xi-editor-0.2.0` or any parent directory
> <i>modern text editor with uncompromising performance</i><p>Solution in search of a problem.<p>I haven't run into an editor performance issue in more than twenty years.<p>I will gladly trade a hundred text editor performance fixes for one <i>web browser performance fix</i>.
not to be confused with the yi editor <a href="https://duckduckgo.com/?q=yi+editor&atb=v59-2__&ia=software" rel="nofollow">https://duckduckgo.com/?q=yi+editor&atb=v59-2__&ia=software</a>
Xi looks great, has a very clever design, and clearly is a next generation platform for building a useful and powerful editor.<p>I'd love to see this project continue and be a success. I think there is plenty of room for yet another text editor.<p>Here's where I'm going to be a bit of a party pooper.<p>Pragmatically speaking all of the great stuff Raph is talking about doesn't really matter. What Raph cares about are the kind of things people who build text editors like to geek out on and again that's all great.<p>Imma let you finish but VSCode and Atom and the entire Electron ecosystem have once again proven that a sub-optimal but powerful platforms with low barriers to entry win most of the time.<p>I'm rarely impressed by software projects (close or open) and I'm even less often impressed by Microsoft but what they've been able to do with VSCode in such a short amount of time, and the VELOCITY with which they are continuing to move means that for all practical purposes I will probably be in an Electron based editor for the foreseeable future.<p>I'm not saying I don't want Xi to continue to grow and be as great as it can be, I'm just being pragmatic.