hapijs / h2o2

Proxy handler for hapi.js
Other
165 stars 66 forks source link

Support for hapi v21, node v18, ESM tests #132

Closed devinivy closed 2 years ago

devinivy commented 2 years ago

If this looks good, this will go out as bounce v10 (including #128).

devinivy commented 2 years ago

@Marsup process.hrtime() has been marked as "legacy", and node encourages folks to switch to process.hrtime.bigint(). It's also a bit easier to use since BigInt is a more standard type than the tuple that process.hrtime() returns.

Marsup commented 2 years ago

My bad, it was even written in the description, sorry 🙁 Good to merge 👍🏻

kanongil commented 2 years ago

@Marsup process.hrtime() has been marked as "legacy", and node encourages folks to switch to process.hrtime.bigint(). It's also a bit easier to use since BigInt is a more standard type than the tuple that process.hrtime() returns.

performance.now() would probably be an even better replacement. It's web-compatible and avoids the use of BigInt.

Marsup commented 2 years ago

h2o2 is very unlikely to be used anywhere else though.

kanongil commented 2 years ago

For sure, but if you are updating it, you might as well use that. hrtime() should only be used if you need to accurately know the current time (ie. not only used to compute a delta).

devinivy commented 2 years ago

I thought that too until recently—I think it's a common misconception! Here's what the docs say about hrtime:

These times are relative to an arbitrary time in the past, and not related to the time of day and therefore not subject to clock drift. The primary use is for measuring performance between intervals

kanongil commented 2 years ago

Oh, right! – it is not even useful for getting the exact time. Guess it is just completely redundant then.

FYI, the node performance.now() implementation uses hrtime(), but uses the start of of the current process as a reference, rather than the start of the system.