Loading ...
Sorry, an error occurred while loading the content.

Re: [jslint] Re: Save and restore jslint settings

Expand Messages
  • Aseem Kishore
    Fair enough. If you can think of a better way to test this, let me know. I m all for finding a more efficient alternative. =) Aseem ... [Non-text portions of
    Message 1 of 13 , Sep 4, 2009
    • 0 Attachment
      Fair enough. If you can think of a better way to test this, let me know. I'm
      all for finding a more efficient alternative. =)
      Aseem

      On Fri, Sep 4, 2009 at 9:36 AM, Stefan Weiss <weiss@...> wrote:

      >
      >
      > On 04/09/09 18:10, aseem.kishore@... <aseem.kishore%40ymail.com>wrote:
      > > For curiosity's sake, I did some testing between bit-shifting and
      > > regular math, and it seems bit-shifting is in fact faster for the
      > > cases I use.
      > >
      > > Using these two functions, with i going from 0 to 50000:
      > >
      > > function pow2BitShifting(i) {
      > > var x = 1 << (i % 30);
      > > }
      > >
      > > function pow2RegularMath(i) {
      > > var x = Math.pow(2, (i % 30));
      > > }
      >
      > That's not really a fair comparison. The second function has to do a
      > lookup for 'Math', find its 'pow' property, and execute a method call to
      > Math.pow.
      >
      > So yes, in this case, bit shifting is faster than a call to Math.pow
      > with base 2, but that doesn't prove that the bit operations themselves
      > are handled efficiently in JS.
      >
      > cheers,
      > stefan
      >
      >


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.