Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26309

Re: jquery and hoi polloi

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: jquery and hoi polloi
Date 2014-12-11 03:16 +0100
Organization solani.org
Message-ID <m6aupe$esl$1@solani.org> (permalink)
References <svOdnVxF-e8OrePJnZ2dnUVZ8q2dnZ2d@westnet.com.au> <3e25f0fa-4c3f-4d51-a6a0-da69bd8b3677@googlegroups.com> <27938323-9eca-480c-8ead-2000865bcecc@googlegroups.com> <82684c28-b567-4b2c-8d2b-eb0c41376cd2@googlegroups.com>

Show all headers | View raw


RobG wrote:

> Yes, jQuery isn't so bad for performance if used judiciously.

However, there are some cases where the perfomance of jQuery is really
bad.  These cases might not be relevant for the overall performance, but
nonetheless I won't call avoiding them micro-optimizations.  See for
instance <http://jsperf.com/document-getelementbyid-vs-jquery/3>.
What's wrong with using document.getElementById()?

> However, because many who use it have no idea what it's doing, they
> don't understand the performance risk until it becomes an issue.
> Often it's the result of using selectors based on complex DOM
> structures, fixing that later means virtually re-writing the
> application.

From my limited experience, not seldom it's just the matter of repeating
yourself.  Apparently, jQuery enforces this technique.  For instance:

  $(".foo .bar .baz").do_something();
  // ...
  $(".foo .bar .baz").do_something_else();

instead of:

  var elems = $(".foo .bar .baz");
  elems.do_something();
  // ...
  elems.do_something_else();

(I'm aware that the two snippets are not necessarily equivalent, but too
often they are.)

> Also, the mantra of "do more with less" doesn't necessarily deliver.
> Many seem to think that if they use jQuery, the equivalent POJS must
> be more code when likely it isn't.

"POJS"?  Plain old JavaScript?

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

jquery and hoi polloi Andrew Poulos <ap_prog@hotmail.com> - 2014-12-03 08:30 +1100
  Re: jquery and hoi polloi "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-02 23:33 +0100
    Re: jquery and hoi polloi "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-12-04 21:46 -0800
      Re: jquery and hoi polloi "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-10 00:47 +0100
  Re: jquery and hoi polloi danca <cyberdanny@tiscalinet.it> - 2014-12-03 00:14 +0100
  Re: jquery and hoi polloi Erwin Moller <erwinmollerusenet@xs4all.nl> - 2014-12-03 14:47 +0100
  Re: jquery and hoi polloi Gregor Kofler <usenet@gregorkofler.com> - 2014-12-03 16:44 +0100
    Re: jquery and hoi polloi Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-12-04 22:06 +0100
  Re: jquery and hoi polloi RobG <rgqld@iinet.net.au> - 2014-12-08 18:39 -0800
    Re: jquery and hoi polloi Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-12-09 13:23 -0800
      Re: jquery and hoi polloi RobG <rgqld@iinet.net.au> - 2014-12-10 17:00 -0800
        Re: jquery and hoi polloi "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-11 03:16 +0100
          Re: jquery and hoi polloi RobG <rgqld@iinet.net.au> - 2014-12-10 18:37 -0800
          Re: jquery and hoi polloi Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2014-12-11 11:08 -0800
            Re: jquery and hoi polloi "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-12-11 22:52 +0100
  Re: jquery and hoi polloi Scott Sauyet <scott.sauyet@gmail.com> - 2014-12-16 12:56 -0800

csiph-web