Invite-Only Early Access — Think Throo GitHub App is currently invite-only. Request access here.
2025May

Window.performance in nuqs source code.

In this article, we will review window.performance in nuqs source code. We will look at

  1. What is window.performance?

  2. Usage in nuqs codebase.

What is window.performance?

The performance interface provides access to performance related information for the current page.

There are instance properties. Read more about instance properties.

There are also instance methods available. Read more about instance methods.

performance entries are specific to each execution context. You can access performance information for code running in a window via Window.performance, and for code running in a worker via WorkerGlobalScope.performance

Usage in nuqs codebase.

Performance is used in the following files shown in the screenshot below.

At line 103 in update-queue.ts file, performance.now is used as shown below:

 lastFlushTimestamp = performance.now()

At line no 8 in a file named debug.ts, in the nuqs package, you will find that performance is used shown below.

  performance.mark(msg)

performance.mark

You might be wondering what performance.mark is. performance.mark creates a timestamp in the browser’s performance entry buffer with the given name. Read more about performance.mark.

performance.now

Performance.now Returns a DOMHighResTimeStamp representing the number of milliseconds elapsed since a reference instant. Read more about performance.now.

About me:

Hey, my name is Ramu Narasinga. Email: ramu.narasinga@gmail.com

Tired of AI-generated code that works but nobody understands?

I spent 3+ years studying OSS codebases and wrote 350+ articles on what makes them production-grade. I built an open source tool that reviews your PR against your existing codebase patterns.

Your codebase. Your patterns. Enforced.

Get started for free —thinkthroo.com

References

  1. https://github.com/47ng/nuqs/blob/next/packages/nuqs/src/update-queue.ts#L103

  2. https://developer.mozilla.org/en-US/docs/Web/API/Performance