So called micro optimizations....someone said so....!!!

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

So called micro optimizations....someone said so....!!!

Stefan A
We have now finalised phase one of the loop optimizations:

Improvements for a 1000 line custom code application.
--------------------------------------------------------------------------
                         Unoptimized   Optimized   Improvement     
Load runtime:     14352ms       11406ms           21%
Main runtime:         133ms          136ms             0 %
Finalize runtime:       98ms            99ms             0 %

Additionally, execution time has decreased for a 1 million line custom code application by an average of about 19%!!!!!

These were the results of simple micro optimizations we were advised by "someone" a while ago not to spend our time on. The bug reported was even closed, see bug:

http://bugzilla.qooxdoo.org/show_bug.cgi?id=4122

We have used an Acer Aspire One D250 for testing (eventually within the slowest range). 1000 starts (1000 unoptimized and 1000 optimized) of the application were performed and gave the above figures.

Stefan

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Joachim Baran
Hi!

On 20 November 2010 18:27, Stefan Andersson <[hidden email]> wrote:
> The bug reported was even closed, see bug: http://bugzilla.qooxdoo.org/show_bug.cgi?id=4122
  Sorry to be pedantic, but this is not really a bug, isn't it? It
seems more like a very specific software design issue, that just
happens to have an impact on the performance of the code.

Joachim

--
B.1079 Michael Smith Building
Faculty of Life Sciences
The University of Manchester
Oxford Road
Manchester
M13 9PT
United Kingdom

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Krycek
That's a good surprise. 
Since the optimization were already done and shown good results, shouldn't it be a problem to apply them in the framework, right core developers?

On Sat, Nov 20, 2010 at 4:41 PM, Joachim Baran <[hidden email]> wrote:
Hi!

On 20 November 2010 18:27, Stefan Andersson <[hidden email]> wrote:
> The bug reported was even closed, see bug: http://bugzilla.qooxdoo.org/show_bug.cgi?id=4122
 Sorry to be pedantic, but this is not really a bug, isn't it? It
seems more like a very specific software design issue, that just
happens to have an impact on the performance of the code.

Joachim

--
B.1079 Michael Smith Building
Faculty of Life Sciences
The University of Manchester
Oxford Road
Manchester
M13 9PT
United Kingdom

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Thomas Herchenroeder
Guilherme,

could you try to validate the patch and its performance impact? We won't
be able to get to it for the time being, but if at all it makes sense to
test it while it is still close to the trunk. What do you think?

If you're willing we should talk a bit about the test setup.

Thomas


> That's a good surprise.
> Since the optimization were already done and shown good results, shouldn't
> it be a problem to apply them in the framework, right core developers?
>
> On Sat, Nov 20, 2010 at 4:41 PM, Joachim Baran
> <[hidden email]>wrote:
>
>> Hi!
>>
>> On 20 November 2010 18:27, Stefan Andersson <[hidden email]>
>> wrote:
>> > The bug reported was even closed, see bug:
>> http://bugzilla.qooxdoo.org/show_bug.cgi?id=4122
>>   Sorry to be pedantic, but this is not really a bug, isn't it? It
>> seems more like a very specific software design issue, that just
>> happens to have an impact on the performance of the code.
>>
>> Joachim
>>
>> --
>> B.1079 Michael Smith Building
>> Faculty of Life Sciences
>> The University of Manchester
>> Oxford Road
>> Manchester
>> M13 9PT
>> United Kingdom
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and  rewriting code and more time creating great
>> experiences on the web. Be a part of the beta today
>> http://p.sf.net/sfu/msIE9-sfdev2dev
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev_______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Krycek
Let's see if Stefan is willing to give us the patch :)

On Sun, Nov 21, 2010 at 8:59 AM, thron7 <[hidden email]> wrote:
Guilherme,

could you try to validate the patch and its performance impact? We won't
be able to get to it for the time being, but if at all it makes sense to
test it while it is still close to the trunk. What do you think?

If you're willing we should talk a bit about the test setup.

Thomas


> That's a good surprise.
> Since the optimization were already done and shown good results, shouldn't
> it be a problem to apply them in the framework, right core developers?
>
> On Sat, Nov 20, 2010 at 4:41 PM, Joachim Baran
> <[hidden email]>wrote:
>
>> Hi!
>>
>> On 20 November 2010 18:27, Stefan Andersson <[hidden email]>
>> wrote:
>> > The bug reported was even closed, see bug:
>> http://bugzilla.qooxdoo.org/show_bug.cgi?id=4122
>>   Sorry to be pedantic, but this is not really a bug, isn't it? It
>> seems more like a very specific software design issue, that just
>> happens to have an impact on the performance of the code.
>>
>> Joachim
>>
>> --
>> B.1079 Michael Smith Building
>> Faculty of Life Sciences
>> The University of Manchester
>> Oxford Road
>> Manchester
>> M13 9PT
>> United Kingdom
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and  rewriting code and more time creating great
>> experiences on the web. Be a part of the beta today
>> http://p.sf.net/sfu/msIE9-sfdev2dev
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev_______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>



------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

MartinWittemann
Administrator
In reply to this post by Stefan A
<base href="x-msg://211/">Hello Stefan,

Improvements for a 1000 line custom code application.
--------------------------------------------------------------------------
                         Unoptimized   Optimized   Improvement      
Load runtime:     14352ms       11406ms           21%
Main runtime:         133ms          136ms             0 %
Finalize runtime:       98ms            99ms             0 %

Additionally, execution time has decreased for a 1 million line custom code application by an average of about 19%!!!!!

Sounds interesting. But you are missing some important facts. What browsers did you use? Is it the same for all browsers? 


These were the results of simple micro optimizations we were advised by "someone" a while ago not to spend our time on. 
Very funny! 

