Skip to content

Commit

Permalink
feat: add Math.floor vs ~
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelGSS committed Jul 17, 2024
1 parent 8775d34 commit 7c61559
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/run_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
node-versions:
required: true
type: string
default: '["18.0.0","18.20.2","18.20.3","20.0.0","20.13.1","20.14.0","21.0.0","21.7.2","21.7.3","22.0.0","22.1.0","22.2.0"]'
default: '["18.0.0","18.20.3","18.20.4","20.0.0","20.15.0","20.15.1","21.0.0","21.7.2","21.7.3","22.0.0","22.4.0","22.4.1"]'
description: 'The Node.js Versions (should be a JSON array)'

permissions:
Expand Down Expand Up @@ -170,8 +170,17 @@ jobs:
node-versions: ${{ inputs.node-versions }}
run-start-stop: false

object-creation:
math-floor-vs-tilde:
needs: last-array-item
name: Running "math-floor-vs-tilde.mjs"
uses: ./.github/workflows/bench.yml
with:
bench-file: math-floor-vs-tilde.mjs
node-versions: ${{ inputs.node-versions }}
run-start-stop: false

object-creation:
needs: math-floor-vs-tilde
name: Running "object-creation.mjs"
uses: ./.github/workflows/bench.yml
with:
Expand Down
19 changes: 19 additions & 0 deletions bench/math-floor-vs-tilde.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createBenchmarkSuite } from '../common.mjs'

const suite = createBenchmarkSuite('Math.floor vs ~')

suite
.add('Math.floor (small)', function () {
return Math.floor(15.95)
})
.add('~ (small)', function () {
return ~15.95
})
.add('Math.floor (long)', function () {
return Math.floor(15.95231232132132)
})
.add('~ (long)', function () {
return ~15.95231232132132
})

await suite.runAndPrintResults()

0 comments on commit 7c61559

Please sign in to comment.