Skip to content

Instantly share code, notes, and snippets.

@alies-dev
Last active May 9, 2025 13:43

Revisions

  1. @lptn lptn revised this gist May 3, 2018. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion readme.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,7 @@ Hot to use

    1. Open Compare Reports page, e.g. https://gtmetrix.com/compare/a4lhVShE/ek3wqm50 and switch to `Waterfall` tab.
    1. Copy paste js code to dev tools console.
    1. Use results.
    1. Use results.

    ## How results looks like
    ![image](https://user-images.githubusercontent.com/5278175/39572963-f1a4ace6-4ed9-11e8-8e78-75a6b5326efc.png)
  2. @lptn lptn revised this gist May 3, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Hot to use
    ==========

    1. Open Compare Reports page, e.g. https://gtmetrix.com/compare/a4lhVShE/ek3wqm50
    1. Open Compare Reports page, e.g. https://gtmetrix.com/compare/a4lhVShE/ek3wqm50 and switch to `Waterfall` tab.
    1. Copy paste js code to dev tools console.
    1. Use results
    1. Use results.
  3. @lptn lptn revised this gist May 3, 2018. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions gtmetrics-comparison-snippet.js
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,18 @@
    function returnRefinedURL(url) {
    return url.replace(new RegExp("=\\w+"),"").replace("?&","?")
    .replace("&&","&")
    return url.replace(new RegExp("=\\w+"),"").replace("?&","?").replace("&&","&");
    }

    testsAndRequests = []
    testsAndRequests = [];

    document.querySelector('.report-waterfall').contentWindow.document.querySelectorAll('.vsc-initialized table .netTable').forEach((table, index) => {
    table.querySelectorAll('.netFullHrefLabel.netHrefLabel.netLabel ').forEach((row, rowIndex) => {
    if (rowIndex === 0) { testsAndRequests.push([]) }
    if (rowIndex === 0) { testsAndRequests.push([]); }
    testsAndRequests[index].push(row.textContent);
    })
    })
    });
    });

    firstTestRequests = testsAndRequests[0].map(returnRefinedURL);
    secondTestRequests = testsAndRequests[1].map(returnRefinedURL);

    console.log('In A not in B: ', firstTestRequests.filter(x => !secondTestRequests.includes(x)));
    console.log('In B not in A: ', secondTestRequests.filter(x => !firstTestRequests.includes(x)))
    console.log('In B not in A: ', secondTestRequests.filter(x => !firstTestRequests.includes(x)));
  4. @lptn lptn revised this gist May 3, 2018. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    Hot to use
    ==========

    1. Open Compare Reports page, e.g. https://gtmetrix.com/compare/a4lhVShE/ek3wqm50
    1. Copy paste js code to dev tools console.
    1. Use results
  5. @lptn lptn created this gist Jan 11, 2018.
    19 changes: 19 additions & 0 deletions gtmetrics-comparison-snippet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    function returnRefinedURL(url) {
    return url.replace(new RegExp("=\\w+"),"").replace("?&","?")
    .replace("&&","&")
    }

    testsAndRequests = []

    document.querySelector('.report-waterfall').contentWindow.document.querySelectorAll('.vsc-initialized table .netTable').forEach((table, index) => {
    table.querySelectorAll('.netFullHrefLabel.netHrefLabel.netLabel ').forEach((row, rowIndex) => {
    if (rowIndex === 0) { testsAndRequests.push([]) }
    testsAndRequests[index].push(row.textContent);
    })
    })

    firstTestRequests = testsAndRequests[0].map(returnRefinedURL);
    secondTestRequests = testsAndRequests[1].map(returnRefinedURL);

    console.log('In A not in B: ', firstTestRequests.filter(x => !secondTestRequests.includes(x)));
    console.log('In B not in A: ', secondTestRequests.filter(x => !firstTestRequests.includes(x)))