Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Efficient Christmas to everyone (http://www.velocityreviews.com/forums/t940182-efficient-christmas-to-everyone.html)

optimistx 12-23-2009 12:19 PM

Efficient Christmas to everyone
 
As an exercise a wrote a little js-program to generate statistical data
with random number generators, not much dom-manipulation.

I tried to write the program so that I would now and later
understand what the program tries to do. Simple coding,
short methods, no optimizing for speed or 'efficiency'.

It was fun to write code especially when sometimes I understood
what I was doing.

Examples of the relative execution times were:

ie7 : 27,7 seconds
ff3.5.5: 2,3 seconds
chrome: 0,7 seconds

After that I started to make the program 'efficient' by following some
of the advice I had got (sources censored). The program became
more difficult to read, uglier, longer, more error prone.

But I succeeded to save 0.001 seconds from the execution time.


I felt a real hero. Happy to spend an efficient Christmas now.

Efficient Christmas to everyone. Try to squeeze it 0.1 seconds shorter.

David Mark 12-23-2009 04:25 PM

Re: Efficient Christmas to everyone
 
On Dec 23, 7:19*am, "optimistx" <optimi...@hotmail.com> wrote:
> As an exercise a wrote a little js-program to generate statistical data
> with random number generators, not much dom-manipulation.
>
> I tried to write the program so that I would now and later
> understand what the program tries to do. Simple coding,
> short methods, no optimizing for speed or 'efficiency'.
>
> It was fun to write code especially when sometimes I understood
> what I was doing.
>
> Examples of the relative execution times were:
>
> ie7 : *27,7 seconds
> ff3.5.5: *2,3 seconds
> chrome: * 0,7 seconds
>
> After that I started to make the program 'efficient' by following some
> of the advice I had got (sources censored). *The program became
> more difficult to read, uglier, longer, more error prone.


What program? Who told you to make it more "efficient". Sounds like
diminishing returns in this case (and you clearly made a mess doing
it). Always consider the context before applying general advice. ;)

>
> But I succeeded to save 0.001 seconds from the execution time.


What a waste of time (unless you were going to loop through this code
a million times). :)

>
> I felt a real hero. Happy to spend an efficient Christmas now.


Smart-ass doesn't suit you. ;)

>
> Efficient Christmas to everyone. Try to squeeze it 0.1 seconds shorter.


Same.

JR 12-24-2009 04:14 AM

Re: Efficient Christmas to everyone
 
On 23 dez, 10:19, "optimistx" <optimi...@hotmail.com> wrote:
> As an exercise a wrote a little js-program to generate statistical data
> with random number generators, not much dom-manipulation.
>
> I tried to write the program so that I would now and later
> understand what the program tries to do. Simple coding,
> short methods, no optimizing for speed or 'efficiency'.
>
> It was fun to write code especially when sometimes I understood
> what I was doing.
>
> Examples of the relative execution times were:
>
> ie7 : *27,7 seconds
> ff3.5.5: *2,3 seconds
> chrome: * 0,7 seconds
>
> After that I started to make the program 'efficient' by following some
> of the advice I had got (sources censored). *The program became
> more difficult to read, uglier, longer, more error prone.
>
> But I succeeded to save 0.001 seconds from the execution time.
>
> I felt a real hero. Happy to spend an efficient Christmas now.
>
> Efficient Christmas to everyone. Try to squeeze it 0.1 seconds shorter.


Man, after drinking 2 or 3 pints of a good lager, relaxing at the
Copacabana beach and staring all those gorgeous girls wearing tiny
bikinis, I still can't understand what you're saying... Anyway, I wish
you and everybody at c.l.js a very merry Christmas and a brilliant and
"optimistic" 2010!!! I hope all of us can get more efficient everyday,
enjoying life and our families and dear friends as we do here with
Javascript.

Cheers and all the best,
Joao Rodrigues (JR)

AaronNGray 12-24-2009 12:45 PM

Re: Efficient Christmas to everyone
 
On 24 Dec, 04:14, JR <groups_j...@yahoo.com.br> wrote:
> On 23 dez, 10:19, "optimistx" <optimi...@hotmail.com> wrote:
>
>
>
> > As an exercise a wrote a little js-program to generate statistical data
> > with random number generators, not much dom-manipulation.

>
> > I tried to write the program so that I would now and later
> > understand what the program tries to do. Simple coding,
> > short methods, no optimizing for speed or 'efficiency'.

>
> > It was fun to write code especially when sometimes I understood
> > what I was doing.

>
> > Examples of the relative execution times were:

>
> > ie7 : *27,7 seconds
> > ff3.5.5: *2,3 seconds
> > chrome: * 0,7 seconds

>
> > After that I started to make the program 'efficient' by following some
> > of the advice I had got (sources censored). *The program became
> > more difficult to read, uglier, longer, more error prone.

>
> > But I succeeded to save 0.001 seconds from the execution time.

>
> > I felt a real hero. Happy to spend an efficient Christmas now.

>
> > Efficient Christmas to everyone. Try to squeeze it 0.1 seconds shorter.


Coor I nearly hit the SPAM button.

HC,

Aaron


Dr J R Stockton 12-24-2009 10:10 PM

Re: Efficient Christmas to everyone
 
In comp.lang.javascript message <4b320acc$0$6296$9b536df3@news.fv.fi>,
Wed, 23 Dec 2009 14:19:30, optimistx <optimistx@hotmail.com> posted:

>As an exercise a wrote a little js-program to generate statistical data
>with random number generators, not much dom-manipulation.


Its a pity that DM apparently did not read that paragraph before
responding.

If you ever actually use the results, be aware that Math.random is
generally not as good as it should be, and in at least one browser
substantially worse. It probably will not matter, but you need to be
sure of that.

<URL:http://www.merlyn.demon.co.uk/js-262-5.htm> refers.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE7 FF3 Op9 Sf3
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

David Mark 12-24-2009 11:53 PM

Re: Efficient Christmas to everyone
 
On Dec 24, 5:10*pm, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
wrote:
> In comp.lang.javascript message <4b320acc$0$6296$9b536...@news.fv.fi>,
> Wed, 23 Dec 2009 14:19:30, optimistx <optimi...@hotmail.com> posted:
>
> >As an exercise a wrote a little js-program to generate statistical data
> >with random number generators, not much dom-manipulation.

>
> Its a pity that DM apparently did not read that paragraph before
> responding.


Its (sic) a pity you apparently did not read my response before
responding. :)

>
> If you ever actually use the results, be aware that Math.random is
> generally not as good as it should be, and in at least one browser
> substantially worse. *It probably will not matter, but you need to be
> sure of that.


So? It wasn't a question. Did you skip the OP as well?


All times are GMT. The time now is 10:19 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.