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

kernel/array.c optimization #822

Merged
merged 9 commits into from Jul 11, 2013
Merged

kernel/array.c optimization #822

merged 9 commits into from Jul 11, 2013

Conversation

ghost
Copy link

@ghost ghost commented Jul 11, 2013

Changes:

  • isset/unset/update/fetch functions are now more consistent with PHP's behavior (ie, they accept all scalar key types, properly handle string keys consisting of digits etc);
  • use Zend's SEPARATE_ZVAL() macro;
  • phalcon_array_{is,un}set() do not need a temporary zval anymore — -1 memory allocation, -1 type conversion
  • phalcon_array_update_zval() and phalcon_array_fetch() do not zval need type conversions anymore;
  • phalcon_array_fetch family does memory allocation in one place which makes it easier to find potential issues;
  • replaced php_error_docref() with zend_error() — this is what SPL and new extensions prefer to use nowadays. The advantage is that zend_error() does not need TSRMLS_CC. Therefore on the next iteration we will be able to get rid of TSRMLS_CC in the array functions and this will allow to save some stack/registers, give more opportunities to inlining and give a bit faster code.

PS: optimizations resulted in -110 lines, less code to maintain for more features 😀

phalcon pushed a commit that referenced this pull request Jul 11, 2013
kernel/array.c optimization
@phalcon phalcon merged commit e1454b8 into phalcon:1.2.1 Jul 11, 2013
@phalcon
Copy link
Collaborator

phalcon commented Jul 11, 2013

!!! this is great :)

@ghost ghost deleted the array-opt branch July 11, 2013 05:33
@ghost ghost mentioned this pull request Jul 11, 2013
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