MCPcopy Create free account
hub / github.com/KDE/kdevelop / addItemDelayed

Method addItemDelayed

kdevplatform/project/tests/projectmodelperformancetest.cpp:133–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void ProjectModelPerformanceTest::addItemDelayed()
134{
135 QElapsedTimer timer;
136 timer.start();
137 ProjectBaseItem* parent = nullptr;
138 Path path;
139 if( !currentParent.isEmpty() ) {
140 parent = currentParent.top();
141 path = Path(parent->path(), QStringLiteral("f%1").arg(parent->rowCount()));
142 } else {
143 path = Path(QUrl::fromLocalFile(QStringLiteral("/f%1").arg(model->rowCount())));
144 }
145 ProjectBaseItem* item = nullptr;
146 if( currentParent.size() < BIG_DEPTH ) {
147 item = new ProjectFolderItem(nullptr, path, parent);
148 } else {
149 item = new ProjectFileItem( nullptr, path, parent );
150 }
151 if( currentParent.isEmpty() ) {
152 model->appendRow( item );
153 }
154
155 // Abort/Continue conditions are:
156 // Go one level deeper (by pushing item on stack) as long as we haven't reached the max depth or the max width
157 // else if we've reached the max width then pop, i.e go one level up
158 // else the next run will add a sibling to the just-generated item
159 if( currentParent.size() < BIG_DEPTH && ( currentParent.isEmpty() || currentParent.top()->rowCount() < BIG_WIDTH ) ) {
160 currentParent.push( item );
161 } else if( !currentParent.isEmpty() && currentParent.top()->rowCount() >= BIG_WIDTH ) {
162 currentParent.pop();
163 }
164 if( ( currentParent.isEmpty() && ( model->rowCount() - originalWidth ) < BIG_WIDTH ) || !currentParent.isEmpty() ) {
165 QTimer::singleShot( 0, this, &ProjectModelPerformanceTest::addItemDelayed );
166 }
167 qDebug() << "addBigTreeDelayed" << timer.elapsed();
168}
169
170void ProjectModelPerformanceTest::addSmallTree()
171{

Callers

nothing calls this directly

Calls 11

topMethod · 0.80
appendRowMethod · 0.80
elapsedMethod · 0.80
PathClass · 0.50
startMethod · 0.45
isEmptyMethod · 0.45
pathMethod · 0.45
rowCountMethod · 0.45
sizeMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected