That's true - I will make a test case that doesn't include that function.
The point of using that function was to test not only concat parse but
passing to a usable function - however, i'm sure there are differences in
each browser's console.log, so this kind of bonks the test. The updated test
you made is far better - use that going forward!

========================
Jess Jacobs
aki...@gmail.com
flavors.me/akisma - music, sound design, code.



On Fri, Oct 14, 2011 at 10:47 AM, Andrew Hedges <and...@hedges.name> wrote:

> Hi Jess,
>
> I'm not sure what the purpose of the consumeURL function is if you just
> want to test the speed of
> assigning/concatenating strings. I made a modified test that strips out
> that part of things and adds another test case
> (using join on an array of strings, which, unsurprisingly is way slower in
> this case but can be faster when joining
> many strings).
>
> http://jsperf.com/string-concat-vs-long-lines/2
>
> -----
> and...@hedges.name / http://andrew.hedges.name/
>
> On Sat, October 15, 2011 9:25 am, Jess Jacobs wrote:
> > Hello everyone,
> >
> > I ran into an interesting issue while trying to prove that adding string
> > concats to a long running string simply to fit the "80 char/line" idea
> was
> > not a good thing.
> >
> > http://jsperf.com/string-concat-vs-long-lines
> >
> > I discovered, unless my tests have errors (please call 'em out if so!):
> >
> > 1. string declaration without concats is faster than concatenating two
> > strings (obviously)
> > 2. concatenating string + string is slower than concatenating var (with a
> > string value) + string (interesting)
> > 3. concatenating a var (string value) with a string is FASTER than
> declaring
> > a variable with only a string value (very interesting)
> >
> > The tests are vastly different for each browser, with Safari taking an
> > unbelievable lead in string processing over Chrome. Firefox came in dead
> > last of the three (I didn't test IE, but if someone wants to, I'm
> definitely
> > curious). Some test results differ even in which method is fastest in a
> > particular browser, but not typically by much. While the browser speed
> > differences were surprising to me, what's more surprising is item #3
> above.
> >
> > Items 1 and 2 make a lot of sense to me; 1 being obvious, 2 I'm figuring
> > could be explained by primitive type conversion possibly not having to
> > happen due to one of the concat'd items already being a String object -
> but
> > now that I think about it, aren't they both primitive types since neither
> > were created as new String(), etc? 3, however, blows my mind. How on
> earth
> > is it faster to concat a var and a string and assign it to a var than it
> is
> > to simply assign a string value to a var?
> >
> > I'd really love to get way down to the nitty gritty on this, so anyone
> with
> > any insight, your replies are appreciated. Also would love to see any
> test
> > cases (more robust than mine) that could illustrate better what exactly
> is
> > going on here.
> >
> > Thanks,
> > Jess
> >
> > ========================
> > Jess Jacobs
> > aki...@gmail.com
> > flavors.me/akisma - music, sound design, code.
> >
> > --
> > To view archived discussions from the original JSMentors Mailman list:
> > http://www.mail-archive.com/jsmentors@jsmentors.com/
> >
> > To search via a non-Google archive, visit here:
> http://www.mail-archive.com/jsmentors@googlegroups.com/
> >
> > To unsubscribe from this group, send email to
> > jsmentors+unsubscr...@googlegroups.com
> >
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/jsmentors@jsmentors.com/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/jsmentors@googlegroups.com/
>
> To unsubscribe from this group, send email to
> jsmentors+unsubscr...@googlegroups.com
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to