Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sqlite3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
node-sqlite3
Commits
7fbb4ee5
Commit
7fbb4ee5
authored
Mar 15, 2010
by
Orlando Vazquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up simple speed test
parent
db452fdd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
test3.js
test3.js
+17
-17
No files found.
test3.js
View file @
7fbb4ee5
...
...
@@ -20,11 +20,7 @@ var db = new sqlite.Database();
// // });
// });
fs
.
unlink
(
"speedtest.db"
,
function
()
{
db
.
open
(
"speedtest.db"
,
function
()
{
puts
(
inspect
(
arguments
));
puts
(
"open cb"
);
function
readTest
()
{
function
readTest
(
db
)
{
var
t0
=
new
Date
;
var
count
=
i
=
100
;
var
rows
=
0
;
...
...
@@ -34,20 +30,16 @@ fs.unlink("speedtest.db", function () {
puts
(
"**** "
+
count
+
" selects in "
+
d
+
"s ("
+
(
count
/
d
)
+
"/s) "
+
rows
+
" rows total ("
+
(
rows
/
d
)
+
" rows/s)"
);
return
;
}
if
(
!
(
i
%
(
count
/
10
)))
{
puts
(
"--- "
+
i
);
}
db
.
query
(
"SELECT * FROM t1"
,
function
(
error
,
results
)
{
rows
=
rows
+
results
.
length
;
process
.
nextTick
(
innerFunc
);
innerFunc
(
);
});
};
innerFunc
();
}
}
db
.
query
(
"CREATE TABLE t1 (alpha INTEGER)"
,
function
()
{
puts
(
"create table callback"
+
inspect
(
arguments
));
function
writeTest
(
db
,
callback
)
{
var
t0
=
new
Date
;
var
count
=
i
=
10000
;
var
innerFunc
=
function
()
{
...
...
@@ -55,18 +47,26 @@ fs.unlink("speedtest.db", function () {
var
d
=
((
new
Date
)
-
t0
)
/
1000
;
puts
(
"**** "
+
count
+
" insertions in "
+
d
+
"s ("
+
(
count
/
d
)
+
"/s)"
);
process
.
nextTick
(
readTest
);
callback
(
db
);
return
;
};
if
(
!
(
i
%
(
count
/
10
)))
{
puts
(
"--- "
+
i
);
}
db
.
query
(
"INSERT INTO t1 VALUES (?);"
,
[
1
],
function
()
{
process
.
nextTick
(
innerFunc
);
innerFunc
(
);
});
};
innerFunc
();
}
fs
.
unlink
(
"speedtest.db"
,
function
()
{
db
.
open
(
"speedtest.db"
,
function
()
{
puts
(
inspect
(
arguments
));
puts
(
"open cb"
);
db
.
query
(
"CREATE TABLE t1 (alpha INTEGER)"
,
function
()
{
puts
(
"create table callback"
+
inspect
(
arguments
));
writeTest
(
db
,
readTest
);
});
});
});
...
...
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