Skip Menu |

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 94699
Status: open
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: blue [...] thisisnotmyrealemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: cache parsed URI components for performance
For dramatic performance improvement, cache the parsed URI components so the URI string doesn't have to be repeatedly parsed. For instance, if you need access to several component methods or call the same component method multiple times, the URI string is parsed each time. The documentation should at the very least mention this and advise the user to save the result if they need to use it multiple times- for example, testing $uri->host against multiple values. But it would be even better to implement the caching internally to URI.
On Sun Apr 13 20:25:54 2014, blue wrote:
Show quoted text
> For dramatic performance improvement, cache the parsed URI components
> so the URI string doesn't have to be repeatedly parsed.

How dramatic will that be?

The cache locality of having the current compact representation of URIs might also be worth something.  I would depend on how many URLs a program keep around in memory.

--Gisle