ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

To Admins: About the C/C++ Compiler
Послано Seyyed Mehran Kholdi (HalfBloodCoder) 17 сен 2008 17:29
I found an amazing fact about the compiler. My code (when compiled using c++ compiler) runs in 0.001 second, and when I compile it using C compiler runs in 0.015 second, and the use the same memory. So why should someone use the C compiler? (Also, I heard that C codes, run faster than C++ ones)
2234052    17:25:47
17 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1087    C++    Accepted
    0.001    149 KB
2234051    17:25:37
17 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1087    C    Accepted
    0.015    149 KB
Re: To Admins: About the C/C++ Compiler
Послано Denis Koshman 17 сен 2008 21:01
Submit it around 10 times and you'll see that execution time is different. Cache hits, concurrent compilations/tests, etc... All of this has effect. AFAIK, I even saw different memory consumption (within a few KB) for the same code submitted several times.
Re: To Admins: About the C/C++ Compiler
Послано Seyyed Mehran Kholdi (HalfBloodCoder) 19 сен 2008 17:46
I had many other experiences, but the same result.
even I tested it on another problems. as you can see:
2236738    17:43:35
19 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1260    C++    Accepted
    0.001    141 KB
2236737    17:43:25
19 Sep 2008    Seyyed Mehran Kholdi (HalfBloodCoder)    1260    C    Accepted
    0.015    141 KB
Again, another weakness in the C compiler. I guess the optimizer (compiler) does not work well for C