I did some research myself and put it into the playground for everyone interested:

What you can see in the code are two pretty simple loops just copying an array. Thats the most simple task i can imagine where you need array access. At least it should be simple enough to measure the real difference of the loop optimization. Using the most simple task we can imagine should show up the most possible speedup because adding more code will only reduce the speedup. Surprisingly the average speed gain I got was about 10% in chrome dev on mac which is somehow strange because you said you got about 20% for all code.

As you can see, I used 1.000.000 items in an array and saved in total about 10 ms... You saved in total 2964 ms which means that you have to run 296.400.000 loops to get that speed up. I wouldn't expect that a big number for just a 1000 lines of code.

Sorry, I'm not buying it. If you got that speedup, there has to be other reasons which I like to know before I apply a patch! 
So maybe you should share the application to test and some more details!

Best,
Martin

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Thomas Herchenroeder
In reply to this post by Krycek


On 11/21/2010 03:50 PM, Guilherme Aiolfi wrote:
> Let's see if Stefan is willing to give us the patch :)

The patch is already there, attached to (reopened) bug#4122.

T.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

oetiker
In reply to this post by MartinWittemann
Hi Martin,

Today Martin Wittemann wrote:

> Hello Stefan,
>
> Improvements for a 1000 line custom code application.
> --------------------------------------------------------------------------
>                          Unoptimized   Optimized   Improvement
> Load runtime:     14352ms       11406ms           21%
> Main runtime:         133ms          136ms             0 %
> Finalize runtime:       98ms            99ms             0 %
>
> Additionally, execution time has decreased for a 1 million line
> custom code application by an average of about 19%!!!!!
>
> Sounds interesting. But you are missing some important facts.
> What browsers did you use? Is it the same for all browsers?
>
>
> These were the results of simple micro optimizations we were
> advised by "someone" a while ago not to spend our time on. Very
> funny!
>
> I did some research myself and put it into the playground for
> everyone interested: http://tinyurl.com/2elb634

I remember someone cautioning to do loop optimizations as they may
become a burden as js engines internal optimizations improve ...
this seems to be happening to me ... just ran your code on chrome
9.0.587.0 dev (linux 64bit intel)

playground.Application[463]: Starting application 'Custom Code' ...
playground.js:32467064381 playground.Application[463]: normal: 151
playground.js:32467064567 playground.Application[463]: optimized: 185
playground.js:32467064568 playground.Application[463]: gain: -18.378378378378372%
playground.js:32467064568 playground.Application[463]: Successfully started.

interesting isn't it ?

cheers
tobi

--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [hidden email] ++41 62 775 9902 / sb: -9900

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Thomas Herchenroeder
yes, but results seem somewhat arbitrary if you re-run the sample a
couple of times. on chromium 6.0.480.0 (linux) i had "gains" between
-50% and +100%, with all kinds of values in between. on a slower browser
(opera 10.11 on linux) it was more stable around +10%. still your
argument holds. do you have a reference for that?

t.

> I remember someone cautioning to do loop optimizations as they may
> become a burden as js engines internal optimizations improve ...
> this seems to be happening to me ... just ran your code on chrome
> 9.0.587.0 dev (linux 64bit intel)
>
> playground.Application[463]: Starting application 'Custom Code' ...
> playground.js:32467064381 playground.Application[463]: normal: 151
> playground.js:32467064567 playground.Application[463]: optimized: 185
> playground.js:32467064568 playground.Application[463]: gain: -18.378378378378372%
> playground.js:32467064568 playground.Application[463]: Successfully started.
>
> interesting isn't it ?
>
> cheers
> tobi
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: So called micro optimizations....someone said so....!!!

Daniel Wagner
Administrator
In reply to this post by oetiker
I can confirm t.'s oberservations:

Running the code in Chrome 9/Linux, I'm seeing a decrease in performance
of somewhere between 15 and 40 percent (this is after reloading the
Playground). If I run the code multiple times in succession, the numbers
vary wildly, between -17 and 35 percent.

In Opera 10.63 on XP it's the same story, except the range is much
wider: From 40% decrease to 175% increase.

IE 6 on Win XP, however, consistently shows a ~17% gain.

Regards,
Daniel


Tobias Oetiker schrieb:

> Hi Martin,
>
> Today Martin Wittemann wrote:
>
>> Hello Stefan,
>>
>> Improvements for a 1000 line custom code application.
>> --------------------------------------------------------------------------
>>                          Unoptimized   Optimized   Improvement
>> Load runtime:     14352ms       11406ms           21%
>> Main runtime:         133ms          136ms             0 %
>> Finalize runtime:       98ms            99ms             0 %
>>
>> Additionally, execution time has decreased for a 1 million line
>> custom code application by an average of about 19%!!!!!
>>
>> Sounds interesting. But you are missing some important facts.
>> What browsers did you use? Is it the same for all browsers?
>>
>>
>> These were the results of simple micro optimizations we were
>> advised by "someone" a while ago not to spend our time on. Very
>> funny!
>>
>> I did some research myself and put it into the playground for
>> everyone interested: http://tinyurl.com/2elb634
>
> I remember someone cautioning to do loop optimizations as they may
> become a burden as js engines internal optimizations improve ...
> this seems to be happening to me ... just ran your code on chrome
> 9.0.587.0 dev (linux 64bit intel)
>
> playground.Application[463]: Starting application 'Custom Code' ...
> playground.js:32467064381 playground.Application[463]: normal: 151
> playground.js:32467064567 playground.Application[463]: optimized: 185
> playground.js:32467064568 playground.Application[463]: gain: -18.378378378378372%
> playground.js:32467064568 playground.Application[463]: Successfully started.
>
> interesting isn't it ?
>
> cheers
> tobi
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel