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

Read/modify/update optimization on properties #848

Closed
wants to merge 1 commit into from
Closed

Read/modify/update optimization on properties #848

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 15, 2013

Looks like it is sometimes possible to eliminate calls to update_property because read_property does not separate the returned value.

The idea is described in this test case and is implemented in Phalcon\Mvc\Router\Route::construct().

The result is:

  • directly saved 80 bytes of RAM (amd64)
  • -2 or -3 variables tracked by the MM
  • eliminated call to update_property.

If you are OK with this optimization, I think there are places where this can be implemented.

@phalcon
Copy link
Collaborator

phalcon commented Jul 15, 2013

I think this makes the logic a bit strange to be understood by PHP developers since they might have to deal directly with refcounts. I think we can better introduce a new function in kernel/object to increment static properties (involving refcount so as reducing the memory usage).

@ghost ghost closed this Aug 2, 2013
@ghost ghost deleted the router branch August 2, 2013 07:35
This pull request was closed.
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