Bug #80348 [Nab]: 10.000% inneficiency when using array_intersect_key and array_intersect_ukey

From: Date: Wed, 11 Nov 2020 19:58:19 +0000
Subject: Bug #80348 [Nab]: 10.000% inneficiency when using array_intersect_key and array_intersect_ukey
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230278@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80348&edit=1

 ID:                 80348
 User updated by:    fuckoff at gmail dot com
 Reported by:        fuckoff at gmail dot com
 Summary:            10.000% inneficiency when using array_intersect_key
                     and array_intersect_ukey
 Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   All
 PHP Version:        7.4.12
 Block user comment: N
 Private report:     N

 New Comment:

Yeap


Previous Comments:
------------------------------------------------------------------------
[2020-11-11 19:57:49] gilperon at gmail dot com

A bug tracker is not a place where only are reported bugs which are 100% a bug. It's a tracker,
people can check/discuss whether it's a bug or not.

------------------------------------------------------------------------
[2020-11-11 19:29:35] a at b dot c dot de

You posted in a bug tracker.

------------------------------------------------------------------------
[2020-11-10 17:39:56] gilperon at gmail dot com

danack@php.net I didnt say anywhere in my text/description that this was a bug, I just said
it's amazing how poorly one of the functions does while doing almost the same exactly thing as
the other (intersecting keys). If you think this is normal and expected, and if you think this is a
pretty common thing that most users/programmers will know (that one function is terribly slow
compared to the other) than I am just an idiot wasting your time. You are welcome.

------------------------------------------------------------------------
[2020-11-10 16:04:23] nikic@php.net

Algorithmically, array_intersect_key and array_intersect_ukey have pretty much no relation.
array_intersect_key is a hash-based intersection, array_intersect_ukey is a comparison-based
intersection.

To implement an efficient intersection in userland, you need to approach it from the hash table
angle, as comparison-oriented intersections are fundamentally slow.

------------------------------------------------------------------------
[2020-11-10 15:57:16] danack@php.net

"using 2 supposedly very similar functions"

They perform similar tasks, they don't behave the same internally. One of them needs to call
userland code from internal code. The other one doesn't.

Reporting non-existant performance bugs is not useful. It takes people time away from fixing actual
bugs, or analysing where performance problems are across the whole of the project. Please just get a
faster server, rather than expecting other people to magically make your particular use-case faster.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=80348


--
Edit this bug report at https://bugs.php.net/bug.php?id=80348&edit=1


Thread (7 messages)

« previous php.bugs (#230278) next »