Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gosqlite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gosqlite
Commits
6507fe03
Commit
6507fe03
authored
Mar 03, 2012
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix benchmarks.
parent
8c9aafd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
12 deletions
+18
-12
bench_test.go
bench_test.go
+18
-12
No files found.
bench_test.go
View file @
6507fe03
...
...
@@ -22,17 +22,19 @@ func BenchmarkValuesScan(b *testing.B) {
b
.
StopTimer
()
db
,
_
:=
Open
(
""
)
defer
db
.
Close
()
fill
(
db
,
1000
)
fill
(
db
,
1
)
cs
,
_
:=
db
.
Prepare
(
"SELECT float_num, int_num, a_string FROM test"
)
defer
cs
.
Finalize
()
b
.
StartTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
cs
,
_
:=
db
.
Prepare
(
"SELECT float_num, int_num, a_string FROM test"
)
values
:=
make
([]
interface
{},
3
)
for
Must
(
cs
.
Next
())
{
if
Must
(
cs
.
Next
())
{
cs
.
ScanValues
(
values
)
}
cs
.
Finalize
()
cs
.
Reset
()
}
}
...
...
@@ -40,20 +42,22 @@ func BenchmarkScan(b *testing.B) {
b
.
StopTimer
()
db
,
_
:=
Open
(
""
)
defer
db
.
Close
()
fill
(
db
,
1000
)
fill
(
db
,
1
)
cs
,
_
:=
db
.
Prepare
(
"SELECT float_num, int_num, a_string FROM test"
)
defer
cs
.
Finalize
()
b
.
StartTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
cs
,
_
:=
db
.
Prepare
(
"SELECT float_num, int_num, a_string FROM test"
)
var
fnum
float64
var
inum
int64
var
sstr
string
for
Must
(
cs
.
Next
())
{
if
Must
(
cs
.
Next
())
{
cs
.
Scan
(
&
fnum
,
&
inum
,
&
sstr
)
}
cs
.
Finalize
()
cs
.
Reset
()
}
}
...
...
@@ -61,20 +65,22 @@ func BenchmarkNamedScan(b *testing.B) {
b
.
StopTimer
()
db
,
_
:=
Open
(
""
)
defer
db
.
Close
()
fill
(
db
,
1000
)
fill
(
db
,
1
)
cs
,
_
:=
db
.
Prepare
(
"SELECT float_num, int_num, a_string FROM test"
)
defer
cs
.
Finalize
()
b
.
StartTimer
()
for
i
:=
0
;
i
<
b
.
N
;
i
++
{
cs
,
_
:=
db
.
Prepare
(
"SELECT float_num, int_num, a_string FROM test"
)
var
fnum
float64
var
inum
int64
var
sstr
string
for
Must
(
cs
.
Next
())
{
if
Must
(
cs
.
Next
())
{
cs
.
NamedScan
(
"float_num"
,
&
fnum
,
"int_num"
,
&
inum
,
"a_string"
,
&
sstr
)
}
cs
.
Finalize
()
cs
.
Reset
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment