Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6373175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:19:54+00:00 2026-05-25T01:19:54+00:00

I’m having a hard time tracking down unnecessary redundant calls within a rather complex

  • 0

I’m having a hard time tracking down unnecessary redundant calls within a rather complex algorithm.

It looks like (some of my) my algorithm(s) is/are seriously slowed down by redundant calls (in several subroutines) of a non-cached and comparatively expensive function.
To confirm this I’d like to utilize Dtrace to detect multiple calls of a single function within a given branch of the call stack tree.

I’d like to be able to ask dtrace to:

  • search the call stack tree within a given function (here "foo();", see attached image) for duplicate function calls ("c();", e.g.)

  • log them with their respective call count (here: 3x for "c();")

and if possible also

  • log the call stacks of each occurrence ("foo()/a()/c()", "foo()/a()/b()/c()", "foo()/a()/b()/d()/c()").

Is this possible? And if yes, any idea how?

Thanks in advance!

enter image description here

Note: I used C in my sample code even though my code is actually in Objective-C, but this kind of thing should be kind of language-agnostic, shouldn’t it? The general approach/idea at least.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:19:55+00:00Added an answer on May 25, 2026 at 1:19 am

    The method I use is random-pausing, as in this example.
    The idea is what you want to see is stack traces weighted by the wall-clock time they are responsible for. Function call sites responsible for significant time are preferentially displayed.

    Then you just look at those. The stack traces tell you why they are being executed.
    From that you can tell if there is a way to do without them.
    If you do so, the time you save is the same as the fraction of time they were on the stack.

    Note: If you do this, you don’t need to care how many times the function was called from that site (or anywhere), or how long it takes to execute.
    All you need to care about is that the call site was on the stack on at least two samples, and that it can be removed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.