SQLite vs CDB_File vs BerkeleyDB
http://www.perlmonks.org/?node_id=152749
メモ。
Benchmark: timing 30000 iterations of I B+Tree, I B+Tree (A), I Hash, I Hash (A), I SQLite, I SQLite 2... I B+Tree: 1 wallclock secs ( 0.88 usr + 0.11 sys = 0.98 CPU) @ 30487.80/s (n=30000) I B+Tree (A): 1 wallclock secs ( 0.95 usr + 0.02 sys = 0.97 CPU) @ 30959.75/s (n=30000) I Hash: 8 wallclock secs ( 2.25 usr + 4.38 sys = 6.63 CPU) @ 4528.30/s (n=30000) I Hash (A): 7 wallclock secs ( 2.31 usr + 4.58 sys = 6.89 CPU) @ 4353.50/s (n=30000) I SQLite: 76 wallclock secs (14.84 usr + 49.66 sys = 64.50 CPU) @ 465.12/s (n=30000) I SQLite 2: 4 wallclock secs ( 3.30 usr + 0.09 sys = 3.39 CPU) @ 8849.56/s (n=30000) Rate I SQLite I Hash (A) I Hash I SQLite 2 I B+Tree I B+Tree (A) I SQLite 465/s -- -89% -90% -95% -98% -98% I Hash (A) 4354/s 836% -- -4% -51% -86% -86% I Hash 4528/s 874% 4% -- -49% -85% -85% I SQLite 2 8850/s 1803% 103% 95% -- -71% -71% I B+Tree 30488/s 6455% 600% 573% 245% -- -2% I B+Tree (A) 30960/s 6556% 611% 584% 250% 2% -- Benchmark: timing 30000 iterations of S B+Tree, S B+Tree(A), S Hash, S Hash(A), S SQLite, S SQLite 2... S B+Tree: 1 wallclock secs ( 0.77 usr + 0.09 sys = 0.86 CPU) @ 34965.03/s (n=30000) S B+Tree(A): 1 wallclock secs ( 0.95 usr + 0.05 sys = 1.00 CPU) @ 30000.00/s (n=30000) S Hash: 2 wallclock secs ( 1.03 usr + 1.63 sys = 2.66 CPU) @ 11295.18/s (n=30000) S Hash(A): 3 wallclock secs ( 1.47 usr + 1.36 sys = 2.83 CPU) @ 10608.20/s (n=30000) S SQLite: 11 wallclock secs ( 6.80 usr + 3.69 sys = 10.49 CPU) @ 2861.23/s (n=30000) S SQLite 2: 4 wallclock secs ( 3.89 usr + 0.09 sys = 3.98 CPU) @ 7530.12/s (n=30000) Rate S SQLite S SQLite 2 S Hash(A) S Hash S B+Tree(A) S B+Tree S SQLite 2861/s -- -62% -73% -75% -90% -92% S SQLite 2 7530/s 163% -- -29% -33% -75% -78% S Hash(A) 10608/s 271% 41% -- -6% -65% -70% S Hash 11295/s 295% 50% 6% -- -62% -68% S B+Tree(A) 30000/s 948% 298% 183% 166% -- -14% S B+Tree 34965/s 1122% 364% 230% 210% 17% -- Resulting File Sizes: bdb.hash.test :5226496 bdb.btree.test :6701056 bdb.hash.a.test :5095424 bdb.btree.a.test :3579904 sqlite.test :3845120 sqlite2.test :2043904