On Saturday, 7 September 2013 at 15:31:31 UTC, Michel Fortin wrote:
On 2013-09-06 19:52:20 +0000, "Brad Anderson" <[email protected]> said:

hyphenate.js uses a big language lookup table to insert thousands of &shy; into all of the words on the entire page so that the browser can hyphenate the words. It seems the author has spent a lot of time trying to make it run fast but it's going to be slow just by the nature of what it has to do. A proper hyphenation algorithm is faster because it takes place during the layout stage so it doesn't need to consider every word for hyphenation (and also would be written in native code) but that option isn't available to javascript as far as I know.

Not Javascript, but try CSS.
https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens

That's what the website uses now. Works on basically everything but Chrome and Opera. hyphenate.js was supposed to use CSS3 hyphens if the browser supported it but that feature didn't seem to be working properly. When I applied CSS3 hyphens to dlang.org the display time went from tens of seconds to instantaneous. After I made that change we kept hyphenate.js around because Andrei didn't want to lose the hyphenation on Chrome but I tried to make it only run on Chrome (I think something was wrong with that though).

Reply via email to