Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ec60639

Browse filesBrowse files
joyeecheungtargos
authored andcommitted
lib: remove unnecessary refreshHrtimeBuffer()
We now serialize/deseialize the hrtime buffers properly instead of throwing them away at serialization and creating new ones at pre-execution, so there is no need to reset the variables to the binding property at pre-execution time. PR-URL: #51446 Refs: #48655 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jithil P Ponnan <jithil@outlook.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
1 parent 129d3b3 commit ec60639
Copy full SHA for ec60639

File tree

Expand file treeCollapse file tree

2 files changed

+7
-18
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-18
lines changed
Open diff view settings
Collapse file

‎lib/internal/process/per_thread.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/per_thread.js
+7-16Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,13 @@ const { exitCodes: { kNoFailure } } = internalBinding('errors');
5757

5858
const binding = internalBinding('process_methods');
5959

60-
let hrValues;
61-
let hrBigintValues;
62-
63-
function refreshHrtimeBuffer() {
64-
// The 3 entries filled in by the original process.hrtime contains
65-
// the upper/lower 32 bits of the second part of the value,
66-
// and the remaining nanoseconds of the value.
67-
hrValues = binding.hrtimeBuffer;
68-
// Use a BigUint64Array in the closure because this is actually a bit
69-
// faster than simply returning a BigInt from C++ in V8 7.1.
70-
hrBigintValues = new BigUint64Array(binding.hrtimeBuffer.buffer, 0, 1);
71-
}
72-
73-
// Create the buffers.
74-
refreshHrtimeBuffer();
60+
// The 3 entries filled in by the original process.hrtime contains
61+
// the upper/lower 32 bits of the second part of the value,
62+
// and the remaining nanoseconds of the value.
63+
const hrValues = binding.hrtimeBuffer;
64+
// Use a BigUint64Array because this is actually a bit
65+
// faster than simply returning a BigInt from C++ in V8 7.1.
66+
const hrBigintValues = new BigUint64Array(binding.hrtimeBuffer.buffer, 0, 1);
7567

7668
function hrtime(time) {
7769
binding.hrtime();
@@ -425,5 +417,4 @@ module.exports = {
425417
wrapProcessMethods,
426418
hrtime,
427419
hrtimeBigInt,
428-
refreshHrtimeBuffer,
429420
};
Collapse file

‎lib/internal/process/pre_execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/pre_execution.js
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ function patchProcessObject(expandArgv1) {
212212
const binding = internalBinding('process_methods');
213213
binding.patchProcessObject(process);
214214

215-
require('internal/process/per_thread').refreshHrtimeBuffer();
216-
217215
// Since we replace process.argv[0] below, preserve the original value in case the user needs it.
218216
ObjectDefineProperty(process, 'argv0', {
219217
__proto__: null,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.