Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize queries #188

Merged
merged 2 commits into from
Mar 23, 2015
Merged

Optimize queries #188

merged 2 commits into from
Mar 23, 2015

Conversation

larsmans
Copy link
Contributor

Main change is running three SQLite API functions every time we cross the border to Exec a query.

Before:

BenchmarkExec           500000     162257 req/s
BenchmarkQuery          100000      60699 req/s
BenchmarkParams         100000      56971 req/s
BenchmarkStmt           200000      98856 req/s
BenchmarkRows             5000       1883 req/s
BenchmarkStmtRows         5000       1926 req/s
PASS
ok      github.com/mattn/go-sqlite3 18.560s

After:

BenchmarkExec           500000     172340 req/s
BenchmarkQuery          100000      62041 req/s
BenchmarkParams         100000      58299 req/s
BenchmarkStmt           200000     101137 req/s
BenchmarkRows             5000       1922 req/s
BenchmarkStmtRows         5000       1946 req/s
PASS
ok      github.com/mattn/go-sqlite3 18.178s

(These are single benchmarks, but the speedup in BenchmarkExec is consistent across runs.)

Speeds up the query benchmark by about 5% (Go 1.2.1, Linux x64).
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.15%) to 84.48% when pulling 4dfb2ec on larsmans:optimize into 07f9c9c on mattn:master.

@mattn
Copy link
Owner

mattn commented Mar 23, 2015

LGTM, Thanks!

mattn added a commit that referenced this pull request Mar 23, 2015
@mattn mattn merged commit e28cd44 into mattn:master Mar 23, 2015
@larsmans larsmans deleted the optimize branch March 24, 2015 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants