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

  • Home
  • SEARCH
  • 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 167851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:20:56+00:00 2026-05-11T12:20:56+00:00

Updated: The actual resolution that the compile box which served my compile request was

  • 0

Updated: The actual resolution that the compile box which served my compile request was different. In the slower instance I was running code compiled on a SuSE 9 but running on a SuSE 10 box. That was sufficient difference for me to drop it and compare apples to apples. When using the same compile box the results were as follows:

g++ was about two percent slower

delta real 4 minutes delta user 4 mintues delta system 5 seconds

Thanks!

gcc v4.3 vs g++ v4.3 reduced to simplest case used nothing but simple flags

#include <stdio.h> #include <stdlib.h> int main (int argc, char **argv) {     int i=0;     int j=0;     int k=0;     int m=0;     int n=0;     for (i=0;i<1000;i++)         for (j=0;j<6000;j++)             for (k=0;k<12000;k++)             {                  m = i+j+k;                  n=(m+1+1);             }     return 0; } 

Is this a known issue? The 15% is very repro. and is across the board for real, system, and user time. I have to wait to post the assembly until tomorrow.

Update: I have only tried on one of my compile boxes. I am using SuSE 10.

  • 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. 2026-05-11T12:20:57+00:00Added an answer on May 11, 2026 at 12:20 pm

    When compiled with gcc and g++ the only difference I see is within the first 4 lines.

    gcc:

        .file   'loops.c'     .def    ___main;    .scl    2;  .type   32; .endef     .text .globl _main 

    g++:

        .file   'loops.c'     .def    ___main;    .scl    2;  .type   32; .endef     .text     .align 2 .globl _main 

    as you can see the only difference is that with g++, the alignment (2) occurs on a word boundary. This tiny difference seems to be making the significant performance difference.

    Here is a page explaining structure alignment, although it is for ARM/NetWinder it is still applicable as it discusses how alignment works on modern CPUs. You will want to read section 7 specifically ‘What are the disadvantages of word alignment?’ :

    http://netwinder.osuosl.org/users/b/brianbr/public_html/alignment.html

    and here is a reference on the .align operation:

    http://www.nersc.gov/vendor_docs/ibm/asm/align.htm

    Benchmarks as requested:

    gcc:

    john@awesome:~$ time ./loopsC  real    0m21.212s user    0m20.957s sys 0m0.004s 

    g++:

    john@awesome:~$ time ./loopsGPP  real    0m22.111s user    0m21.817s sys 0m0.000s 

    I reduced the inner-most iteration to 1200. Results aren’t as widespread as I had hoped, but then again the assembly output was generated on windows, and the timings done in Linux. Maybe something different is done behind the scenes in MinGW than it is with gcc for Linux alignment-wise.

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

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer EJBs should be fine-grained, so there is no problem with… May 11, 2026 at 3:56 pm
  • added an answer Take a look at the Patterns and Practices Guide -… May 11, 2026 at 3:56 pm
  • added an answer The only time I have ever had trouble with Access… May 11, 2026 at 3:56 pm

Related Questions

Resolution: While trying to recreate this bug in a fresh project to submit to
I need to count the number of elements in an XML file that have
I am experimenting with using subversion to deploy updates to my ASP.Net application, one
With SVN, I had a single big repository I kept on a server, and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.