My favorites | Sign in
Logo
                
Search
for
Updated May 06, 2009 by math...@mnn.ch
Labels: Phase-Deploy
en_Optimizations  
There some things you can do to speed up Hyphenator

How fast is Hyphenator?

There is no answer to this question despite of: “it depends on a lot of parameteres”. For most tasks Hyphenator is fast enough, but speed is cool and there are things you can do to make Hyphenator faster and thus even cooler ;-)

Execution speed

I'm permanently tweaking the code for execution speed. If there's a millisecond to save, I want to save it! Nevertheless there are differences in execution speed depending on the browser you use. In general a more recent version is faster.

What an webauthor can do: The depth of the DOM-Tree has a big impact on the speed of Hyphenator. It takes a quite bit of time to hyphenate a document with <body class="hyphenate"> and highly nested code (layout tables, lots of divs in divs in divs...). But its quite fast to just hyphenate all p-Elements.

Conclusion: Write clean standard-conform code and set class="hyphenate" to the leaves instead to the roots or branches.

Loading speed

The script itself isn't that big (commented Hyphenator.js: ca. 44KB). But the pattern files take some time to load (69KB for the german patterns, 24 KB for english).

By merging the script and the patterns in one file and by packing the resulting script with a Javascript-packer we can optimize loading speed (one file = one http request).

What an webauthor can do:


Sign in to add a comment
Hosted by Google Code