[Seasar-user:21831] Re: kumu.jsについで

周 偉明 [E-MAIL ADDRESS DELETED]
2014年 3月 13日 (木) 10:53:41 JST


米林さん、

Thank you for you reply!

I'm using a bunch of JavaScript libraries, most notably jQuery UI tabs https://jqueryui.com/tabs/ version 1.9.2.
When the number of tabs gets large, the performance degrades dramatically in IE7/IE8. Another library has
similar performance degradation is jqgrid http://www.trirand.com/blog/ version 4.4.3.

As a result of investigation, these libraries rely heavily on Array.unshift, which is overridden by kumu.js with
its own implementation. Saving it and restoring later after kumu.js can be a workaround:

<script type="text/javascript">
var originalUnshift = Array.unshift;
</script>
<script type="text/javascript"  src="/teedaExtension/org/seasar/teeda/ajax/js/kumu.js"></script>
<script>
Array.prototype.unshift = originalUnshift;
</script>

With this trick, I got almost 5x speed up in IE7/IE8. But there are many places in my project have kumu.js linked,
so I have to apply this trick everywhere and it's really troublesome.

This kind of performance penalty happens in real IE7/IE8, but not in the IE7/IE8 simulated mode of IE9+, 
nor in modern browsers such as Chrome/Firefox. That's probably because that the JavaScript engine of modern
browsers are no optimized that the additional performance overhead caused by overridden Array.unshift is not
sensible.

Generally I think replacing the built-in methods provided by the browsers is not a good idea.

Any advice or suggestion will be greatly appreciated.

Best Regards,
 


2014-03-13 06:30:31 (+09:00) Masaaki Yonebayashi <yone at abby.co.jp> wrote
> 米林です。
> 
> What specific process do you do when the performance desgrade?
> 
> 2014年2月19日水曜日、周 偉明<zhou_w at worksap.co.jp>さんは書きました:
> 
> > お世話になっています。
> > 周と申します。
> >
> > kumu.js is overriding the prototype of array:
> >
> > Array.prototype = Kumu.extend(Array.prototype, {
> >   map:Kumu.map,
> >   filter:Kumu.filter,
> >   shift:Kumu.shift,
> >   unshift:Kumu.unshift,
> >   include:Kumu.include
> >
> > });
> >
> > which is causing serious performance problems in JavaScript heavy page in
> > IE7,8.
> >
> > What's the reason? If kumu.js is trying to deal with legacy browsers
> > without
> > all these methods provided, at least it should the existence of the methods
> > before overriding them.
> >
> > Any advice or suggestion will be greatly appreciated.
> >
> > Best Regards,
> >
> > _______________________________________________
> > Seasar-user mailing list
> > Seasar-user at ml.seasar.org <javascript:;>
> > https://ml.seasar.org/mailman/listinfo/seasar-user
> >
> 
> 
> -- 
> 米 林   正 明
> 株式会社Abby(エビイ)
> http://abby.co.jp


Seasar-user メーリングリストの案内