Skip to content

Web Informer widget causing delay in initial server response #343

@philwareham

Description

@philwareham

We've ascertained that fetching the HTML for the web informer widget causes around 300ms of lag on the initial server response - pushing us into a non-pass on Core Web Vitals. I'd like to reduce that lag if possible but we can't cache the HTML, for reasons.

Currently the code to fetch this HTML is:

if (!gps('txpreview')) {
    $opts = array('http' => array('timeout' => 1.6));
    $url = 'https://website.informer.com/widget/textpattern.com-2';
    $context = stream_context_create($opts);
    $widget = file_get_contents($url, false, $context);

    if ($widget) {
        echo $widget;
    }
}

I'm wondering if there is any performance gain from using stream_copy_to_stream instead of file_get_contents?

@Bloke what do you think, and if so can you give me a pointer on the code needed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions