News for hackers. Stuff that matters.
Re:V8 Optimization Killers by Nitramp on Wednesday June 25, 2014 @06:37PM (#7947155)
Not if the function is inlineable or an intrinsic (console.log will likely be either), which is the most basic trick of any JIT.

Unless you can specifically measure caching the length is faster, I wouldn't do it. Most of the time it doesn't matter anyway (won't cause a bump in performance), and even then most of the time the compiler will be able to figure it out for you.

Re:V8 Optimization Killers by jkrems on Thursday June 26, 2014 @01:18AM (#7948237)
Maybe my comment was misleading - the important part is the property read, not the `console.log`. The following code might be an infinite loop in JavaScript:

  function adder(arr, obj) {
    for (var i = 0; i < arr.length; ++i) {
      obj.x += i;
    }
  }

  var arr = [1];
  var obj = Object.defineProperties({}, {
    x: {
      get: function() { return 1; },
      set: function(v) { arr.push(v); }
    }
  };
  adder(arr, obj);
Re:V8 Optimization Killers by esailija on Thursday June 26, 2014 @03:58AM (#7948557)
V8 can inline getters and setters like it can inline normal functios.