UMD Web Utilities Library
    Preparing search index...

    Function measurePerformance

    • Measure duration between two marks

      Creates a performance measure between two named marks and returns the duration.

      Parameters

      • name: string

        Name for the measure

      • startMark: string

        Start mark name

      • endMark: string

        End mark name

      Returns number | null

      Duration in milliseconds or null if measurement failed

      markPerformance('fetch-start');
      await fetchData();
      markPerformance('fetch-end');
      const duration = measurePerformance('data-fetch', 'fetch-start', 'fetch-end');
      console.log('Fetch took:', duration, 'ms');