Skip to content

[QUESTION] Is performance.js necessary? #24

@sethzhonda

Description

@sethzhonda

Performance.js

Post-Spectre, browsers deliberately coarsen performance timeline timestamps. A browser returning full-precision timing when others have coarsened it is a fingerprint signal. All numeric properties on returned entries are rounded to one decimal place via a cached Proxy.

const proxy = new Proxy(entry, {
  get(target, prop) {
    const value = Reflect.get(target, prop, target)
    if (typeof value === 'number' && prop !== 'entryType') {
      return Math.round(value * 10) / 10
    }
    return typeof value === 'function' ? value.bind(target) : value
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions