YukisCoffee / CoffeeRequest

An asynchronous PHP network request library, including an API similar to JavaScript's fetch.
MIT License
0 stars 0 forks source link

WeakMap or Ds\ structures #2

Open TheDigitalOrchard opened 1 month ago

TheDigitalOrchard commented 1 month ago

You mention that cleanup is expensive. What if you used a built-in PHP approach, such as WeakMap array or one of the Ds containers?

WeakMap would set the minimum to PHP 8, but that's becoming standard now.

YukisCoffee commented 1 month ago

WeakMap like use object instance as key to array offset? In any case, this was a premature optimization. There wouldn't have been any considerable performance penalty from looking up the object in the request queue and removing it as soon as it was done.