-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmark script for measuring performance
This makes it easier to optimize performance in the future. See #167
- Loading branch information
1 parent
e6a5071
commit 280e3c1
Showing
9 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env node | ||
const { performance } = require(`perf_hooks`); | ||
const path = require(`path`); | ||
const sass = require(`node-sass`); | ||
|
||
const magicImporter = require(`../packages/node-sass-magic-importer/dist/index`); | ||
|
||
const start = performance.now(); | ||
|
||
for (let i = 0; i < 100; i += 1) { | ||
sass.renderSync({ | ||
file: `scripts/files/benchmark.scss`, | ||
importer: magicImporter({ | ||
cwd: path.resolve(__dirname, `files`), | ||
}), | ||
}).css.toString(); | ||
} | ||
|
||
const end = performance.now(); | ||
const duration = end - start; | ||
|
||
console.log(`Duration: ${duration}ms`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '~test-package1'; | ||
@import '~test-package2/**/*.scss'; | ||
@import '{ .partial-1-1 as .replaced1 } from partials/_partial*'; | ||
@import '{ .partial-1-2 as .replaced2 } from partials/_partial*'; | ||
@import '{ .partial-1-3 as .replaced3 } from partials/_partial*'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.partial-1-1 { | ||
content: 'Partial 1-1'; | ||
} | ||
|
||
.partial-1-2 { | ||
content: 'Partial 1-2'; | ||
} | ||
|
||
.partial-1-3 { | ||
content: 'Partial 1-3'; | ||
} |