Re: RedyCode 0.9.2 released
- Posted by ryanj Jul 02, 2016
- 3521 views
Woohoo! I'm finally done working on some long-overdue optimizations. Now i will be able to address the issues of the current conversation.
Graphics performance of the redy widget system is faster now, and the text editor canvas performance is MUCH faster! This is starting to feel closer to the performance of a typical text editor, except for a few non-graphics-related issues such as rebuilding wordwrap and syntax highlighting. It's probably a little slower than a C-written program, but fast enough to not be annoying. I will test it on some older computers in a few days to confirm.
A little background: the widgets draw to a buffer bitmap as needed, then when WM_PAINT is called, the win32 BitBlt function is used to copy the buffer to the window. I decided to do it that way because it was easier and theoretically faster than drawing widgets directly to the window every time the slightest change occurs. Until now, every time a widget drew to the buffer bitmap, the entire bitmap would be copied to the window! This works ok in most cases with a powerful video card, but it is horribly inefficient.
Now, when a widget redraws itself, only the widget's area is invalidated and BitBlt'ed to the window. That makes a noticeable difference when scrolling a listbox, for example. The Canvas widgetclass also has this optimization when drawing to a canvas image, making it faster to update a section of the canvas without having to BitBlt the entire canvas bitmap.
In addition to these optimizations, textdoc.e now redraws only the lines that have changed and invalidates only the area that is affected by the redrawn lines. Before, all visible lines were redrawn and the entire canvas bitmap was copied to the window (which requires processing lots of data to generate hundreds of drawing commands).
Selecting text has a much higher refresh rate now.
Scrolling is really smooth now, because instead of drawing all visible lines, it shifts the bitmap up or down using BitBlt and only draws the lines that are newly in view.
Euphoria has claimed for many years to be one of the fastest interpreted languages, but it doesn't really help if your code is inefficient. Optimization is important!
Faster, better release coming soon!