Skip to content

Instantly share code, notes, and snippets.

@nikic nikic/union_bench_results Secret
Created Oct 25, 2019

Embed
What would you like to do?
Without opcache/jit:
empty_loop 0.142
func($x) 0.608 0.465
func(int $x) 0.653 0.511
func(int|float|string $x) 0.653 0.511
func($x): int 0.689 0.547
func($x): int|float|string 0.751 0.609
func(int $x): int 0.757 0.615
func($a,$b,$c,$d,$e) 1.129 0.987
func(int $a,$b,$c,$d,$e): int 1.120 0.978
Foo::$static_prop = ... 0.289 0.147
Foo::$static_typed_prop = ... 0.425 0.283
Foo::$static_union_prop = ... 0.422 0.280
$o->prop = ... 0.298 0.156
$o->typed_prop = ... 0.433 0.291
$o->union_prop = ... 0.501 0.359
Foo::$static_prop += 2 0.331 0.189
Foo::$static_typed_prop += 2 0.480 0.338
Foo::$typed_union_prop += 2 0.482 0.340
$o->prop += 2 0.458 0.316
$o->typed_prop += 2 0.573 0.431
$o->union_prop += 2 0.572 0.430
$static_prop_ref = ... 0.259 0.117
$static_typed_prop_ref = ... 0.529 0.387
$static_union_prop_ref = ... 0.573 0.431
$static_prop_ref += 2 0.258 0.116
$static_typed_prop_ref += 2 0.537 0.394
$static_union_prop_ref += 2 0.538 0.396
func($obj) 0.617 0.475
func(?A $obj) 0.754 0.612
func(A|B|C|null $obj) 0.772 0.630
func(A|B|C|null $obj) 0.984 0.842
With opcache/jit:
empty_loop 0.068
func($x) 0.264 0.196
func(int $x) 0.258 0.190
func(int|float|string $x) 0.266 0.198
func($x): int 0.343 0.275
func($x): int|float|string 0.344 0.276
func(int $x): int 0.333 0.264
func($a,$b,$c,$d,$e) 0.491 0.423
func(int $a,$b,$c,$d,$e): int 0.486 0.417
Foo::$static_prop = ... 0.226 0.158
Foo::$static_typed_prop = ... 0.336 0.268
Foo::$static_union_prop = ... 0.338 0.269
$o->prop = ... 0.230 0.162
$o->typed_prop = ... 0.333 0.265
$o->union_prop = ... 0.336 0.268
Foo::$static_prop += 2 0.270 0.202
Foo::$static_typed_prop += 2 0.435 0.366
Foo::$typed_union_prop += 2 0.436 0.367
$o->prop += 2 0.386 0.318
$o->typed_prop += 2 0.551 0.483
$o->union_prop += 2 0.548 0.480
$static_prop_ref = ... 0.103 0.034
$static_typed_prop_ref = ... 0.504 0.436
$static_union_prop_ref = ... 0.506 0.438
$static_prop_ref += 2 0.095 0.026
$static_typed_prop_ref += 2 0.452 0.384
$static_union_prop_ref += 2 0.452 0.384
func($obj) 0.305 0.237
func(?A $obj) 0.509 0.441
func(A|B|C|null $obj) 0.579 0.511
func(A|B|C|null $obj) 0.837 0.768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.