summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorgabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>2011-08-05 20:40:49 +0000
committergabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>2011-08-05 20:40:49 +0000
commit021ee9c32be65c298de20adb021ba6066e674200 (patch)
treee77b24c977093b3a73423a83003cde6ebe1321f7 /doc
parent1bfbe76b4e3677c6ba5cff0a94b7c90a47d58d25 (diff)
downloadleveldb-021ee9c32be65c298de20adb021ba6066e674200.tar.gz
C binding for leveldb, better readseq benchmark for SQLite.
- Added a C binding for LevelDB. May be useful as a stable ABI that can be used by programs that keep leveldb in a shared library, or for JNI API. - Replaced SQLite's readseq benchmark to a more efficient version. SQLite readseq speeds increased by about a factor of 2x from the previous version. Also updated benchmark page to reflect readseq speed up. git-svn-id: https://leveldb.googlecode.com/svn/trunk@46 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'doc')
-rw-r--r--doc/bench/db_bench_sqlite3.cc26
-rw-r--r--doc/benchmark.html14
2 files changed, 25 insertions, 15 deletions
diff --git a/doc/bench/db_bench_sqlite3.cc b/doc/bench/db_bench_sqlite3.cc
index a15510e..e11db52 100644
--- a/doc/bench/db_bench_sqlite3.cc
+++ b/doc/bench/db_bench_sqlite3.cc
@@ -23,7 +23,6 @@
// fillseq100K -- write N/1000 100K values in sequential order in async mode
// readseq -- read N times sequentially
// readrandom -- read N times in random order
-// readseq100K -- read N/1000 100K values in sequential order in async mode
// readrand100K -- read N/1000 100K values in sequential order in async mode
static const char* FLAGS_benchmarks =
"fillseq,"
@@ -38,7 +37,7 @@ static const char* FLAGS_benchmarks =
"readseq,"
"fillrand100K,"
"fillseq100K,"
- "readseq100K,"
+ "readseq,"
"readrand100K,"
;
@@ -387,7 +386,7 @@ class Benchmark {
Write(write_sync, SEQUENTIAL, FRESH, num_ / 1000, 100 * 1000, 1);
WalCheckpoint(db_);
} else if (name == Slice("readseq")) {
- Read(SEQUENTIAL, 1);
+ ReadSequential();
} else if (name == Slice("readrandom")) {
Read(RANDOM, 1);
} else if (name == Slice("readrand100K")) {
@@ -395,11 +394,6 @@ class Benchmark {
reads_ /= 1000;
Read(RANDOM, 1);
reads_ = n;
- } else if (name == Slice("readseq100K")) {
- int n = reads_;
- reads_ /= 1000;
- Read(SEQUENTIAL, 1);
- reads_ = n;
} else {
known = false;
if (name != Slice()) { // No error message for empty name
@@ -640,6 +634,22 @@ class Benchmark {
ErrorCheck(status);
}
+ void ReadSequential() {
+ int status;
+ sqlite3_stmt *pStmt;
+ std::string read_str = "SELECT * FROM test ORDER BY key";
+
+ status = sqlite3_prepare_v2(db_, read_str.c_str(), -1, &pStmt, NULL);
+ ErrorCheck(status);
+ for (int i = 0; i < reads_ && SQLITE_ROW == sqlite3_step(pStmt); i++) {
+ bytes_ += sqlite3_column_bytes(pStmt, 1) + sqlite3_column_bytes(pStmt, 2);
+ FinishedSingleOp();
+ }
+
+ status = sqlite3_finalize(pStmt);
+ ErrorCheck(status);
+ }
+
};
}
diff --git a/doc/benchmark.html b/doc/benchmark.html
index a0d6b02..c463977 100644
--- a/doc/benchmark.html
+++ b/doc/benchmark.html
@@ -130,8 +130,8 @@ parameters are varied. For the baseline:</p>
<td class="c2">1,010,000 ops/sec</td>
<td class="c3"><div class="bkct" style="width:95px">&nbsp;</div></td>
<tr><td class="c1">SQLite3</td>
- <td class="c2">174,000 ops/sec</td>
- <td class="c3"><div class="bsql" style="width:15px">&nbsp;</div></td>
+ <td class="c2">383,000 ops/sec</td>
+ <td class="c3"><div class="bsql" style="width:33px">&nbsp;</div></td>
</table>
<h3>B. Random Reads</h3>
<table class="bn bnbase">
@@ -386,9 +386,9 @@ MB.</p>
<td class="c3"><div class="bkct" style="width:72px">&nbsp;</div></td>
<td class="c4">(1.06x baseline)</td></tr>
<tr><td class="c1">SQLite3</td>
- <td class="c2">210,000 ops/sec</td>
- <td class="c3"><div class="bsql" style="width:14px">&nbsp;</div></td>
- <td class="c4">(1.20x baseline)</td></tr>
+ <td class="c2">609,000 ops/sec</td>
+ <td class="c3"><div class="bsql" style="width:41px">&nbsp;</div></td>
+ <td class="c4">(1.59x baseline)</td></tr>
</table>
<h4>Random Reads</h4>
@@ -425,8 +425,8 @@ database.</p>
<td class="c3"><div class="bkct" style="width:88px">&nbsp;</div></td>
<td class="c4">(3.60x baseline)</td></tr>
<tr><td class="c1">SQLite3</td>
- <td class="c2">174,000 ops/sec</td>
- <td class="c3"><div class="bsql" style="width:13px">&nbsp;</div></td>
+ <td class="c2">383,000 ops/sec</td>
+ <td class="c3"><div class="bsql" style="width:27px">&nbsp;</div></td>
<td class="c4">(1.00x baseline)</td></tr>
</table>
<h4>Random Reads</h4>