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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:06:09+00:00 2026-05-15T02:06:09+00:00

I have an auto-generated file which looks something like this… static void do_SomeFunc1(void* parameter)

  • 0

I have an auto-generated file which looks something like this…

static void do_SomeFunc1(void* parameter)
{
    // Do stuff.
}

// Continues on for another 4000 functions...

void dispatch(int id, void* parameter)
{
    switch(id)
    {
        case ::SomeClass1::id: return do_SomeFunc1(parameter);
        case ::SomeClass2::id: return do_SomeFunc2(parameter);
        // This continues for the next 4000 cases...
    }
}

When I build it like this, the build time is enormous. If I inline all the functions automagically into their respective cases using my script, the build time is cut in half. GCC 4.5.0 says ~50% of the build time is being taken up by “variable tracking” when I use -ftime-report. What does this mean and how can I speed compilation while still maintaining the superior cache locality of pulling out the functions from the switch?

EDIT: Interestingly enough, the build time has exploded only on debug builds, as per the following profiling information of the whole project (which isn’t just the file in question, but still a good metric; the file in question takes the most time to build):

  • Debug: 8 minutes 50 seconds
  • Release: 4 minutes, 25 seconds

If you’re curious, here are a few sample do_func’s, context removed. As you can see, I simplified the problem definition a bit to only show the relevant parts. In case you’re wondering, all the self->func calls are calls to boost::signal’s.

static void do_Match_Login(Registry* self, const uint8_t* parameters, uint16_t length)
{
    const uint8_t* paramPtr = parameters;

    std::string p0 = extract_string(parameters, &paramPtr, length);
    std::string p1 = extract_string(parameters, &paramPtr, length);
    int32_t p2 = extract_int32(parameters, &paramPtr, length);
    uint32_t p3 = extract_uint32(parameters, &paramPtr, length);
    tuple<Buffer, size_t, size_t> p4 = extract_blob(parameters, &paramPtr, length);

    return self->Match_Login(p0, p1, p2, p3, p4);
}

static void do_Match_ResponseLogin(Registry* self, const uint8_t* parameters, uint16_t length)
{
    const uint8_t* paramPtr = parameters;

    int32_t p0 = extract_int32(parameters, &paramPtr, length);
    std::string p1 = extract_string(parameters, &paramPtr, length);
    array<uint16_t, 3> p2 = extract_vector(parameters, &paramPtr, length);
    std::string p3 = extract_string(parameters, &paramPtr, length);
    uint8_t p4 = extract_uint8(parameters, &paramPtr, length);
    uint8_t p5 = extract_uint8(parameters, &paramPtr, length);
    uint64_t p6 = extract_MUID(parameters, &paramPtr, length);
    bool p7 = extract_bool(parameters, &paramPtr, length);
    tuple<Buffer, size_t, size_t> p8 = extract_blob(parameters, &paramPtr, length);

    return self->Match_ResponseLogin(p0, p1, p2, p3, p4, p5, p6, p7, p8);
}
  • 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-15T02:06:10+00:00Added an answer on May 15, 2026 at 2:06 am

    You can turn off variable tracking. Variable tracking is used to make the debug information a bit more valuable, but if this code is auto-generated and you’re not really going to be debugging it much then it’s not really useful. You can just turn it off for that file only.

    gcc -fno-var-tracking ...
    

    Should do the trick. As I said, I think you can just do it for that file.

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

Sidebar

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.