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

What is "sigc::slot_base::empty() const" doing? #156

Open
pulsejet opened this issue Feb 19, 2017 · 3 comments
Open

What is "sigc::slot_base::empty() const" doing? #156

pulsejet opened this issue Feb 19, 2017 · 3 comments

Comments

@pulsejet
Copy link

pulsejet commented Feb 19, 2017

Trying to profile mkxp using gprof, I found that the call "sigc::slot_base::empty() const" had consumed a relatively huge CPU time. Any idea what this might be related to?

My output from gprof is here: https://drive.google.com/open?id=0Bxvz3wbxE2UXX0stZ0lJMFJsVVE

A visualization of the same here: https://drive.google.com/open?id=0Bxvz3wbxE2UXZ0JLOS1xQV9Uc0U
(gprof2dot, track the green boxes)

@Ancurio
Copy link
Owner

Ancurio commented Feb 20, 2017

https://git.gnome.org/browse/libsigcplusplus/tree/sigc++/functors/slot_base.h#n329
https://git.gnome.org/browse/libsigcplusplus/tree/sigc++/functors/slot_base.h#n375
https://git.gnome.org/browse/libsigcplusplus/tree/sigc++/functors/slot_base.h#n131
https://git.gnome.org/browse/libsigcplusplus/tree/sigc++/functors/slot_base.h#n31

::empty() is roughly equivalent to

struct B {
  void *p;
};

struct A {
  B *b;
  bool empty() const {
    return (!b || !b->p);
  }
};

My best guess is that the amount of calls to this method + induced cache misses are responsible for your results. Would be interesting to know how many times this method is called during signal emission.
Are you having issues with performance?

Edit: Expressions in brackets are negated.

@pulsejet
Copy link
Author

pulsejet commented Feb 20, 2017

Er... how can I find out the number of calls (is this the 416852x)? (I'm a total noob to profiling, actually). I'm not having performance issues on x86, but there are some performance issues on android for some games, but since there is no sane way to profile native code on android, I decided to try to see if something obvious comes up while profiling for x86.

@Ancurio
Copy link
Owner

Ancurio commented Feb 20, 2017

Er... how can I find out the number of calls (is this the 416852x)?

I never used gprof before, but it does say "calls" in the column header, so that's what I'd suspect :)

I'm not having performance issues on x86, but there are some performance issues on android for some games

Have you looked into GPU profiling too? Many of the bottlenecks I saw 3 years ago were due to rendering. Although To the Moon lagged heavily and I don't believe that was due to GPU work..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants