Ada Direct I/O B-Tree vs SQLite benchmark
2. The approach
3. The benchmark
CREATE TABLE test_table (key TEXT PRIMARY KEY, value TEXT)The B-tree benchmark used an instance Persistent.Memory_Pools.Streams.Generic_External_B_Tree with String key and String value.
The benchmark was compiled without optimization. Two platforms were used for test environment:
Platform OS CPU GNAT A Windows 7 64-bit SP1 Intel i7-2700K 3.5GHz GPL 2014 (20140331) B Fedora 20 64-bit Intel Core 2 6600 2.4GHz 4.8.3 (20140624)
3.1 Insert testIn this test 1000 randomly generated keys and values pairs were inserted into the table and the tree. Both random sequences used the same seed. SQLite insertion test used this prepared statement:
INSERT INTO test_table VALUES (?, ?)Both tests committed each insertion.
Insertion test Time, ms
A B SQLite 56.068 254.926 B-Tree 0.196 0.278
3.2 Search testAll generated keys were used to extract the corresponding value. SQLite search test used this prepared statement:
SELECT value FROM test_table WHERE key=?In both tests the result was compared against expected value.
Search test Time, ms
A B SQLite 0.0449 0.0267 B-Tree 0.0133 0.0204
3.3 Update testIn this test for each generated key the corresponding value was changed to twice longer one. SQLite test used this prepared statement:
UPDATE test_table SET value=? WHERE key=?Both tests committed each update.
Update test Time, ms
A B SQLite 76.077 250.144 B-Tree 0.247 0.293
3.4 Deletion testIn this test a half of generated keys was removed. The SQLite test used the following prepared statement:
DELETE FROM test_table WHERE key=?Both tests committed each delete.
Delete test Time, ms
A B SQLite 94.989 275.070 B-Tree 0.283 0.309
4. Building the benchmark
Go to the subdirectory test_components and compile the test:mkdir test
zcat components_4_5.tgz | tar -xvf -
Run the test:cd test_components
gcc -c ../sqlite-sources/sqlite3.c
gnatmake -I.. test_sqlite_benchmark.adb -largs sqlite3.o -ldl