GithubHelp home page GithubHelp logo

Support ES6 modules about benchpress HOT 2 CLOSED

tbosch avatar tbosch commented on August 21, 2024
Support ES6 modules

from benchpress.

Comments (2)

jeffbcross avatar jeffbcross commented on August 21, 2024
Usecase: benchmarks are ES6 modules that are loaded asynchronously and therefore cannot add entries to the global window.benchmarkSteps.

Benchpress doesn't care about the steps until a user starts sampling. There should never be a case where the bp.steps list (aka window.benchmarkSteps) is not available to a script, regardless of loading sync or async. This would just leave a slight possibility that someone could start sampling before all scripts are loaded.

This being the case, couldn't the benchmark that uses ES6 just load the es6-module-loader polyfill in the scripts list before any transpiled ES5 modules? Or am I missing something?

from benchpress.

tbosch avatar tbosch commented on August 21, 2024

Yes, you are right. So for using ES6 modules with benchpress we can do the following:

Create a run.js file that is included into the scripts array of the benchpress configuration file that does the following:

System.paths = ... ;
System.import('di/injector_benchmark').then((bm) => {
  window.benchmarkSteps.push({
    name: 'DynamicInjector',
    fn: function() { bm.run(); }
});

Also, all needed polyfills (e.g. traceur runtime and es6 module loader) need to be added to the scripts array of the benchpress configuration file as well.

Closing.

from benchpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.