use of com.orientechnologies.orient.core.iterator.ORecordIteratorClass in project orientdb by orientechnologies.
the class BrowseSpeedTest method browseClusters.
protected void browseClusters() {
ODatabaseDocumentTx db = openDatabase();
final long total = db.countClass(className);
ORecordIteratorClass iterator = new ORecordIteratorClass(db, db, className, true);
long start = System.currentTimeMillis();
int loaded = 0;
ORecord rec;
while (iterator.hasNext()) {
rec = iterator.next();
if (rec != null)
loaded++;
}
long end = System.currentTimeMillis();
System.out.println("Iterator " + total + " and loaded " + loaded + " took " + (end - start));
db.close();
}
use of com.orientechnologies.orient.core.iterator.ORecordIteratorClass in project orientdb by orientechnologies.
the class OCommandExecutorSQLResultsetAbstract method searchInClasses.
protected Iterator<? extends OIdentifiable> searchInClasses(final OClass iCls, final boolean iPolymorphic, final boolean iAscendentOrder) {
final ODatabaseDocumentInternal database = getDatabase();
database.checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_READ, iCls.getName().toLowerCase());
final ORID[] range = getRange();
if (iAscendentOrder)
return new ORecordIteratorClass<ORecord>(database, database, iCls.getName(), iPolymorphic, isUseCache(), false).setRange(range[0], range[1]);
else
return new ORecordIteratorClassDescendentOrder<ORecord>(database, database, iCls.getName(), iPolymorphic).setRange(range[0], range[1]);
}
use of com.orientechnologies.orient.core.iterator.ORecordIteratorClass in project orientdb by orientechnologies.
the class OSelectStatement method searchInClasses.
protected Iterator<? extends OIdentifiable> searchInClasses(final OClass iCls, final boolean iPolymorphic, final boolean iAscendentOrder) {
final ODatabaseDocumentInternal database = getDatabase();
database.checkSecurity(ORule.ResourceGeneric.CLASS, ORole.PERMISSION_READ, iCls.getName().toLowerCase());
// TODO
final ORID[] range = new ORID[2];
// TODO
boolean useCache = false;
if (iAscendentOrder)
return new ORecordIteratorClass<ORecord>(database, database, iCls.getName(), iPolymorphic, useCache, false).setRange(range[0], range[1]);
else
return new ORecordIteratorClassDescendentOrder<ORecord>(database, database, iCls.getName(), iPolymorphic).setRange(range[0], range[1]);
}
use of com.orientechnologies.orient.core.iterator.ORecordIteratorClass in project orientdb by orientechnologies.
the class IteratorSpeedTest method testIterationSpeed.
public void testIterationSpeed() {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:speedTest");
db.create();
OClass oClass = db.getMetadata().getSchema().createClass("SpeedTest");
for (int i = 0; i < 1000000; i++) {
ODocument document = new ODocument("SpeedTest");
document.save();
}
ORecordIteratorClass iterator = new ORecordIteratorClass(db, db, "SpeedTest", true);
iterator.setRange(new ORecordId(oClass.getDefaultClusterId(), 999998), new ORecordId(oClass.getDefaultClusterId(), 999999));
long start = System.nanoTime();
while (iterator.hasNext()) iterator.next();
long end = System.nanoTime();
System.out.println(end - start);
db.drop();
}
use of com.orientechnologies.orient.core.iterator.ORecordIteratorClass in project orientdb by orientechnologies.
the class BrowseSpeedTest method browseClusters.
protected void browseClusters() {
ODatabaseDocumentTx db = openDatabase();
final long total = db.countClass(CLASS);
ORecordIteratorClass iterator = new ORecordIteratorClass(db, db, CLASS, true);
long start = System.currentTimeMillis();
int loaded = 0;
ORecord rec;
while (iterator.hasNext()) {
rec = iterator.next();
if (rec != null)
loaded++;
}
long end = System.currentTimeMillis();
System.out.println("Iterator " + total + " and loaded " + loaded + " took " + (end - start));
db.close();
}
Aggregations