I tried this program in both Orwell DevC++ and Visual Studio 2013 (program works correctly). My astonishment is the performance of the same program in both IDEs. While the former took only 395 milliseconds, the latter took a whooping 34984 milliseconds. What's wrong with VS2013? Is it due to the compiler it uses? Or is it something else?// Airport Simulation using vector#include<iostream>#include<chrono>#include<random>#include<vector>using namespace std;int time_unit=1;int gen_rno(int lim){    static default_random_engine dre (chrono::steady_clock::now().time_since_epoch().count());      // feeding a seed to dre so that everytime a different number is generated    static uniform_int_distribution<int> uid {1,lim};    return uid(dre);}struct flight{    int fno, fuel, ta, tl, td;  // ta : arrival time & d & l represent landing & departure    static int f;    flight()    {        fno=++f;        fuel=gen_rno(25);   // generate random no        ta=tl=td=time_unit;    }    void get_fno()    {        cout<<Flight no: <<fno<< ;    }};int flight :: f=0;class runway{    vector<flight> lq, dq;      //lq : landing queue & dq: departure queue    int count, crash, land, take_off;    double tbal, tbld;      //tb : time interval between    public:        runway();        void genq();    //generate queue        void check_low_fuel();        void landing();        void departure();        void fuel_reduction();        void end_of_simulation();};runway :: runway(){        lq.reserve(10000), dq.reserve(1000);        crash=land=take_off=tbal=tbld=0;        int d=gen_rno(10), i;        for (i=0;i<d;++i)        dq.emplace_back();}void runway :: genq(){    int l=gen_rno(10);    for (int i=0;i<l;++i)    lq.emplace_back();}void runway :: check_low_fuel(){    int c=0;    auto i=lq.begin();    for (int j=0;j<lq.size();++j)    {        i=lq.begin()+j;        if (i->fuel==0)        {            ++c;            i->get_fno();            cout<<has crashed\n;            lq.erase(i);        }        else if (i->fuel==1)        {            lq.emplace(lq.begin(),*i);            lq.erase(i);        }           }    crash+=c;    cout<<No of crashes = <<c<<\n;}void runway :: fuel_reduction(){    for (int i=0;i<lq.size();++i)    --lq.at(i).fuel;}void runway :: landing(){    count=0;    for (int i=0;i<lq.size() && count<6;++i,++count)    {        lq.front().get_fno();        lq.front().tl=time_unit;        tbal+=lq.front().tl-lq.front().ta;        cout<<has landed\n;        dq.emplace_back(lq.front());        lq.erase(lq.begin());        ++land;    }    cout<<No of successful landings were = <<count<<\n;}void runway :: departure(){    if (count<6)    {        int x=count;        for (int i=0;i<lq.size() && count<6;++i,++count)        {            dq.front().get_fno();            dq.front().td=time_unit;            tbld+=dq.front().td-dq.front().tl;            cout<<has taken off\n;            dq.erase(dq.begin());            ++take_off;        }        cout<<No of successful departures were = <<count-x<<'\n';    }}void runway :: end_of_simulation(){    lq.shrink_to_fit(), dq.shrink_to_fit();    double avg1=tbal/land, avg2=tbld/take_off;    cout<<\n\naverage time elapsed between arrival & landing is = <<avg1<<\naverage time elapsed between landing & take_off is = <<avg2;    cout<<\nsuccessful landings = <<land<<\nsuccesful departures = <<take_off<<\ncrashes = <<crash;}int main(){    auto t1=chrono::steady_clock::now();    ios::sync_with_stdio(false);    runway r;    cout<<\t\tAIRPORT SIMULATION\n\n;    for (time_unit=1;time_unit<=1000;++time_unit)    {        cout<<Time Unit: <<time_unit<<\n;        r.genq();        r.check_low_fuel();        r.landing();        r.departure();        r.fuel_reduction();        cout<<'\n';    }    r.end_of_simulation();    auto t2=chrono::steady_clock::now();    cout<<\n<<chrono::duration_cast<chrono::milliseconds>(t2-t1).count();    return 0;}
Airport Simulator
c++;performance;c++11;simulation