Added a simpler interface to weave that does not need target function iteration#1
Open
ichernev wants to merge 1 commit intogtanner:masterfrom
Open
Added a simpler interface to weave that does not need target function iteration#1ichernev wants to merge 1 commit intogtanner:masterfrom
ichernev wants to merge 1 commit intogtanner:masterfrom
Conversation
Owner
|
This is a very interesting problem. I want to do some timing tests to see what the overhead is for the iteration and see if it is a huge impact before we spend to much time refactoring. I had an idea of a two phase aspect method to solve this issue.
That way for aspecting a collection of the same objects it saves the constuction of the weave object for each one. |
Author
|
Do you mean using prototypes? Like Otherwise I don't think there is much sense in constructing the weave object beforehand, because the connection part will take as much time as constructing the weave (asymptotically). |
|
Something is missing from all the AOP/Mixin framework is a more general way to define the point cut. e.g. weave.after('get*', function () {
...
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If you are wrapping big objects with many functions, traversing all of them each time you wrap may be costly. So I added a function fastAspect, which exports a similar interface, but the function names are not preloaded in before/after/around etc, but instead, you pass the function name as a string.
I agree that this is not the cleanest implementation, but I'm open to suggestions (as far as the solution does not iterate through the object's functions).