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

Improve runtime performance and clang++ compatibility #2

Merged
merged 6 commits into from Apr 14, 2015

Conversation

Denisss025
Copy link
Contributor

What's new:

  • Add Holder container alias.
  • Less RTTI (better runtime performance):
    • don't use typeid();
    • use static_cast instead of dynamic_cast.
  • Move shared pointers instead of copy (should be faster).
  • Better clang++ compatibility (tested with clang++-3.5).

 `holder_cont` is an alias for holder container class.
 Use static_cast instead of dynamic_cast when possible.
 Use `std::move` for shared pointers. This is faster than simple copy.
 Use function pointer instead of typeid. This is done on compile time and
 won't affect runtime performance.
 Add `diagnostic ignored` for C++98 and weak vtables.

 Convert Holder, CallbackHolder, InstanceHolder and Container  from struct
 to class.

 Fix `enable_if` for clang++.

 Remove unused variables.

 Replace `getCallback` function with `operator ()` in CallbackHolder
 class.
 Add `final` keyword to CallbackHolder and InstanceHolder classes.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++98-compat"
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
#pragma clang diagnostic ignored "-Wweak-vtables"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is needed to remove clang warnings for inlined virtual destructors.

@gracicot gracicot merged commit e71fcc8 into gracicot:master Apr 14, 2015
@gracicot
Copy link
Owner

I kept classes as struct, public inheritance by default is why less obfuscating is think (maybe the Container should be a class because of the private?? let me know)

@gracicot
Copy link
Owner

tested everything with clang++ 3.6.0 and g++ 4.9.2

@gracicot
Copy link
Owner

thank you again, this makes the tool even greater and faster. Your efforts are always welcome.

@Denisss025
Copy link
Contributor Author

I renamed struct Constructor to class Constructor because the clang++ compiler has given me a warning that I'm using the wrong type for it.

@Denisss025 Denisss025 deleted the develop branch April 15, 2015 03:46
@gracicot
Copy link
Owner

ok, I reverted back the change and put the Container to class

@gracicot
Copy link
Owner

Hi, I made some important changes for the next version, including having service managed by unique_ptr and raw pointers. I added the feature to have additional parameters in the constructor after the dependencies ( that feature might need some work )

Denisss025 added a commit to Denisss025/kangaru that referenced this pull request Apr 30, 2015
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.

None yet

2 participants