phalcon/cphalcon — pull request #2072 by sjinks (2014-02-21 23:37:43+00:00)
Title: Method call optimization + bug fixes

This is the final part of function/method call optimization commit series.

Main changes:
* all function/method call now use `return_value_ptr` instead of `return_value`: this greatly allowed to reduce the number of memory allocations (the old approach with `PHALCON_INIT_VAR` + `phalcon_call_method` required one extra memory allocation and deallocation which is gone now);
* greatly reduced the number of macros in `kernel/fcall.h`: for example, `PHALCON_CALL_METHOD()` macro can accept any number of parameters and thus there is no need to have `phalcon_call_method_pXXX` macros;
* implemented smart function/method caching which allows to cache both userland and internal functions. This allowed to get rid of `kernel/alt/fcall.c` (the same optimizations are applied to all kinds of functions) and gives at least +20 rps with the concurrency level of 256 on the smallest DigitalOcean instance;
* PHALCON_CALL family of macros automatically observes the return values thus there is no need to call `PHALCON_OBS_VAR()` on the return value anymore;
* the change resulted in ~2000 deleted lines of code.

Bonuses:
* fix memory leaks;
* fix bugs in the unit tests