[Igarden-commit] Garden/source/Database Persist.cp,1.41,1.41.2.1
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2006-12-09 21:33:45
|
Update of /cvsroot/igarden/Garden/source/Database In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv23207 Modified Files: Tag: Release_branch_v1 Persist.cp Log Message: Experiment with using view.Find() instead of searching fields. Index: Persist.cp =================================================================== RCS file: /cvsroot/igarden/Garden/source/Database/Persist.cp,v retrieving revision 1.41 retrieving revision 1.41.2.1 diff -C2 -d -r1.41 -r1.41.2.1 *** Persist.cp 21 Jun 2006 02:14:26 -0000 1.41 --- Persist.cp 9 Dec 2006 21:33:43 -0000 1.41.2.1 *************** *** 36,39 **** --- 36,40 ---- #include "SourceMaterialFile.h" #include "RGDateTime.h" + #include "XGTimer.h" typedef struct *************** *** 61,64 **** --- 62,67 ---- #define DATED_REF_SIZE (DATED_REF_UID_SIZE+DATED_REF_DATE_SIZE) + using yaaf::XGTimer; + // --------------------------------------------------------------------------- /// SetFlexCount *************** *** 1570,1583 **** { Int32 n, count; - Persist *result = NULL; c4_View view = *(viewPtr->Get_c4View()); View::Release(file->GetStorage(), viewName); c4_BytesProp bytes(vc->FieldName(pid)); - c4_Row row; c4_Bytes buf; ! XGUUID testUID; ! count = view.GetSize(); ! for(n = 0; n < count && result == NULL; n++) { // !!!!How to handle seeing if a property is there? --- 1573,1591 ---- { Int32 n, count; c4_View view = *(viewPtr->Get_c4View()); View::Release(file->GetStorage(), viewName); c4_BytesProp bytes(vc->FieldName(pid)); c4_Bytes buf; ! ! // As of December 9 2006, Searching an unsorted view with metakit was faster than ! // using find(). ! #if TIME_FIND ! TTIME start1, end1, end2; ! static double total1 = 0.0, total2 = 0.0, numTotals = 0.0; ! ! start1 = XGTimer::Ticks(); ! #endif count = view.GetSize(); ! for(n = 0; n < count && !found; n++) { // !!!!How to handle seeing if a property is there? *************** *** 1585,1596 **** if(CIstrcmp(reinterpret_cast<const char*>(buf.Contents()), txt) == 0) { ! String str; ! resultRow = n; - // if(GetString(pid, str)) - // viewPtr->RemoveKeyString(pid, str.c_str()) viewPtr->AddKeyString(pid, txt, n); } } } --- 1593,1617 ---- if(CIstrcmp(reinterpret_cast<const char*>(buf.Contents()), txt) == 0) { ! found = true; resultRow = n; viewPtr->AddKeyString(pid, txt, n); } } + #if TIME_FIND + end1 = XGTimer::Ticks(); + long resultRow2 = -1; + + c4_StringProp indexStr(vc->FieldName(pid)); + indexStr(row)=txt; + resultRow2 = view.Find(row,0); + end2 = XGTimer::Ticks(); + total2 += end2-end1; + + total1 += end1-start1; + numTotals += 1.0; + printf("Ticks 1=%lf 2=%lf\n", total1/numTotals, total2/numTotals); + if(resultRow != resultRow2) + printf("***** Rows are not equal ***** (%ld vs. %ld)\n", resultRow, resultRow2); + #endif } |