Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use interned strings in mvc/model/query.c #1132

Merged
merged 8 commits into from Aug 22, 2013
Merged

Use interned strings in mvc/model/query.c #1132

merged 8 commits into from Aug 22, 2013

Conversation

ghost
Copy link

@ghost ghost commented Aug 22, 2013

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.

@ghost
Copy link
Author

ghost commented Aug 22, 2013

6aa5f41, 058d023 and 9ae48e7 add support for interned strings to PHQL parser.

total heap usage: 167,096 allocs, 97,528,018 bytes allocated

22K memory saved :-)

phalcon pushed a commit that referenced this pull request Aug 22, 2013
Use interned strings in mvc/model/query.c
@phalcon phalcon merged commit 2ba3e2f into phalcon:1.3.0 Aug 22, 2013
@ghost ghost deleted the sql-query branch August 22, 2013 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants