Skip to content

Problem with TBT per domain #2997

@christophe-ledu

Description

@christophe-ledu

Description

The code merging blocking times (

WebPageTest/www/vitals.php

Lines 700 to 724 in 5dcc6b7

// Merge a start/end window into an existing array of times
function MergeBlockingTime(&$times, $start, $end)
{
$merged = false;
// See if it overlaps with an existing window
for ($i = 0; $i < count($times) && !$merged; $i++) {
$s = $times[0];
$e = $times[1];
if (
($start >= $s && $start <= $e) ||
($end >= $s && $end <= $e) ||
($s >= $start && $s <= $end) ||
($e >= $start && $e <= $end)
) {
$times[0] = min($start, $s);
$times[1] = max($end, $e);
$merged = true;
}
}
if (!$merged) {
$times[] = array($start, $end);
}
}
) seems to have missing [$i] in the lines 707, 708, 715, 716.

Steps to reproduce

The current code end up comparing number ($start and $end) with arrays ($s and $e), which does not seems to make any sense. Some values are never used (only using the first 2 arrays of $times).

In this section https://www.webpagetest.org/vitals.php?test=231103_AiDcHB_86B&run=1#tbt I get 9ms difference with cdn.digiteka.com

Expected result

I guess what is expected is $times[$i][0] and $times[$i][1]

Actual result

With overlapping tasks, some domains can get 9ms more blocking time.

Related issues?

Any related issues filed already? Haven't found any

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugAn issue or pull request relating to a bug in WebPageTeststale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions