Skip to content

Commit

Permalink
Merge branch 'main' into wpt-timeout-as-failure
Browse files Browse the repository at this point in the history
  • Loading branch information
rossilor95 authored Feb 6, 2024
2 parents 6058d42 + d5ad466 commit 3957a58
Show file tree
Hide file tree
Showing 207 changed files with 1,315 additions and 904 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v2.3.3
uses: github/codeql-action/init@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v2.3.3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -60,7 +60,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v2.3.3
uses: github/codeql-action/autobuild@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v2.3.3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -73,6 +73,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v2.3.3
uses: github/codeql-action/analyze@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v2.3.3
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: 'Dependency Review'
uses: actions/dependency-review-action@6c5ccdad469c9f8a2996bfecaec55a631a347034 # v3.1.0
uses: actions/dependency-review-action@4901385134134e04cec5fbe5ddfe3b2c5bd5d976 # v4.0.0
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
timeout-minutes: 15
post-test-steps: |
- name: Coverage Report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
automerge:
if: >
github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@012739e5082ff0c22ca6d6ab32e07c36df03c4a4 # v3.22.12
uses: github/codeql-action/upload-sarif@b7bf0a3ed3ecfa44160715d7c442788f65f0f923 # v3.23.2
with:
sarif_file: results.sarif
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* [Test](#test)
* [Coverage](#coverage)
* [Update `WPTs`](#update-wpts)
* [Building for externally shared node builtins](#external-builds)
* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin)
* [Moderation Policy](#moderation-policy)

Expand Down Expand Up @@ -165,6 +166,15 @@ npm run test
npm run coverage
```

<a id="external-builds"></a>
### Building for externally shared node builtins

If you are packaging `undici` for a distro, this might help if you would like to use
an unbundled version instead of bundling one in `libnode.so`.

To enable this, pass `EXTERNAL_PATH=/path/to/global/node_modules/undici` to `build/wasm.js`.
You shall also pass this path to `--shared-builtin-undici/undici-path` in Node.js's `configure.py`.

<a id="developers-certificate-of-origin"></a>
## Developer's Certificate of Origin 1.1

Expand Down
73 changes: 23 additions & 50 deletions benchmarks/benchmark-http2.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict'

const { connect } = require('http2')
const { createSecureContext } = require('tls')
const os = require('os')
const path = require('path')
const { readFileSync } = require('fs')
const { table } = require('table')
const { Writable } = require('stream')
const { isMainThread } = require('worker_threads')
const { connect } = require('node:http2')
const { createSecureContext } = require('node:tls')
const os = require('node:os')
const path = require('node:path')
const { readFileSync } = require('node:fs')
const { Writable } = require('node:stream')
const { isMainThread } = require('node:worker_threads')

const { Pool, Client, fetch, Agent, setGlobalDispatcher } = require('..')

Expand Down Expand Up @@ -126,7 +125,13 @@ function printResults (results) {
.sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean))
.map(([name, result]) => {
if (!result.success) {
return [name, result.size, 'Errored', 'N/A', 'N/A']
return {
Tests: name,
Samples: result.size,
Result: 'Errored',
Tolerance: 'N/A',
'Difference with Slowest': 'N/A'
}
}

// Calculate throughput and relative performance
Expand All @@ -138,48 +143,16 @@ function printResults (results) {
last = mean
}

return [
name,
size,
`${((connections * 1e9) / mean).toFixed(2)} req/sec`,
${((standardError / mean) * 100).toFixed(2)} %`,
relative > 0 ? `+ ${relative.toFixed(2)} %` : '-'
]
return {
Tests: name,
Samples: size,
Result: `${((connections * 1e9) / mean).toFixed(2)} req/sec`,
Tolerance: ${((standardError / mean) * 100).toFixed(2)} %`,
'Difference with slowest': relative > 0 ? `+ ${relative.toFixed(2)} %` : '-'
}
})

console.log(results)

// Add the header row
rows.unshift(['Tests', 'Samples', 'Result', 'Tolerance', 'Difference with slowest'])

return table(rows, {
columns: {
0: {
alignment: 'left'
},
1: {
alignment: 'right'
},
2: {
alignment: 'right'
},
3: {
alignment: 'right'
},
4: {
alignment: 'right'
}
},
drawHorizontalLine: (index, size) => index > 0 && index < size,
border: {
bodyLeft: '│',
bodyRight: '│',
bodyJoin: '│',
joinLeft: '|',
joinRight: '|',
joinJoin: '|'
}
})
return console.table(rows)
}

const experiments = {
Expand Down Expand Up @@ -292,7 +265,7 @@ async function main () {
throw err
}

console.log(printResults(results))
printResults(results)
dispatcher.destroy()
}
)
Expand Down
71 changes: 22 additions & 49 deletions benchmarks/benchmark-https.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
'use strict'

const https = require('https')
const os = require('os')
const path = require('path')
const { readFileSync } = require('fs')
const { table } = require('table')
const { Writable } = require('stream')
const { isMainThread } = require('worker_threads')
const https = require('node:https')
const os = require('node:os')
const path = require('node:path')
const { readFileSync } = require('node:fs')
const { Writable } = require('node:stream')
const { isMainThread } = require('node:worker_threads')

const { Pool, Client, fetch, Agent, setGlobalDispatcher } = require('..')

Expand Down Expand Up @@ -140,7 +139,13 @@ function printResults (results) {
.sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean))
.map(([name, result]) => {
if (!result.success) {
return [name, result.size, 'Errored', 'N/A', 'N/A']
return {
Tests: name,
Samples: result.size,
Result: 'Errored',
Tolerance: 'N/A',
'Difference with Slowest': 'N/A'
}
}

// Calculate throughput and relative performance
Expand All @@ -152,48 +157,16 @@ function printResults (results) {
last = mean
}

return [
name,
size,
`${((connections * 1e9) / mean).toFixed(2)} req/sec`,
${((standardError / mean) * 100).toFixed(2)} %`,
relative > 0 ? `+ ${relative.toFixed(2)} %` : '-'
]
return {
Tests: name,
Samples: size,
Result: `${((connections * 1e9) / mean).toFixed(2)} req/sec`,
Tolerance: ${((standardError / mean) * 100).toFixed(2)} %`,
'Difference with slowest': relative > 0 ? `+ ${relative.toFixed(2)} %` : '-'
}
})

console.log(results)

// Add the header row
rows.unshift(['Tests', 'Samples', 'Result', 'Tolerance', 'Difference with slowest'])

return table(rows, {
columns: {
0: {
alignment: 'left'
},
1: {
alignment: 'right'
},
2: {
alignment: 'right'
},
3: {
alignment: 'right'
},
4: {
alignment: 'right'
}
},
drawHorizontalLine: (index, size) => index > 0 && index < size,
border: {
bodyLeft: '│',
bodyRight: '│',
bodyJoin: '│',
joinLeft: '|',
joinRight: '|',
joinJoin: '|'
}
})
return console.table(rows)
}

const experiments = {
Expand Down Expand Up @@ -305,7 +278,7 @@ async function main () {
throw err
}

console.log(printResults(results))
printResults(results)
dispatcher.destroy()
}
)
Expand Down
71 changes: 22 additions & 49 deletions benchmarks/benchmark.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
'use strict'

const http = require('http')
const os = require('os')
const path = require('path')
const { table } = require('table')
const { Writable } = require('stream')
const { isMainThread } = require('worker_threads')
const http = require('node:http')
const os = require('node:os')
const path = require('node:path')
const { Writable } = require('node:stream')
const { isMainThread } = require('node:worker_threads')

const { Pool, Client, fetch, Agent, setGlobalDispatcher } = require('..')

let nodeFetch
const axios = require('axios')
let got

const util = require('util')
const util = require('node:util')
const _request = require('request')
const request = util.promisify(_request)

Expand Down Expand Up @@ -149,7 +148,13 @@ function printResults (results) {
.sort((a, b) => (!a[1].success ? -1 : b[1].mean - a[1].mean))
.map(([name, result]) => {
if (!result.success) {
return [name, result.size, 'Errored', 'N/A', 'N/A']
return {
Tests: name,
Samples: result.size,
Result: 'Errored',
Tolerance: 'N/A',
'Difference with Slowest': 'N/A'
}
}

// Calculate throughput and relative performance
Expand All @@ -161,48 +166,16 @@ function printResults (results) {
last = mean
}

return [
name,
size,
`${((connections * 1e9) / mean).toFixed(2)} req/sec`,
${((standardError / mean) * 100).toFixed(2)} %`,
relative > 0 ? `+ ${relative.toFixed(2)} %` : '-'
]
return {
Tests: name,
Samples: size,
Result: `${((connections * 1e9) / mean).toFixed(2)} req/sec`,
Tolerance: ${((standardError / mean) * 100).toFixed(2)} %`,
'Difference with slowest': relative > 0 ? `+ ${relative.toFixed(2)} %` : '-'
}
})

console.log(results)

// Add the header row
rows.unshift(['Tests', 'Samples', 'Result', 'Tolerance', 'Difference with slowest'])

return table(rows, {
columns: {
0: {
alignment: 'left'
},
1: {
alignment: 'right'
},
2: {
alignment: 'right'
},
3: {
alignment: 'right'
},
4: {
alignment: 'right'
}
},
drawHorizontalLine: (index, size) => index > 0 && index < size,
border: {
bodyLeft: '│',
bodyRight: '│',
bodyJoin: '│',
joinLeft: '|',
joinRight: '|',
joinJoin: '|'
}
})
return console.table(rows)
}

const experiments = {
Expand Down Expand Up @@ -366,7 +339,7 @@ async function main () {
throw err
}

console.log(printResults(results))
printResults(results)
dispatcher.destroy()
}
)
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/server-http2.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

const { unlinkSync, readFileSync } = require('fs')
const { createSecureServer } = require('http2')
const os = require('os')
const path = require('path')
const cluster = require('cluster')
const { unlinkSync, readFileSync } = require('node:fs')
const { createSecureServer } = require('node:http2')
const os = require('node:os')
const path = require('node:path')
const cluster = require('node:cluster')

const key = readFileSync(path.join(__dirname, '..', 'test', 'fixtures', 'key.pem'), 'utf8')
const cert = readFileSync(path.join(__dirname, '..', 'test', 'fixtures', 'cert.pem'), 'utf8')
Expand Down
Loading

0 comments on commit 3957a58

Please sign in to comment.