Statuses

Theoretical performance and real scalability

In Bluefish, Gnome, Linux desktop, open source, Programming on December 22, 2010 by oli4444

A theoretical scalable design can be implemented with limitations, as I found out today. while fixing https://bugzilla.gnome.org/show_bug.cgi?id=637580

The file referred to is a 12Mb XML file, with about 200000 XML blocks.This file showed two problems in the bluefish editor widget implementation.

1) 16 bit limit overflow

The bluefish editor widget used a 16 bit integer (a glib guint16 type) to keep the reference count of found blocks and found context changes. As you can image, the reference count overflowed on this XML file with 200000 blocks.

The solution: use 32 bit integers.

2) clearing GtkTextTag’s

Every 100ms scanning run bluefish starts by clearing any leftover GtkTextTags from old syntax highlighting. However, the GtkTextView widget uses > 100ms to clear the formatting for 12Mb of data. And thus the scanning for syntax didn’t even start (the total loop may take 100ms). The syntax scanning thus never finished.

The solution: only clear old syntax highlighting once, and use a boolean to track when we have to clear old syntax highlighting again. The first run it only clears old syntax highlighting, but the next run immediately starts scanning new syntax.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: