Skip to content

Commit

Permalink
bench: Call gc before loop
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Jun 8, 2021
1 parent 1edc33c commit 11bc290
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/Test.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Run
run: |
export TZ="Europe/Tallinn"
c8 node --allow-natives-syntax -r ./test.js test/index.js --brief
c8 node --allow-natives-syntax --expose-gc -r ./test.js test/index.js --brief
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
2 changes: 2 additions & 0 deletions bench.js
Expand Up @@ -55,6 +55,8 @@ function measure(fn, time, next) {
var i, hr
, count = 0
, ms = 0
/* c8 ignore next */
if (global.gc) global.gc()
for (; ms < time; ) {
count++
hr = process.hrtime()
Expand Down
1 change: 1 addition & 0 deletions snapshot.js
Expand Up @@ -34,6 +34,7 @@ describe.assert.matchSnapshot = function(file, transform) {
input: actual,
encoding: "utf8"
})
/* c8 ignore next */
} catch(e) {
return this(0, e.stdout ?
"Snapshot " + file + "\n---\n" + e.stdout :
Expand Down

0 comments on commit 11bc290

Please sign in to comment.