V8 vs V9

I was running a couple be benchmarks to see the difference in performance between V8 & V9 .The test drawing had 66138 entities, about 4000 blocks, with about 1800 of those blocks having attributes. The task was essentially the same as express tools burst command, which actually does a lot of work.V9 Duration: 7.4410 seconds V8 Duration: 30.9740 seconds Great Job guys! Test code:

class CommandBurst : public OdStaticRxObject<OdEdCommand>{public: const OdString localName() const { return globalName(); } const OdString groupName() const { return OdString(_T("DRXGLOBAL")); } const OdString globalName() const { return OdString(_T("Burst")); }  void execute(OdEdCommandContext* pCmdCtx) { clock_t start; clock_t end; double diff; start = clock();  ASSERT(pCmdCtx);   if(pCmdCtx == NULL) return;  OdDbCommandContextPtr pDbCmdCtx(pCmdCtx); OdDbUserIOPtr pDbIO = pDbCmdCtx->dbUserIO(); OdDbDatabasePtr pDb = pDbCmdCtx->database();  try { if(pDb.isNull()) throw OdError(eNoDatabase);  OdRxObjectPtrArray entsToAdd; OdDbObjectId layerId = pDb->getCLAYER();//++-- we will put everything on the clayer  //my Custom selection set class pDbIO->putString(DD_T("\nSelect Blocks")); struct resbuf *filter = sds_buildlist(RTDXF0,_T("INSERT"),66/*attrib*/,1,RTNONE); SelectionSet set(filter); OdDbSelectionSetPtr pSelectionSet = set.Select();  if(pSelectionSet.isNull()) throw OdError(DD_T("Selection Set is NULL"));  OdDbObjectIdArray ids = pSelectionSet->objectIdArray();  //++-- progressmeter OdDbHostAppProgressMeter* meter = pDb->appServices()->newProgressMeter(); meter->setLimit(ids.length()); meter->start();  for(OdUInt32 i = 0 ; i < ids.length() ; i++ , entsToAdd.clear()) { meter->meterProgress();  OdDbObjectPtr objectPtr = ids[i].openObject(OdDb::kForRead); if(objectPtr.isNull()) continue;  if(!objectPtr->isKindOf(OdDbBlockReference::desc())) continue;  OdDbBlockReferencePtr pBlockReference = objectPtr; if(pBlockReference.isNull()) continue;  OdDbObjectIteratorPtr pAttributeIterator = pBlockReference->attributeIterator();  for (pAttributeIterator->start(); !pAttributeIterator->done(); pAttributeIterator->step()) { OdDbAttributePtr pAttribute = pAttributeIterator->objectId().openObject(OdDb::kForRead);  OdDbTextPtr pText = OdDbText::createObject(); pText->setTextString(pAttribute->textString()); pText->setColor(pAttribute->color()); pText->setHeight(pAttribute->height()); pText->setPosition(pAttribute->position()); pText->setRotation(pAttribute->rotation()); pText->setTextStyle(pAttribute->textStyle()); pText->setVerticalMode(pAttribute->verticalMode()); pText->setLayer(layerId); entsToAdd.push_back(pText.get()); }  pBlockReference->explode(entsToAdd); pBlockReference->upgradeOpen(); pBlockReference->erase();  OdDbBlockTableRecordPtr pBtr = pBlockReference->ownerId().openObject(OdDb::kForWrite);  if(pBtr.isNull()) continue;  for(OdUInt32 j = 0 ; j < entsToAdd.length(); j++) { OdDbEntityPtr ePtr = OdDbEntity::cast(entsToAdd[j]); if(!ePtr->isKindOf(OdDbAttributeDefinition::desc())) pBtr->appendOdDbEntity(ePtr); } } meter->stop(); pDbIO->putString(DD_T("\n.")); } catch (OdError& e) { pDbIO->putString(DD_T("An Exception occurred: ") + e.description()); } catch (...) { pDbIO->putString(DD_T("\nAn Unknown Exception occurred")); } end = clock(); diff = ((double)(end - start)) / CLOCKS_PER_SEC; sds_printf(_T("\nDuration: %2.4f seconds"), diff); }};
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!