kika: (Default)
[personal profile] kika
MSVC 2005 умеет параллельный билд. Круто, не прошло и 10 лет, как мелкософт сдул таки наконец фичу из GNU Make. Собираю проект, состоящий из десятка компонент на С и одного на С++. Наблюдаю приемлемую загрузку обоих процессоров, компилируется быстро.... пока С. Как начинает С++, так загрузка только одного горшка и тормоза. Либо мелкософт не умеет параллельно компилировать С++, либо ихняя компиляция параллелизуется только на уровне проектов.
Блядь, ну как так можно, а?

Date: 2007-08-24 01:28 am (UTC)
From: [identity profile] msh.livejournal.com
что-то мне помнится что в параллельной компиляции C++ есть проблема - в какой момет и где инстатиатить темплейты чтобы кода был один экземпляр. А может я и гоню

Date: 2007-08-24 01:39 am (UTC)
From: [identity profile] yanis.livejournal.com
i also wonder if this is because of the templates - it could try to consolidate identical templates in some repository (some compilers do this) and its being dumb about it.
why dont you create a library?

Date: 2007-08-24 09:40 am (UTC)
From: [identity profile] rblaze.livejournal.com
Нет такой проблемы.
В Borland модели они генерятся каждый раз, а линкер потом выкидывает все экземпляры, кроме одного.
В AT&T модели надо ручками указывать, где и когда создать инстанс.

Разве что Microsoft отличился и придумал что-то своё...

Date: 2007-08-24 09:48 am (UTC)
From: [identity profile] kika.livejournal.com
Ну уж в дебаг билде-то можно было и не париться такими проблемами.

Date: 2007-08-24 09:50 am (UTC)
From: [identity profile] kika.livejournal.com
Because making a library involves one more build step which in turn increases build time. I don't give a shit how long release build takes, but I'm deeply concerned about debug builds.

Date: 2007-08-24 10:46 am (UTC)
From: [identity profile] yanis.livejournal.com
why do you need to recompile everything for your "debug build"? don't you have a set of relatively stable and invariant files - that's what can be put into a library or a group of libraries? if most of the project is in C this should be easily doable, otherwise, of course, if you're constantly modifying the C++ class declarations you're fucked.

Date: 2007-08-24 11:03 am (UTC)
From: [identity profile] kika.livejournal.com
Most of the project is in C and this code is mostly in libraries indeed. But the small portion of the project, written in C++ takes as much time to compile as the rest. And coincidentally this is the code I'm writing and compiling in ms2005 and yes, I'm sloppy enough to modify class declarations all the time. The code is Qt-based thus for almost each class declaration I have twice as much recompile as usual (MOC + implementation).

Date: 2007-08-29 12:17 am (UTC)
From: [identity profile] pzz.livejournal.com
Зачем вообще нужны дебаг билды, кто бы мне объяснил? Чтобы париться со всеми этими проблемами "в дебаге работает, в релизе - нет"? Ничего другого про дебаг билды я никогда не слышал...

Date: 2007-08-29 12:21 am (UTC)
From: [identity profile] pzz.livejournal.com
Ты, поди, moc напускаешь на свой C++? Вероятно, мелкософт не рискует параллелить то, где есть вызов внешней программы.

Date: 2007-08-29 12:21 am (UTC)
From: [identity profile] kika.livejournal.com
Чтобы оно не оптимизировало и чтобы можно было отладчиком пользоваться. Знаешь такое слово?

Date: 2007-08-29 12:57 am (UTC)
From: [identity profile] kika.livejournal.com
С чего бы. Известно что на входе, описано что на выходе, граф построить - школьник справится.

Date: 2007-09-21 09:32 pm (UTC)
From: [identity profile] ifp5.livejournal.com
Как начинает С++, так загрузка только одного горшка и тормоза.

Так это же плюсы. Темплейты поди используются, boost, все дела. Как известно, в плюсах темплейты обладают немярянной вычислительной способностью (Turing completeness), поэтому можно писать корректные с точки зрения языка программы, компиляция которых:
1) занимает неограниченное время (например, больше жизни вселенной :> )
2) отнимает сколько угодно памяти

У вас сколько компилируется вот такая вот простенькая программа?
#include 

using namespace std;

template < bool cond, int true_result, int false_result > struct if_;

template < int true_result, int false_result >
struct if_ < true, true_result, false_result > {
  enum { val = true_result };
};
template < int true_result, int false_result >
struct if_ < false, true_result, false_result > {
  enum { val = false_result };
};

template < int m, int n >
struct ack {
  enum {
    val = ack< m - 1, ack< m, n - 1 >::val >::val
  };
};

template < int n >
struct ack< 0, n > {
  enum { val = n + 1 };
};

template < int m >
struct ack< m, 0 > {
  enum { val = ack< m - 1, 1 >::val };
};

int main () {
  cout << "ack(3,10) = " << ack< 3, 10  >::val << endl;
}

У меня:
$ time g++ -ftemplate-depth-100000 ack.cpp

real    3m5.732s
user    3m4.447s
sys     0m0.403s


Если слишком быстро, рекомендую поиграться со вторым параметром. :)

Date: 2007-09-21 09:35 pm (UTC)
From: [identity profile] ifp5.livejournal.com
Блин, в первой строке стояло "#include " ++ left angle bracket ++ "iostream" ++ right angle bracket, но ее покторежил гадский жж.

Date: 2007-09-22 06:08 am (UTC)
From: [identity profile] kika.livejournal.com
Ну у меня все просто:
tt.cpp(19) : fatal error C1202: recursive type or function dependency context too complex

Profile

kika: (Default)
kika

January 2017

S M T W T F S
1234567
89 1011121314
151617181920 21
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 16th, 2026 05:50 pm
Powered by Dreamwidth Studios