phalcon/cphalcon — pull request #1132 by sjinks (2013-08-22 06:33:40+00:00)
Title: Use interned strings in mvc/model/query.c

Memory usage as reported by valgrind:
* **Before:** total heap usage: 167,926 allocs, 97,608,376 bytes allocated
* **After:** total heap usage: 167,095 allocs, 97,550,362 bytes allocated

Memory usage via `memory_get_usage()` (real / PHP):
* **before:** (4194304) (4699096)
* **after:** (3932160) (4639400)

Tested with:
* `USE_ZEND_ALLOC=0 valgrind $(phpenv which php) unit-tests/manual-unit.php ModelsQueryParsingTest.php ModelsQueryParsingTest`
* `$(phpenv which php) unit-tests/manual-unit.php ModelsQueryParsingTest.php ModelsQueryParsingTest`

The goal was to see how viable this optimization is — I did not try to replace all strings with interned ones.