MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015201 | CMake | CMake | public | 2014-10-09 11:07 | 2015-05-04 09:05 |
Reporter | Knuckles The Dog | ||||
Assigned To | Ben Boeckel | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Apple Mac | OS | OS X 10.9 | OS Version | 10.9 |
Product Version | CMake 3.0.2 | ||||
Target Version | CMake 3.2 | Fixed in Version | CMake 3.2 | ||
Summary | 0015201: Xcode generator is unusably slow on large projects | ||||
Description | I am building a large project, over a thousand CMakeList.txt files resulting in hundreds of Xcode projects being generated. This takes at least 6 times longer than the same makefile generation. I have profiled cmake 3.0.2 and found a significant bottleneck in cmGlobalXCodeGenerator::FindXCodeTarget() because the objects are stored in a vector and this vector has to be iterated over each time to find a target. This is done thousands of times in the course of generating the Xcode project. As a quick fix I did the following: cmGlobalXCodeGenerator.h, added member var: std::unordered_map<const cmTarget*, cmXCodeObject*> mXcodeObjectMap; cmGlobalXCodeGenerator.cpp void cmGlobalXCodeGenerator::ClearXCodeObjects() added to end of method: mXcodeObjectMap.clear(); cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget) Under call to target->SetTarget(...) added: mXcodeObjectMap[&cmtarget] = target; cmGlobalXCodeGenerator::CreateXCodeTarget(...) Under call to target->SetTarget(...) added: mXcodeObjectMap[&cmtarget] = target; cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t) rewrote to: cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget(cmTarget const* t) { if(!t) { return 0; } std::unordered_map<const cmTarget*, cmXCodeObject*>::iterator iter = mXcodeObjectMap.find(t); if (iter == mXcodeObjectMap.end()) { return 0; } return iter->second; } So basically rather than constantly iterating through a vector for the Xcode object with the right target, it now keeps an unordered map where the key is the target pointer, and the object is the Xcode object. This reduces the lookup time enormously. With only this change the generation of the project I'm working on goes down from well over an hour to around 10 mins, which puts it inline with the makefile generator performance. | ||||
Steps To Reproduce | Build a large set of projects. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2014-10-09 11:07 | Knuckles The Dog | New Issue | |||
2014-10-09 11:12 | Brad King | Assigned To | => Ben Boeckel | ||
2014-10-09 11:12 | Brad King | Status | new => assigned | ||
2014-10-09 11:12 | Brad King | Target Version | => CMake 3.2 | ||
2014-12-01 12:59 | Ben Boeckel | Note Added: 0037337 | |||
2014-12-01 12:59 | Ben Boeckel | Status | assigned => acknowledged | ||
2014-12-02 11:17 | Brad King | Note Added: 0037358 | |||
2014-12-02 11:17 | Brad King | Status | acknowledged => resolved | ||
2014-12-02 11:17 | Brad King | Resolution | open => fixed | ||
2014-12-02 11:17 | Brad King | Fixed in Version | => CMake 3.2 | ||
2015-05-04 09:05 | Robert Maynard | Note Added: 0038687 | |||
2015-05-04 09:05 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|