Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
benchmack: no use internals
  • Loading branch information
bjohansebas authored May 31, 2025
commit bd305a8caf85e954bb6c69d6ec7010db6d3800b8
1 change: 1 addition & 0 deletions benchmark/http/check_invalid_header_char.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
// TODO: benchmark has access to internal modules?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the require be updated to internal/http/common? 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but I’m not really sure if the benchmark has access to the internals or not :)

Copy link
Member

@dario-piotrowicz dario-piotrowicz Jun 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah no.... the benchmarks, as far as I understand it, should be runnable with any build of node, so yeah that's a good point, I don't think it's correct to have a benchmark access internal modules

const _checkInvalidHeaderChar = require('_http_common')._checkInvalidHeaderChar;

const groupedInputs = {
Expand Down
1 change: 1 addition & 0 deletions benchmark/http/check_is_http_token.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common.js');
// TODO: benchmark has access to internal modules?
const _checkIsHttpToken = require('_http_common')._checkIsHttpToken;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't really considered internal modules, fwiw

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that property is not under the http module, so when _http_common stops being a module and becomes internal-only, the benchmark won’t work. That’s why I was asking if it's possible to use internals in the benchmarks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I imagine that the require was supposed to be updated to internal/http/common?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern would be whether or not anyone in userland could be using this, as unlikely as that may be. Should we export this through the regular node:http API to provide an alternative path to them?


const bench = common.createBenchmark(main, {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/http/set_header.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../common.js');
const { OutgoingMessage } = require('_http_outgoing');
const { OutgoingMessage } = require('http');

const bench = common.createBenchmark(main, {
value: [
Expand Down
Loading