Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Mynij-unit-tests
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
Alexandra Rogova
Mynij-unit-tests
Commits
9475c85f
Commit
9475c85f
authored
Dec 09, 2019
by
Alexandra Rogova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
started clean up
parent
ac2c2b3a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
62 deletions
+47
-62
add_random_csv_attachments_bench.js
add_random_csv_attachments_bench.js
+2
-55
results/add_random_csv_attachment.csv
results/add_random_csv_attachment.csv
+4
-7
run_scripts_sync.js
run_scripts_sync.js
+41
-0
No files found.
add_random_csv_attachments_bench.js
View file @
9475c85f
var
childProcess
=
require
(
'
child_process
'
);
const
execa
=
require
(
'
execa
'
);
var
run
=
require
(
'
./run_scripts_sync
'
).
run
;
const
fs
=
require
(
'
fs
'
);
var
stream
=
fs
.
createWriteStream
(
"
./results/add_random_csv_attachment.csv
"
,
{
flags
:
'
a
'
});
function
writeResult
(
items
,
info
){
stream
.
write
(
items
+
"
,
"
+
info
+
"
\n
"
);
}
function
runScriptSync
(
list
,
callback
)
{
if
(
list
.
length
===
0
)
return
;
var
invoked
=
false
,
to_run
=
list
.
pop
();
process
=
childProcess
.
fork
(
to_run
.
scriptPath
,
to_run
.
args
);
process
.
on
(
'
message
'
,
function
(
mes
){
console
.
log
(
to_run
.
amount
+
"
:
"
+
mes
)
writeResult
(
to_run
.
amount
,
mes
);
runScriptSync
(
list
,
callback
);
});
process
.
on
(
'
error
'
,
function
(
err
)
{
if
(
invoked
)
return
;
invoked
=
true
;
callback
(
err
);
});
process
.
on
(
'
exit
'
,
function
(
code
)
{
if
(
invoked
)
return
;
invoked
=
true
;
var
err
=
code
===
0
?
null
:
new
Error
(
'
exit code
'
+
code
);
callback
(
err
);
});
setTimeout
(()
=>
{
writeResult
(
to_run
.
amout
,
"
Timeout error
"
);
process
.
kill
();
return
;
},
7200000
);
//2 hours
}
fs
.
truncateSync
(
"
./results/add_random_csv_attachment.csv
"
);
stream
.
write
(
"
items,ramUsed,memUsed
\n
"
);
...
...
@@ -44,22 +9,4 @@ for(var i = 1000000; i > 0; i-=1000){
to_run
.
push
({
scriptPath
:
'
./add_random_csv.js
'
,
args
:
[
"
-p
"
,
i
,
"
-s
"
,
"
attachment
"
],
amount
:
i
});
}
// var to_run = [{scriptPath : './add_random_csv.js', args : ["-p", 100000, "-s", "attachment"], amount : 100000},
// {scriptPath : './add_random_csv.js', args : ["-p", 425000, "-s", "attachment"], amount : 425000},
// {scriptPath : './add_random_csv.js', args : ["-p", 400000, "-s", "attachment"], amount : 400000},
// {scriptPath : './add_random_csv.js', args : ["-p", 350000, "-s", "attachment"], amount : 350000},
// {scriptPath : './add_random_csv.js', args : ["-p", 325000, "-s", "attachment"], amount : 325000},
// {scriptPath : './add_random_csv.js', args : ["-p", 300000, "-s", "attachment"], amount : 300000},
// {scriptPath : './add_random_csv.js', args : ["-p", 250000, "-s", "attachment"], amount : 250000},
// {scriptPath : './add_random_csv.js', args : ["-p", 225000, "-s", "attachment"], amount : 225000},
// {scriptPath : './add_random_csv.js', args : ["-p", 200000, "-s", "attachment"], amount : 200000},
// {scriptPath : './add_random_csv.js', args : ["-p", 150000, "-s", "attachment"], amount : 150000},
// {scriptPath : './add_random_csv.js', args : ["-p", 125000, "-s", "attachment"], amount : 125000},
// {scriptPath : './add_random_csv.js', args : ["-p", 100000, "-s", "attachment"], amount : 100000},
// {scriptPath : './add_random_csv.js', args : ["-p", 50000, "-s", "attachment"], amount : 50000},
// {scriptPath : './add_random_csv.js', args : ["-p", 10000, "-s", "attachment"], amount : 10000},
// {scriptPath : './add_random_csv.js', args : ["-p", 5000, "-s", "attachment"], amount : 5000},
// {scriptPath : './add_random_csv.js', args : ["-p", 1000, "-s", "attachment"], amount : 1000},
// {scriptPath : './add_random_csv.js', args : ["-p", 100, "-s", "attachment"], amount : 100}];
runScriptSync
(
to_run
,
function
(
err
)
{
if
(
err
)
throw
err
;});
run
(
to_run
,
"
./results/add_random_csv_attachment.csv
"
,
function
(
err
)
{
if
(
err
)
throw
err
;});
results/add_random_csv_attachment.csv
View file @
9475c85f
items,ramUsed,memUsed
100,53.3,0
1000,102,0
5000,203.6,0
10000,318.2,75.9
50000,955.9,521.8
100000,1532.1,1258.8
500000,ERROR,ERROR
1000,-371.4140625,511.953125
2000,80.359375,61.76171875
3000,50.1640625,128.7734375
4000,159.91796875,28.36328125
run_scripts_sync.js
0 → 100644
View file @
9475c85f
module
.
exports
=
{
run
:
function
(
list
,
filepath
,
callback
)
{
var
childProcess
=
require
(
'
child_process
'
);
const
fs
=
require
(
'
fs
'
);
var
stream
=
fs
.
createWriteStream
(
filepath
,
{
flags
:
'
a
'
});
var
done
=
false
;
if
(
list
.
length
===
0
)
return
;
var
invoked
=
false
,
to_run
=
list
.
pop
();
process
=
childProcess
.
fork
(
to_run
.
scriptPath
,
to_run
.
args
);
process
.
on
(
'
message
'
,
function
(
mes
){
done
=
true
;
console
.
log
(
to_run
.
amount
+
"
:
"
+
mes
);
stream
.
write
(
to_run
.
amount
+
"
,
"
+
mes
+
"
\n
"
);
module
.
exports
.
run
(
list
,
filepath
,
callback
);
});
process
.
on
(
'
error
'
,
function
(
err
)
{
if
(
invoked
)
return
;
invoked
=
true
;
callback
(
err
);
});
process
.
on
(
'
exit
'
,
function
(
code
)
{
if
(
invoked
)
return
;
invoked
=
true
;
var
err
=
code
===
0
?
null
:
new
Error
(
'
exit code
'
+
code
);
callback
(
err
);
});
setTimeout
(()
=>
{
if
(
!
done
){
stream
.
write
(
to_run
.
amount
+
"
,Timeout error
\n
"
);
process
.
kill
();
return
;
}
},
7200000
);
//2 hours
}
};
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