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

add linters benchmark #31

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gulp.task('bootstrap', async () => {
})
})

for (let name of ['preprocessors', 'parsers', 'prefixers', 'tokenizers']) {
for (let name of ['preprocessors', 'parsers', 'prefixers', 'tokenizers', 'linters']) {
gulp.task(
name,
gulp.series('bootstrap', () => {
Expand All @@ -47,5 +47,5 @@ for (let name of ['preprocessors', 'parsers', 'prefixers', 'tokenizers']) {

gulp.task(
'default',
gulp.series('preprocessors', 'parsers', 'prefixers', 'tokenizers')
gulp.series('preprocessors', 'parsers', 'prefixers', 'tokenizers', 'linters')
)
52 changes: 52 additions & 0 deletions linters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* Results on Node 19.9.0, GitHub Actions:

PostCSS: 826 ms
*/

let { readFileSync, existsSync } = require('fs')
let stylelint = require("stylelint")
let { join } = require('path')
let postcss = require('postcss')

let example = join(__dirname, 'cache', 'bootstrap.css')
let origin = readFileSync(example).toString()

let css = origin
.replace(/\s+filter:[^;}]+;?/g, '')
.replace('/*# sourceMappingURL=bootstrap.css.map */', '')

// PostCSS
let processor = postcss([stylelint({ config: { "extends": "stylelint-config-standard" } })])

module.exports = {
name: 'Linters',
maxTime: 15,
tests: [
{
name: 'PostCSS',
defer: true,
fn: done => {
processor.process(css, { from: example, map: false }).then(() => {
done.resolve()
})
}
}
]
}

let devPath = join(__dirname, '../postcss/lib/postcss.js')
if (existsSync(devPath)) {
let devPostcss = require(devPath)
let devProcessor = devPostcss([
stylelint({ config: { "extends": "stylelint-config-standard" } })
])
module.exports.tests.splice(1, 0, {
name: 'Next PostCSS',
defer: true,
fn: done => {
devProcessor.process(css, { from: example, map: false }).then(() => {
done.resolve()
})
}
})
}
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,43 @@
"test": "eslint . && gulp"
},
"dependencies": {
"autoprefixer": "^10.4.13",
"browserslist": "^4.21.4",
"css-tree": "^2.3.0",
"autoprefixer": "^10.4.14",
"browserslist": "^4.21.9",
"css-tree": "^2.3.1",
"cssom": "^0.5.0",
"gonzales": "^1.0.7",
"gulp": "^4.0.2",
"gulp-bench": "^1.1.0",
"gulp-bench-summary": "^0.1.0",
"less": "^4.1.3",
"lightningcss": "^1.17.1",
"lightningcss": "^1.21.2",
"mensch": "^0.3.4",
"node-sass": "^8.0.0",
"parserlib": "^1.1.1",
"postcss": "^8.4.20",
"postcss": "^8.4.24",
"postcss-mixins": "^9.0.4",
"postcss-nested": "^6.0.0",
"postcss-selector-parser": "^6.0.11",
"postcss-nested": "^6.0.1",
"postcss-selector-parser": "^6.0.13",
"postcss-simple-vars": "^7.0.1",
"postcss-value-parser": "^4.2.0",
"rework": "^1.0.1",
"sass": "^1.56.2",
"sass": "^1.63.6",
"stylecow-core": "^2.5.0",
"stylecow-plugin-calc": "^2.0.0",
"stylecow-plugin-nested-rules": "^5.0.1",
"stylecow-plugin-prefixes": "^6.0.5",
"stylecow-plugin-variables": "^5.1.4",
"stylis": "^4.1.3",
"stylelint": "^15.9.0",
"stylelint-config-standard": "^33.0.0",
"stylis": "^4.3.0",
"through2": "^4.0.2"
},
"devDependencies": {
"@logux/eslint-config": "^48.0.0",
"eslint": "^8.29.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.6.0",
"eslint": "^8.44.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-prefer-let": "^3.0.1",
"eslint-plugin-promise": "^6.1.1"
},
Expand Down
16 changes: 8 additions & 8 deletions parsers.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* Results on Node 19.2.0, GitHub Actions:
/* Results on Node 19.9.0, GitHub Actions:

Stylis: 14 ms (2.3 times faster)
CSSOM: 22 ms (1.5 times faster)
CSSTree: 31 ms (1.1 times faster)
CSSOM: 25 ms (1.3 times faster)
CSSTree: 32 ms (1.0 times faster)
PostCSS: 33 ms
Mensch: 33 ms (1.0 times slower)
Rework: 51 ms (1.5 times slower)
Stylecow: 66 ms (2.0 times slower)
PostCSS Full: 93 ms (2.8 times slower)
ParserLib: 141 ms (4.2 times slower)
Mensch: 34 ms (1.0 times slower)
Rework: 52 ms (1.6 times slower)
Stylecow: 75 ms (2.3 times slower)
PostCSS Full: 98 ms (3.0 times slower)
Gonzales: 159 ms (4.8 times slower)
ParserLib: 161 ms (4.9 times slower)
*/

let { readFileSync, existsSync } = require('fs')
Expand Down
Loading