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
Speedup of the Cappuccino framework by more efficient objj_msgSend #2384
Speedup of the Cappuccino framework by more efficient objj_msgSend #2384
Conversation
…ions. More efficient implementation of objj_method.
…for Array and Dictionary Literals.
…o framework with objj_msgSend function inlined. Also introduced options in ’index-debug.html’ templates to allow inline of objj_msgSend function when compiling in browser.
Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue. |
How does that handle method swizzling? |
The same code is just inlined so it works fine. |
Ah I get it. Yeah the most common objj_msgSend decorators are all about debugging so enabling this option for release code makes sense. Shouldn't this PR have some code generation unit tests? |
Yes, it definitively needs some code generation unit tests. I have plans to do the |
Very cool! On Tue, Oct 6, 2015 at 6:39 AM Martin Carlberg notifications@github.com
|
edit: in release, it doesn't load, but actually logs an exception:
|
Hmm, this is strange. Are you sure it is running against a new Objective-J Runtime? It feels like you are running on an old Runtime as it gets undefined when evaluating |
my bad actually :) I did not realize I had to activate the -O2 flag for all libraries It's working great, we'll do some testing and report any issue. Great Job! |
Milestone: Someday. Labels: #accepted, #needs-unit-test, Objective-J. What's next? This issue needs a volunteer to write and submit one or more unit tests execercising the changes and/or the relevant parts of the original problem. |
…d functions for all tests in OutputTest.
I have now added code generation unit test cases with inlined objj_msgSend functions for all tests in OutputTest |
Milestone: Someday. Labels: #accepted, Objective-J. What's next? A reviewer should examine this issue. |
Milestone: Someday. Labels: #accepted, Objective-J. What's next? A reviewer should examine this issue. |
… so compiler flags can be set after the files are compiled. This implementation works all the time.
I have now fixed a problem with compiler flags when compiling in the browser. |
I don't have any more outstanding issues. We are now using it in our project and are happy with it. |
Looks good so far. Some minor points we should be aware of:
Did you compare the size of your build output for your app with and without this? What about memory usage in the browser? If it's 20-50% faster I imagine it can't be too significant. |
The code size does increase: I can't see any difference in memory usage in the Browser but as you say it should be a small increase. |
Removed the ’release-inline’ option when building as it is not practical to have two different options. The release build now always has inlined msgSend functions. If a release build is needed without inlined msgSend functions an edit of the ”-O2” option to ”-O” in the Jakefile is needed.
@@ -45,6 +45,23 @@ if (DOMBaseElementsCount > 0) | |||
pageURL = new CFURL(DOMBaseElementHref, pageURL); | |||
} | |||
|
|||
// Set compiler flags | |||
|
|||
if (OBJJ_COMPILER_FLAGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generates a Uncaught ReferenceError: OBJJ_COMPILER_FLAGS is not defined on Chrome.
typeof OBJJ_COMPILER_FLAGS !== 'undefined'
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for finding this problem. I'll make a fix for this.
Are we good with this one @mrcarlberg ? |
Assignee: mrcarlberg. Milestone: Someday. Labels: #works-for-me, Objective-J. What's next? Attempts to reproduce the problem described by this issue have failed to reveal any erroneous situation. |
Speedup of the Cappuccino framework by more efficient objj_msgSend
This pull request will make Objective-J run faster by implementing a more efficient
objj_msgSend
function andobjj_method
implementation. The compiler can also optionally inline the function to increase the speed even more.Initial tests show that the speed increase is more than 50% in special cases. For a general Objective-J application the speed increase is around 20%.
The speed increase is possible by the following improvements:
objj_method
implemention. That bad thing here is that thename
property onobjj_method
has to change tomethod_name
.objj_msgSend
andobjj_msgSendSuper
functions has a more efficient implementation.objj_msgSend
andobjj_msgSendSuper
functions are optionally inlined by the compiler.How to use:
• The
Release
version of the Cappuccino framework will have inlinedobjj_msgSend
andobjj_msgSendSuper
functions. TheDebug
version will use the oldobj_msgSend
functions.• To generate inlined code when compiling in the browser add the below line in the
index[-debug].html
file.• To generate inline code for the
Release
version of your project when building from command line changetask.setCompilerFlags("-O");
totask.setCompilerFlags("-O2");
in the project Jakefile. This is needed for all your subprojects and frameworks too.A new version of OJTest framework (https://github.com/cappuccino/OJTest) is needed to run the test cases. Copy it to the package folder in the Narwhal directory.