Slower PHP components

Created on: | Last updated on:
New PHP 8.5 Uri class is slow. Before measure starts declare variable with URL:

$url = 'https://my-domain.com/api/v2/users/order/12345?nonce=89462486239839&user=kfneklfnefkflne&key=vkjsiueve';

PHP 8.5 class

$uri = new Uri($url);

$result = [
	'host' => $uri->getHost(),
	'path' => $uri->getPath(),
	'query' => $uri->getQuery()
];

This take 14.8 µs

Old way using parse_url()

$url = 'https://my-domain.com/api/v2/users/order/12345?nonce=89462486239839&user=kfneklfnefkflne&key=vkjsiueve';
$result = parse_url($url);

this take 3.1 µs

Leave a Reply

Your email address will not be published. Required fields are marked *

WP Speed Doctor Copyright © 2026
The WordPress® trademark is the intellectual property of the WordPress Foundation, and the Woo® and WooCommerce® trademarks are the intellectual property of WooCommerce, Inc. Uses of the WordPress®, Woo®, and WooCommerce® names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation or WooCommerce, Inc. wpspeeddoctor.com is not endorsed or owned by, or affiliated with, the WordPress Foundation or WooCommerce, Inc.
Top