Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-35734

Prototype mutation warning: very slow code

    Details

    • Similar Issues:
    • Epic Link:

      Description

      When running latest on firefox, there is a warning:

      mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
      

      which refers to a code snippet:

      function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
      

      This should be fixed (not clear if happening in chrome)

        Attachments

          Activity

          Hide
          michaelneale Michael Neale added a comment -

          Thorsten Scherler Keith Zantow you may have seen this before?

          Show
          michaelneale Michael Neale added a comment - Thorsten Scherler Keith Zantow you may have seen this before?
          Hide
          sophistifunk Josh McDonald added a comment -

          This is a helper inserted by Babel. Not sure if the warning is new to FF, or Babel used to do something else tho.

          What it does show is that these helpers are being added to every file, when we should be externalising it.

          I think we need either this: https://babeljs.io/docs/usage/polyfill/ or this: http://babeljs.io/docs/plugins/external-helpers/ – possibly both.

          If I get a chance I'll look into this more this afternoon, if not at least there's some info on the ticket

          Show
          sophistifunk Josh McDonald added a comment - This is a helper inserted by Babel. Not sure if the warning is new to FF, or Babel used to do something else tho. What it does show is that these helpers are being added to every file, when we should be externalising it. I think we need either this: https://babeljs.io/docs/usage/polyfill/ or this: http://babeljs.io/docs/plugins/external-helpers/ – possibly both. If I get a chance I'll look into this more this afternoon, if not at least there's some info on the ticket
          Hide
          sophistifunk Josh McDonald added a comment -

          Or maybe this is what we need? https://babeljs.io/docs/plugins/transform-runtime/

          No, I don't know why there are three. What I do know is I should've gone into carpentry :"(

          Show
          sophistifunk Josh McDonald added a comment - Or maybe this is what we need? https://babeljs.io/docs/plugins/transform-runtime/ No, I don't know why there are three. What I do know is I should've gone into carpentry :"(
          Hide
          michaelneale Michael Neale added a comment -

          hrm maybe up in Tom FENNELLY's wheelhouse. This only seems to happen on firefox.

          Show
          michaelneale Michael Neale added a comment - hrm maybe up in Tom FENNELLY 's wheelhouse. This only seems to happen on firefox.
          Hide
          tfennelly Tom FENNELLY added a comment -

          No idea off the top of my head ... would need to debug it.

          Show
          tfennelly Tom FENNELLY added a comment - No idea off the top of my head ... would need to debug it.
          Hide
          tfennelly Tom FENNELLY added a comment -

          Yeah, I do know what this is now. It's coming from code generated by babel. I don't see any way for us to fix this directly.

          Show
          tfennelly Tom FENNELLY added a comment - Yeah, I do know what this is now. It's coming from code generated by babel. I don't see any way for us to fix this directly.
          Hide
          michaelneale Michael Neale added a comment - - edited

          Tom FENNELLY ugh. yes. Just googled and there is an endless series of finger pointing and blaming of babel.

          Oh wait, babel blames core-js: https://phabricator.babeljs.io/T1099 - after googling around a bit, really not impressed with the babel project.

          It seems it is to do with how babel "transpiles" classes for firefox. I guess my question would be if we can have it target certain browsers without transpiling that can run ES6 natively (which would be firefox?)

          https://github.com/zenorocha/clipboard.js/issues/141
          Babels transpilling: https://github.com/react-bootstrap/react-bootstrap/issues/550 (complete with 404'ing issue to babel that they creatively deleted).

          This one claims if you inherit from something built in, you will get this:
          http://stackoverflow.com/questions/33858349/fixing-mutating-the-prototype-of-an-object-in-babeljs-6
          this seems possibly plausible in our case? (although odd chrome doesn't complain).

          It goes on:
          https://github.com/zloirock/core-js/issues/46
          (this one implies might be ignorable).

          I think we can park this unless we see specific issues with firefox.

          Show
          michaelneale Michael Neale added a comment - - edited Tom FENNELLY ugh. yes. Just googled and there is an endless series of finger pointing and blaming of babel. Oh wait, babel blames core-js: https://phabricator.babeljs.io/T1099 - after googling around a bit, really not impressed with the babel project. It seems it is to do with how babel "transpiles" classes for firefox. I guess my question would be if we can have it target certain browsers without transpiling that can run ES6 natively (which would be firefox?) https://github.com/zenorocha/clipboard.js/issues/141 Babels transpilling: https://github.com/react-bootstrap/react-bootstrap/issues/550 (complete with 404'ing issue to babel that they creatively deleted). This one claims if you inherit from something built in, you will get this: http://stackoverflow.com/questions/33858349/fixing-mutating-the-prototype-of-an-object-in-babeljs-6 this seems possibly plausible in our case? (although odd chrome doesn't complain). It goes on: https://github.com/zloirock/core-js/issues/46 (this one implies might be ignorable). I think we can park this unless we see specific issues with firefox.
          Hide
          jamesdumay James Dumay added a comment -

          Looks like this is a babel issue rather than ours.

          Show
          jamesdumay James Dumay added a comment - Looks like this is a babel issue rather than ours.

            People

            • Assignee:
              tfennelly Tom FENNELLY
              Reporter:
              jamesdumay James Dumay
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: