Re: [RFC] [Discussion] Query Parameter Manipulation Support
| From: | Máté Kocsis | Date: | Mon, 15 Jun 2026 20:36:47 +0000 |
| Subject: | Re: [RFC] [Discussion] Query Parameter Manipulation Support | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131304@lists.php.net to get a copy of this message | ||
Hi Tim,
First of all, thanks for your detailed explanation!
Does that make sense?
>
Sure, this is a very sensible approach, similar to the algorithms I have
also considered myself before. The reason why I
started to search for alternatives is because lookups are inefficient this
way: all get*() methods have an O(n) time complexity
by default, while currently, looking up keys in $_GET is O(1). This
regression is what I tried to avoid with storing query params
along with an array key.
However, I realized in the meanwhile that it may be possible to eliminate
much of the performance overhead by using two hash tables:
one for exact search (WHATWG URL-alike API), and one for searching the
prefixes before the [] pair (for the array API). I haven't
tried this idea out yet in practice, so I'll need to do some POC first
before continuing with the RFC.
Regards,
Máté