Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

GCC C11 compiler is slow and need to be upgraded.

Revision en1, by shinlena, 2024-05-02 21:25:40

The current C11 compiler is GCC 5.1.0, which is very old compared to the latest GCC version : 13.2.1

This doesn't only prevent use of more modern C standards like C17/C2X

But the assembly it outputs is also significantly slower than the newer C++ compiler.

Here is my code for a recent problem 1698G2.

Submitted in GCC C11 5.1.0

Submitted in G++ C20 13.2-64

In pretest, C11 runs at ~1000ms, while C++20 runs at 171ms. That's almost 6x slower, just because the compiler is in outdated.

The former submission get hacked by the following generator (TLE, 3sec)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t=1,n=2e5,k=n/3;
    cout << t << "\n";
    cout << n << " " << 1 << " " << n << "\n";
    for(int i=0;i<k;i++)cout << 'a';
    for(int i=2*k;i<n;i++)cout << char('a'+rand()%26);
    for(int i=0;i<k;i++)cout << 'a';
    cout<<'\n';
}

While the latter is fine at ~1500ms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English shinlena 2024-05-02 21:25:40 1383 Initial revision (published)