config: ServiceOptions O(1) assert time in the common case
authorTim Starling <tstarling@wikimedia.org>
Thu, 20 Jun 2019 16:45:19 +0000 (11:45 -0500)
committerKrinkle <krinklemail@gmail.com>
Thu, 20 Jun 2019 19:41:17 +0000 (19:41 +0000)
commit53968321999f3f4264373125c5ab2b61e7f972c1
tree1ef9258178a7f69b6210039792a277d3ecbaa421
parenta31983f23c7104e8f5b2108e889ef8af1dca7251
config: ServiceOptions O(1) assert time in the common case

Check if the key array passed in the constructor is identical to the key
array passed to assertRequiredOptions(). This takes O(1) time if the key
arrays have the same underlying storage pointer, which is the common
case.

If the arrays have a different order but are otherwise identical, the
slow path is taken instead. The comparison will add O(N) overhead in
addition to the overhead of the array_diff() calls.

Change-Id: Icb9040ab66286b72a270e84f910cb578bed105b0
includes/config/ServiceOptions.php