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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:43:41+00:00 2026-06-14T17:43:41+00:00

On my testing regular linux box(kernel 3.4), it runs very fast. But when I

  • 0

On my testing regular linux box(kernel 3.4), it runs very fast. But when I move my program to another linux box(kernel 3.0), this function runs very slow, it takes about 2.5ms to return, this is like 500x slower, which causes a big performance problem.

So what might be the possible reason for such a big difference?

  • 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-14T17:43:42+00:00Added an answer on June 14, 2026 at 5:43 pm

    I don’t know why it’s so much slower on your other machine running Linux 3.0; there are many possible reasons, such as a bug in the kernel or some slow hardware. You could determine this empirically. First, see if the issue is the kernel version; install the newer kernel on the machine on which it’s slow, and see if that fixes it. If you can’t do that, you could try installing the old kernel on your dev machine. If it turns out to be based on the kernel version, then you can bisect the kernel history to figure out which commit sped it up so much. See git bisect for details of how to do the bisection. If it’s not a kernel problem, it’s likely a hardware issue.

    Regardless of what introduced the bug, you are going to want to fix it. If you can’t fix it by upgrading your kernel, you can work around it by calling if_nameindex() once, storing the result, and looking up the result in that array. Scanning an array of around 15 items linearly should be pretty fast; much faster than 2.5 ms.

    struct if_nameindex* cached_nameindex = NULL;
    
    int if_nametoindex_cached(char *name) {
      if (!cached_nameindex) {
        cached_nameindex = if_nameindex();
        if (!cached_nameindex) {
          perror("failed to get nameindex");
          exit(1);
        }
      }
    
      for (struct if_nameindex *ni = cached_nameindex; ni->if_name; ++ni) {
        if (!strcmp(ni->if_name, name))
          return ni->if_index;
      }
    
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this code for email validation: function validateEmail(){ //testing regular expression var
I'm trying to use this regular expression, but I'm having trouble testing it, because
I've just come across this in javascript which seems to be testing for regular
I'm looking for a regular expression testing program that I had installed on my
I've got the following regular expression that works fine on my testing server, but
I found a very useful regular expression for testing format and content of a
This is irridating and regular error message > install.packages('manipulate') Installing package(s) into ‘/home/h/R/i686-pc-linux-gnu-library/2.13’ (as
I have a string like this: This is a {{text}} for {{testing}} PHP {{regular
I have a wpf app with a regular combobox. When testing this app in
While there are many good online and offline tools for testing regular expressions, I

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.