process.hrtime.bigint()
添加於:v10.7.0
- 返回: <bigint>
方法的 process.hrtime()
bigint
版本以 bigint
的形式返回當前的 high-resolution 實時(以納秒為單位)。
與
不同,它不支持額外的 process.hrtime()
time
參數,因為可以直接通過減去兩個 bigint
來計算差異。
import { hrtime } from 'node:process'; const start = hrtime.bigint(); // 191051479007711n setTimeout(() => { const end = hrtime.bigint(); // 191052633396993n console.log(`Benchmark took ${end - start} nanoseconds`); // Benchmark took 1154389282 nanoseconds }, 1000);
const { hrtime } = require('node:process'); const start = hrtime.bigint(); // 191051479007711n setTimeout(() => { const end = hrtime.bigint(); // 191052633396993n console.log(`Benchmark took ${end - start} nanoseconds`); // Benchmark took 1154389282 nanoseconds }, 1000);
相關用法
- Node.js process.hrtime.bigint()用法及代碼示例
- Node.js process.hrtime()用法及代碼示例
- Node.js process.hrtime([time])用法及代碼示例
- Node.js process.hasUncaughtExceptionCaptureCallback()用法及代碼示例
- Node.js process.stdin用法及代碼示例
- Node.js process.arch()用法及代碼示例
- Node.js process.nextTick(callback[, ...args])用法及代碼示例
- Node.js process.noDeprecation用法及代碼示例
- Node.js process.setUncaughtExceptionCaptureCallback()用法及代碼示例
- Node.js process.execPath用法及代碼示例
- Node.js process.getgid()用法及代碼示例
- Node.js process.setgid(id)用法及代碼示例
- Node.js process.chdir(directory)用法及代碼示例
- Node.js process.setgid()用法及代碼示例
- Node.js process.getuid()用法及代碼示例
- Node.js process.ppid用法及代碼示例
- Node.js process.report.reportOnSignal用法及代碼示例
- Node.js process.report.directory用法及代碼示例
- Node.js process.umask(mask)用法及代碼示例
- Node.js process.setgroups(groups)用法及代碼示例
- Node.js process.emitWarning()用法及代碼示例
- Node.js process.setegid(id)用法及代碼示例
- Node.js process.getgroups()用法及代碼示例
- Node.js process.nextTick()用法及代碼示例
- Node.js process.chdir()用法及代碼示例
注:本文由純淨天空篩選整理自nodejs.org大神的英文原創作品 process.hrtime.bigint()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。