Git Product home page Git Product logo

benchmark-2's Introduction

Benchmark

Benchmarks performance for both browser and native styled-components. Also benchmarks cssta.

To benchmark,

npm install
npm start

Adding a Test

Under tests, there are files for each platform we test: currently browser and native. Each platform test file has a default export of an object whose keys are the test names. The values are objects keyed by the project name (currently styled or cssta), and the values of these objects are test functions. You do not need to add tests for every project.

export default {
  'test name': {
    styled: () => {
      /* Test function body */
    }
  }
}

Tests are usually formed by creating a component, and running it through react-test-renderer.

const Component = styled.div`
  color: ${props => props.color};
`;

const instance = render(<Component color="black" />);
instance.update(<Component color="red" />);

All tests are compiled using webpack. React uses production-mode optimisations, and the output is minified. Cssta also has production-mode optimisations.

Tests are benchmarked using Benchmark.js, so are run multiple times. If your test uses a global cache, you should clear the cache before running it.

benchmark-2's People

Contributors

quantizor avatar jacobp100 avatar mxstbr avatar

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.