Hixie's Natural Log

2002-06-02 05:29 UTC Forum Chatter

Hyatt has written some interesting comments on why Gecko is inappropriate for the Mac.

Gecko is a thick cross-platform codebase that doesn't reuse components that have already been implemented by the OS.

Since Mozilla has to (by design) run on several platforms that do not provide OS versions of the components in question, code has to be written for them. Once code is written for them, it makes sense to use it wherever possible, as that keeps the required testing to a minimum. Therefore this is not a weakness of Mozilla, it is a strength -- the code in question gets more testing by virtue of being used on more platforms, and is therefore less likely to be buggy or unstable.

It implements all its own data structures in C++, from strings to hashtables.

As I understand it, the Mozilla implementations are better than the C++ standard implementations on many platforms. Whether the code is from the compiler's library or from Mozilla's libraries makes very little difference in the end.

It implements its own URL class

We are required to do this to achieve the level of standards compliance that Gecko entertains. If we were to use OS-provided URI classes we would be at the mercy of the operating system vendors when it comes to correctly handling RFC 2396 et al.

its own networking layer

This, even more than our URI class, is an absolute requirement for the level of standards compliance we have achieved.

a complete widget library

Given that hyatt was involved in the creation of this widget library, it is interesting that he now considers it a flaw! In any case, the widget library is actually required for us to allow Web authors to create the powerful effects that modern rendering engines are capable of. Furthermore, hyatt himself has actually written code to remove the disadvantages of having ones own widget library -- see the bug 117584 dependency tree.

The code is immense (over 1.5 million lines) and hard to understand.

That is a valid criticism. Gecko's code is indeed very hard to understand, and fixing bugs can be a tedious process. With each milestone, the situation is improving. On the other hand, the source of projects like Omniweb, Opera or MacIE is not even available, so there is very little to compare these 1.5 million lines with. (And Mozilla is a lot easier to compile than the altenative.)

It wrongly uses a thick reference counting system called XPCOM to communicate even in the guts of the networking layer and layout engine, forcing you to pay a reference counting churn penalty

Bug 106152 (assigned to hyatt), bug 114713, etc... see bug 105431's dependency tree to see what progress is being made on that front.

Its threading model is extremely weak, managing only to push network fetching onto a separate thread, while hogging the UI thread for image decoding, parsing, document tree construction, rendering tree construction, script execution, style resolution, and rendering.

Bug 40848 (assigned to hyatt). Note, though, that while this is indeed one of the most annoying bugs from a theoretical perspective, the only time you really notice it is when executing some painful JS in one window while trying to use another.

Gecko forces you to pay a huge startup time penalty because of its enormous code footprint.

Startup time is improving steadily.

Chimera's startup time is slower than either Omniweb or IE.

According to hyatt himself, the difference between Chimera and IE is fairly negligible, Chimera beating IE by a few seconds on a warm start.

We're also having to wrestle with the cross-platform nature of Gecko, which makes it hard for us to do anti-aliased text without taking a huge speed hit.

I am told this is because MacOS X is optimised to anti-alias per-paragraph, which Mozilla most likely does not do because it supports many CSS features that make the most obvious implementation model be per-character. However, have you filed a bug?

Our form controls are ugly because they don't use real native controls (we cheat by using the Appearance Manager).

See above -- using the appearance manager is not a cheat, it's exactly what it was designed for.

Our selection behavior doesn't fit in right with the OS X platform because Gecko implemented selection itself in cross-platform code, nor does our drag and drop behavior for the same reason.

These are valid criticisms, but have you filed bugs on them?

The problems mentioned in this paragraph are all surmountable, but they'll take time.

Indeed. And the much more important issues of the poor standards compliance of other Mac rendering engines will probably take even longer to be resolved.

It's relatively easy to make a platform-specific Web browser. The proliferation of Web browsers (especially on the Mac) is a witness to this. What is hard is to be able to create a browser that is not only usable and fast, but is interoperable, implementing the W3C, IETF and ECMA standards closely enough that authors can be certain that their compliant pages will render in the same way on all platforms.

In conclusion, despite all the criticisms, Gecko is one of only two rendering engines worth considering, because it is one of only two rendering engines that are free (and there is no way that a better rendering engine is worth giving away one's freedoms). And of those two, it is the one that most faithfully follows the specs.