Laruence,

previous test script only measure the last all, although that,
> interface already won with complex arguments signatures...
>
> here is a fixed one: https://gist.github.com/laruence/5877928
>
> run 3 times:
>
> $ sapi/cli/php /tmp/2.php
> Interface in 1.7314801216125 seconds, 1.7314801216125E-6 seconds per run
> Structural in 1.7587349414825 seconds, 1.7587349414825E-6 seconds per run
> Native in 1.0431759357452 seconds, 1.0431759357452E-6 seconds per run
> [Laruence@localhost:/Users/Laruence/opensource/trunk/]
> $ sapi/cli/php /tmp/2.php
> Interface in 1.7132070064545 seconds, 1.7132070064545E-6 seconds per run
> Structural in 1.7542362213135 seconds, 1.7542362213135E-6 seconds per run
> Native in 1.0379688739777 seconds, 1.0379688739777E-6 seconds per run
> [Laruence@localhost:/Users/Laruence/opensource/trunk/]
> $ sapi/cli/php /tmp/2.php
> Interface in 1.6947190761566 seconds, 1.6947190761566E-6 seconds per run
> Structural in 1.7611300945282 seconds, 1.7611300945282E-6 seconds per run
> Native in 1.04856300354 seconds, 1.04856300354E-6 seconds per run
>
>
> as you can see, still, your patch won zero ...
>

Your benchmark is timing *way* too much. It needs to narrow the measurement
surface significantly:

https://gist.github.com/ircmaxell/5878060

That measures only the dispatch time (discounting differences in object
construction, etc). And when I run that:

$ sapi/cli/php laruence_test.php
Interface in 0.51537394523621 seconds, 1.7179131507874E-7 seconds per run
Structural in 0.51391339302063 seconds, 1.7130446434021E-7 seconds per run
Native in 0.31268692016602 seconds, 1.0422897338867E-7 seconds per run

$ sapi/cli/php laruence_test.php
Interface in 0.52541399002075 seconds, 1.7513799667358E-7 seconds per run
Structural in 0.54076099395752 seconds, 1.8025366465251E-7 seconds per run
Native in 0.32039928436279 seconds, 1.0679976145426E-7 seconds per run

$ sapi/cli/php laruence_test.php
Interface in 0.51772499084473 seconds, 1.7257499694824E-7 seconds per run
Structural in 0.50954604148865 seconds, 1.6984868049622E-7 seconds per run
Native in 0.31669473648071 seconds, 1.0556491216024E-7 seconds per run

$ sapi/cli/php laruence_test.php
Interface in 0.51783013343811 seconds, 1.7261004447937E-7 seconds per run
Structural in 0.50820827484131 seconds, 1.6940275828044E-7 seconds per run
Native in 0.3112211227417 seconds, 1.0374037424723E-7 seconds per run

$ sapi/cli/php -v
PHP 5.6.0-dev (cli) (built: Jun 27 2013 12:35:30)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.6.0-dev, Copyright (c) 1998-2013 Zend Technologies

(a non-debug build, no extensions)

In this case, which also ignores the compile time of interface resolving
(which does add slowdown to the compile step, which a fair benchmark would
take into count).

But these runs show something interesting. Interfaces average
mathematically to 1.730283E-7 per call. Structural hints average
to 1.7270175E-7

Both are within the margin of error of the tests to prove that **at worst**
they are the same speed.

Which shows that unless you want to argue about literally microseconds, I
think we can put this performance piece to rest...

Especially that "runtime is slow" which has been brought up over and over
again has been disproven... The worst case that you could make a
justification for is ignoring 1/2 the interface's cost... Which is pretty
silly in a holistic discussion...

So can we please get past this "performance" issue, and talk about
something that actually matters...?

Reply via email to