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 speedI'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 speedThe 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: - Use merge+pack.html: There's a customizing service bundled in the download package (called merge+pack.html) since version 2.2.0. Open this file in your browser via http (not via file: !) and follow the instructions.
- Serve the files zipped: Depending on your server you may serve the files zipped. Current browsers can easily deal with zipped packages. Zipping typically saves +/- 50%.
- Cache: Make sure that the script file is correctly cached in the browser.
|