Hello!
This is my problem:
- I create a new empty database
- then I put 10.000 objects and this takes about 2xx ms
- commit
- I read 100 objects from the database and this takes about 42xx ms (4 seconds and 2xx ms)
Is this a normal value? It seems to me too big. Can you tell me if i'm doing something wrong, or how to speed up the reads?
Thanks.
I run this program on an high performance laptop (3GB RAM, 2.2Ghz dual core ...)
I use a simple POJO object to be persisted: only 1 private field (int) .
This is the code i use to execute this very simple test:
public static void main(String[] args) {
new File("database_file").delete();
ObjectContainer db = Db4o.openFile("database_file");
long start = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
db.store(new Number(i));
}
System.out.println("time: " + (System.currentTimeMillis()-start));
db.commit();
System.out.println("size: " + db.queryByExample(new Number()).size());
start = System.currentTimeMillis();
for (int i = 0; i < 100; i++) {
db.queryByExample(new Number(i));
}
System.out.println("time: " + (System.currentTimeMillis()-start));
db.close();
}