I guess you already saw a short note Latency Numbers Every Programmer Should Know. I wanted to check how well Nette performs with its magic properties on Nette\Object
.
You can see the testing code below together with raw output on my machine.
It show how much time in seconds it took to execute one million iterations of a particular action, thus it is also time in microseconds of one such call. You should compare it to null test, which execute empty iterations.
Compared to a native getter of public property:
- method call is cca 4x slower
- magic getter is cca 15x slower
- magic getter in form isSomething() is cca 25x slower
In a real app this does not cause any issue. I tested it on an our eshop where it added only cca 1ms to a page load, which was almost nothing to a total page load time.
My mashine