Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: plugin adds 150-200ms to ESLint startup time because of ramda #213

Closed
victor-homyakov opened this issue Oct 3, 2019 · 3 comments

Comments

@victor-homyakov
Copy link

victor-homyakov commented Oct 3, 2019

ESLint is frequently used in pre-commit hooks. Just adding eslint-mocha-plugin makes linting and commiting noticeably slower even when there is nothing to lint.

Steps to reproduce

  1. Create clean new folder
  2. Install npm i eslint-mocha-plugin
  3. Create script and execute it in Node.js:
const label = 'require plugin';
console.time(label);
const plugin = require('eslint-plugin-mocha');
console.timeEnd(label);

On MacBook Pro with 2,7 GHz Intel Core i5 it gives me 150-200 ms. In other words, just adding this plugin slows startup of ESLint by 150-200ms.

The problem is in require('ramda') - loading ramda module requires that much time. It's OK for long-running applications, but for command-line utilities it is inappropriately slow.

Is it possible to speedup startup time of plugin by rewriting the code without ramda?

@lo1tuma
Copy link
Owner

lo1tuma commented Oct 4, 2019

What makes you think this is caused by ramda? On my machine it takes ~170ms for requiring eslint-plugin-mocha, but only ~70ms for requiring ramda.

@lo1tuma
Copy link
Owner

lo1tuma commented Oct 4, 2019

I’ve made some optimizations in #214. I think it is not related to the CPU speed, but rather to I/O speed. The ramda entrypoint file does ~250 require calls.

@victor-homyakov
Copy link
Author

What makes you think this is caused by ramda?

  1. I profiled requiring index.js - most of the time was spent on require('./lib/rules/no-exclusive-tests')
  2. Most of the time in no-exclusive-tests.js was spent on const astUtils = require('../util/ast');
  3. Profiling ast utils pointed me to line const R = require('ramda');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants