Блог пользователя AcceptedIsRealAbility

Автор AcceptedIsRealAbility, история, 5 лет назад, По-английски

We all know that this line in C++#pragma GCC optimize("Ofast") can optimize most programs.

But specially, the accident(maybe?) happens on me.

Today, I was solving the problem 455D - Serega and Fun with fhq-treap, And I submitted two submissions: 58122597 and 58123225, when first one got AC with no optimization, and the second with 'Ofast' optimization got TLE on test 25.

So I just want to know what kind of programs the 'Ofast' optimization can bring negative optimization?

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by AcceptedIsRealAbility (previous revision, new revision, compare).

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by AcceptedIsRealAbility (previous revision, new revision, compare).

»
5 лет назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

When? Often. Check out what it enables, it's mostly floating point operations and duplicating parts of the code in hopes of decreasing the number of instruction cache misses or the number of times the code has to branch. These things don't matter most of the time. -floop-interchange can be useful, but only if you're writing bad code and it's simple enough that the compiler would notice.