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 8872007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:07:13+00:00 2026-06-14T18:07:13+00:00

I have an application which makes maximum usage of recursive functions . Basically its

  • 0

I have an application which makes maximum usage of recursive functions . Basically its a string parser which uses a hash map as its data structure . We are facing an issue wherein for complex and long strings the performance is severly hit . We have dared not touch the hash function , in the fear of regression. What has been observed is a massive recursive function calls which we suspect is causing the performance issue . The application is a C++(Windows) based developed in VS 2008

Will increase in stack reserve size and stack commit size improve application performance ? OR
Will it avoid Out of Memory issues which we come across , but not frequently

  • 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-06-14T18:07:14+00:00Added an answer on June 14, 2026 at 6:07 pm

    Stack usage in itself will not significantly affect performance. It’s possible that the cost of making function calls (which happen to be recursive calls) is a significant part of the runtime of your hash function, and if so it’s possible that an iterative version would be faster.

    Maximal usage of recursion in C++ is potentially inefficient and is also somewhat dangerous, since stack size is limited. For example,

    size_t hash(const std::string &s) {
        if (s.size() == 0) return 0;
        return s[0] + 31 * hash(s.substr(1));
    }
    

    This is probably inefficient for two reasons (the call overhead and the likelihood that it allocates loads of strings), and also will crash with a stackoverflow when passed a long enough string.

    We have dared not touch the hash function , in the fear of regression

    Even aside from performance, the hash function used in a hash map should be isolated for ease of maintenance — one copy of the code, and no assumptions anywhere else that any particular hash algorithm is used.

    If you can isolate the hash function, then you can dare to touch it. That way you can easily compare different hash algorithms and different implementations (including recursive / non-recursive) to see whether they solve your overall performance issue.

    If you can’t isolate the hash function, then you’ve learned a lesson about code design. You might still be able to replace it, though, and get an idea of whether it affects performance without knowing for sure that the code is still correct. If you can make it faster then it’s worth trying to make it correct (by modifying the rest of your code to isolate the hash function and then replacing it). If the best hash function you can come up with isn’t faster then it doesn’t really matter whether it’s correct or not, since there’s no grounds to use it.

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

Sidebar

Related Questions

I have an application which makes use of JNA to call functions from a
I have C# application that makes use of some C libaries(which I have written
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have an application which uses the microsoft kinect device. The thing is that
I have an application which makes calls to an online database. If I lose
I have created a windows application which makes use of Office.dll and PowerPoint dlls
We have a 32-bit .NET application which makes use of the 32-bit version of
I have an application which makes use of the default camera to take pictures
I have created small test web application which makes use of LINQ to SQL.
I have an application which makes use of an external library (Jackson), and the

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.