SynEdit performance bragging rights?

SynEdit LogoCommitted another round of speedups in the SynEdit SVN, and AFAICT SynEdit is now amongst the fastest text and highlighting editors out there!

To benchmark it yourself, if you don’t have a large text file hanging around, you can make a “meaningful” one easily.

Go to Delphi’s source\rtl\win directory and enter the following command-line:

type *.pas > c:\winall.pas

That should give you f.i. with  Delphi XE an 11 MB file, with 280k lines. Using the following file, here are my rough findings, for an executable compiled with Delphi XE, by order of decreasing performance:

Editor Time to load Time to reach last line Total
SynEdit << 1 sec 0 sec << 1 sec
Delphi XE < 1 sec << 1 sec < 1 sec
EmEditor (11.0.2) 0 sec 1* sec 1* sec
Scintilla SciTe 0 sec 2 sec 2 sec
Eclipse (Indigo) 3 sec 0 sec 3 sec
Notepad (Win7) 3 sec 0 sec 3 sec
Notepad++ ( 0 sec 16 sec 16 sec

*: EmEditor  does its line indexing work in a background task, so the 1 sec delay to reach the last line is only visible if you try to reach it just after having opened the file.

Once you’ve reached the last line at least once, entering text at the top or the bottom of the file, selecting blocks, copy-pasting etc. is instantaneous enough in all above editors. Memory usage is roughly comparable, except for Eclipse, which is the worst by far.

Notepad++ is using Scintilla, but performs much worse than SciTe (Scintilla minimalistic text editor/demo), so there must be a glitch somewhere in Notepad++ (which I personally didn’t expect, must have been a regression of some sort in recent versions).

SynEdit also seems to scale better than  all the others above on even larger files (as tested on 100MB+ files).

For bragging rights, what other fast editors do you know of? 😉



21 thoughts on “SynEdit performance bragging rights?

  1. UltraEdit is pretty fast when working with large files.. At least search/replace is super fast with it.

    Notepad++ will slow down your machine for a while if you try to search/replace a word on each line of your 11mb file.

    There is no emperical evidence yet that ms notepad.exe is even capable of completing such a task. It would take more than a lifetime.

  2. I was tempted to compare with Brief, a 1984 DOS editor from Underware Inc (!), that I still have on my machine. But that would be too much apples against oranges. Besides, it has the occasional error when dealing with files > 64k lines.

  3. For me, search&replace indicates the true speed, especially if original and replacement text are not of the same length. Try rerunning your tests by replacing every ‘end’ into ‘endd’ and then back to ‘end’.

  4. Great job.

    Delphi XE’s editor performs well since 2007. If you load the file into Delphi 8-2006, you will see from where Embarcadero came. The Delphi editor also works faster if you rename the file from .pas to .txt because then it doesn’t support Code Folding. Did your SynEdit have Code Highlighting and Code Folding active?

  5. Good points about Search&Replace, I’ll look at it next!

    Just tried UltraEdit: on the 11 MB file, it takes half a second to open, half a second to reach the end, however even after that, when browsing the file (with the scrollbar), there are “hiccups” and it’s not smooth (none of the others editors exhibited that behavior). Ultra-edit is also amongst the slowest editors to launch (only the IDEs are slower, and Delphi XE only marginally so).

    @Andreas Hausladen
    Yes, Delphi’s IDE does very well on very large files (the compiler does not though), that was a pleasant surprise (I had not dared opening anything large with it since D7 days).
    SynEdit was with syntax highlighting (DWS’s), Delphi XE was with CodeFolding disabled (my default setting).
    There is a slight difference between opening a large .pas or a large .txt with Delphi and SynEdit, but nothing major to the naked eye anyway.

    Context is based on SynEdit (with tweaks for large files, I guess), but doesn’t include one of my recent patches, so on a large file, even though you reach the end quickly, if you try selecting and editing there, it will stutter and won’t be smooth.

    @A. Bouchez
    I’m not sure this functionality is still active in Scintilla: when trying to open a file of 182 MB range in notepad++ and SciTE, it used more than 400 MB of RAM (consistent with a unicode memory buffer), took 2-3 seconds to load, I couldn’t reach the endline within 3 minutes in notepad++ (I killed the app at that point), and SciTE took 20 seconds to do that. Contrast that with 2 seconds of load time for SynEdit, and zero to reach the end.

    Is there some exe I could download to test your MemoEx?
    The version you linked doesn’t compile in Delphi XE, and doesn’t seem to support Unicode, judging by the compiler warnings.

  6. gabr :

    Try rerunning your tests by replacing every ‘end’ into ‘endd’ and then back to ‘end’.

    Ran a few quicks tests, “end” to “endd” behaves similarly to its reverse.
    However an “undo” after a “replace all” isn’t handled well by all editors, f.i. replacing “end” by “endd” is fast in Delphi XE, but doing undo after that just isn’t fast.

    As for SynEdit, the replace and undo themselves seem fast enough, but there is a slight bug about the editor visually scrolling for each replace, even with a “replaceall”, which just bogs it down (ala notepad). I’ll look into a proper fix, as once it’s out of the way, SynEdit looks to be fastest for that aspect so far.

  7. SynEdit lacks the word wrap feature. It is why I plan to use Scintilla instead the Microsoft RichEdit control in my largest personal project.

    Otherwise I’d definitely choose SynEdit, because it’s written in Delphi.

  8. @Eric
    My Delphi XE/XE2 undo is now a lot faster if not instant, after patching some code (thanks to the jdbg file). And the “1 second” seems to be the syntax highlighter and not the Code Folding (the winall.pas doesn’t have that many regions).

  9. It is good to see that there is still a lot of interest about SynEdit. I use SynEdit in an open source project called PyScripter which is an IDE for Python ( and is quite popular among Python users (47000 downloads of the latest version).

    The main thing missing from SynEdit is code-folding. There are at least two branches that have added code-folding to SynEdit. The Lazarus port and Letterpress ( The latter includes also a number of other improvements. I have created a branch in the SynEdit SVN called CodeFolding with the intention of adding code-folding to SynEdit, which is not a trivial task. Does anyone want to collaborate on this? If yes please email me(pyscripter at gmail dot com).

  10. @Andreas Hausladen
    Hehe, I anticipated you wouldn’t resist the temptation of fixing it 😉 Too bad there’s no one of the Embarcadero team as reactive as you for bringing the IDE to first-in-class levels. The fundamentals of Delphi IDE text editor are definitely top-notch when compared to other IDEs (Eclipse, Visual Studio…), it’s a pity they don’t speak about it, or that all Delphi users get out of the box for their own apps are outdated Memo/RichEdit for VCL and a disastrous ersatz-of-a-Memo for FMX…

  11. @PyScripter
    Was planning to mail you for some time, though I don’t have have any knowledge of the inner workings of SynEdit nor time to learn them (I’m only optimizing hotspots pinpointed by profiling), there may be some aspects I could tackle.

  12. @A. Bouchez
    Thanks for the exe!
    Opening and reaching the end of a file is very fast with your MemoEx indeed, and memory usage seems amongst the lowest, however, there are some odd behaviors, f.i. when you delete lines near the end of a file, and the syntax highlighter doesn’t seem to handle multi-line comments f.i.
    Any chance of bringing it to Delphi XE & beyond?

  13. @Lars Fosdal
    Confirmed, opens fast, reaches end fast, and search & replace/undo are fast (not instant, but fast). However it doesn’t seem to support syntax highlighting at all (?), so the comparison may not be fair with the other editors.

  14. @Eric
    The syntax highlighter handles lines just one by one: it does not handle multi-line comments, you’re perfectly right. This is a limitation of the current implementation.
    I use it only within projects compiled under Delphi 7, such as our SynProject documentation tool. Multi-line comments are not mandatory for those projects – pascal source code is only viewed in a visual comparison tool, not as a plain code editor. Edition is using either ini or a custom wiki format, which does not require multi-line highlighting.
    There is no intent to port it into Unicode version of Delphi yet, even if it shall not be difficult to implement.
    This unit was not meant to be the more complete, but some one-file-implemented fast component.

Comments are closed.