https://bugzilla.wikimedia.org/show_bug.cgi?id=50836

--- Comment #6 from kipod <[email protected]> ---
i think you missed the main point: when we call "load" with a font family such
that this.getCSS() returns false (e.g. "sans-serif" on my browser), we do not
cache the result. calling getCSS() is orders of magnitude more expensive than
the search, regardless of whether the search is done the right way (through
hash) or the wrong way (through $.inArray).

as to profiling: the real test is to have ~20 entries in the font table (like
in [[en:Japan]]), and then measure how long does it take to look for a font
_which is not in the list_, which is what happens today, thanks to the problem
mentioned above. you'll see that the search takes significantly longer than it
should.

still, the main problem is not the inefficient search, but rather calling
getCSS thousands (or tens of thousands - depends on the page content) of times
instead of once per each font family present on the page.

as to why we call "load" so many times: easy. set a breakpoint, and follow the
call stack upward until you'll find the call that's inside an .each() loop.


peace.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to