-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add performance tests #7443
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
Open
Open
Add performance tests #7443
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
e83dbec
add performance tests
archmoj 012abca
collect performance data and create test report
archmoj 0d9eb56
skip testing against averageCap for now
archmoj d7bf5b5
convert raw data to CSV
archmoj 9f60776
wait for actual rendering to complete
archmoj 12f73ad
download CSV file
archmoj 2a4bc1b
revise CSV table
archmoj ba4327c
store CSV
archmoj 855eaa2
collect system info for performance tests
archmoj c46e7c6
combine all csv files
archmoj 0e63814
do not display the JSON for now
archmoj 5d2e5bb
simplify tests only keep raw results
archmoj 94b2fe0
add violin tests
archmoj b532cb0
add scattergl tests
archmoj ef345ef
refactor tests
archmoj 33620b7
revisit tests
archmoj b6dac79
extend scattergl
archmoj 543478e
extend bar
archmoj ff93b2e
extend box
archmoj e3cd7b5
extend violin
archmoj 0b0642a
extend histogram
archmoj 1227e2a
revise download csv
archmoj cd5da32
add markers+lines cases
archmoj a4aa436
use normal arrays in tests
archmoj 98252d4
add scattergeo tests
archmoj 3134b61
set nSamples to 4
archmoj d4f3af2
format test messages
archmoj 5d30519
revisit test descriptions
archmoj c99d887
combine all tests
archmoj bcb165d
improve tests
archmoj b9611ae
fix time calculation
archmoj f6aa0ab
remove console.log
archmoj 80ac7ae
add delay between tests
archmoj fad4b36
improve collecting csv if the last one fails
archmoj cd874dd
fail rendering after 4 seconds
archmoj 3fd0dfc
add test descriptions
archmoj d2baf67
delay was not helpful for passing on CI
archmoj 577f7ac
pass arguments to isolate performance tests
archmoj c8dd83b
run each tests case in isolation
archmoj 99e9efd
organise output files
archmoj d92d356
test extra points
archmoj a98fd66
revise test setup
archmoj ea673bc
refactor test
archmoj 8974efe
create CSV for failed cases
archmoj 0f80d1b
fix Download path
archmoj ce3f075
Merge branch 'master' into performance-tests
archmoj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
tasks/system_info.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
var os = require('os'); | ||
|
||
var logs = []; | ||
function addLog(str) { | ||
logs.push(str) | ||
} | ||
|
||
var systemInfo = { | ||
platform: os.platform(), | ||
type: os.type(), | ||
arch: os.arch(), | ||
release: os.release(), | ||
version: os.version ? os.version() : 'Unknown', | ||
hostname: os.hostname(), | ||
homedir: os.homedir(), | ||
tmpdir: os.tmpdir(), | ||
endianness: os.endianness(), | ||
}; | ||
|
||
addLog('💻 SYSTEM:'); | ||
addLog(` Platform: ${systemInfo.platform}`); | ||
addLog(` Type: ${systemInfo.type}`); | ||
addLog(` Architecture: ${systemInfo.arch}`); | ||
addLog(` Release: ${systemInfo.release}`); | ||
addLog(` Hostname: ${systemInfo.hostname}`); | ||
|
||
|
||
var cpus = os.cpus(); | ||
var loadAvg = os.loadavg(); | ||
|
||
var cpuInfo = { | ||
model: cpus[0].model, | ||
speed: cpus[0].speed, | ||
cores: cpus.length, | ||
loadAverage: loadAvg, | ||
cpuDetails: cpus | ||
}; | ||
|
||
addLog(''); | ||
addLog('🔧 CPU:'); | ||
addLog(` Model: ${cpuInfo.model}`); | ||
addLog(` Speed: ${cpuInfo.speed} MHz`); | ||
addLog(` Cores: ${cpuInfo.cores}${cpuInfo.physicalCores ? ` (${cpuInfo.physicalCores} physical)` : ''}`); | ||
addLog(` Load Average: ${loadAvg.map(load => load.toFixed(2)).join(', ')}`); | ||
|
||
|
||
var totalMem = os.totalmem(); | ||
var freeMem = os.freemem(); | ||
var usedMem = totalMem - freeMem; | ||
|
||
var memoryInfo = { | ||
total: totalMem, | ||
free: freeMem, | ||
used: usedMem, | ||
usagePercent: (usedMem / totalMem) * 100 | ||
}; | ||
|
||
function formatBytes(bytes, decimals = 2) { | ||
if (bytes === 0) return '0 Bytes'; | ||
if (!bytes) return 'Unknown'; | ||
|
||
var k = 1024; | ||
var dm = decimals < 0 ? 0 : decimals; | ||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']; | ||
var i = Math.floor(Math.log(bytes) / Math.log(k)); | ||
|
||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; | ||
} | ||
|
||
addLog(''); | ||
addLog('💾 MEMORY:'); | ||
addLog(` Total: ${formatBytes(memoryInfo.total)}`); | ||
addLog(` Used: ${formatBytes(memoryInfo.used)} (${memoryInfo.usagePercent.toFixed(1)}%)`); | ||
addLog(` Free: ${formatBytes(memoryInfo.free)}`); | ||
|
||
|
||
console.log(logs.join('\n')); |
110 changes: 110 additions & 0 deletions
tasks/test_performance.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var exec = require('child_process').exec; | ||
var { glob } = require('glob'); | ||
var runSeries = require('run-series'); | ||
|
||
var constants = require('./util/constants'); | ||
var pathToJasminePerformanceTests = constants.pathToJasminePerformanceTests; | ||
var pathToRoot = constants.pathToRoot; | ||
|
||
/** | ||
* Run all jasmine 'performance' test in series | ||
* | ||
* To run specific performance tests, use | ||
* | ||
* $ npm run test-jasmine -- --performanceTest=<name-of-suite> | ||
*/ | ||
|
||
var testCases = require('../test/jasmine/performance_tests/assets/test_cases').testCases; | ||
|
||
glob(pathToJasminePerformanceTests + '/*.js').then(function(files) { | ||
var tasks = []; | ||
for(let file of files) { | ||
for(let testCase of testCases) { | ||
tasks.push(function(cb) { | ||
var cmd = [ | ||
'karma', 'start', | ||
path.join(constants.pathToRoot, 'test', 'jasmine', 'karma.conf.js'), | ||
'--performanceTest=' + path.basename(file), | ||
'--nowatch', | ||
'--tracesType=' + testCase.traceType, | ||
'--tracesMode=' + testCase.mode, | ||
'--tracesCount=' + testCase.nTraces, | ||
'--tracesPoints=' + testCase.n, | ||
].join(' '); | ||
|
||
console.log('Running: ' + cmd); | ||
|
||
exec(cmd, function(err) { | ||
cb(null, err); | ||
}).stdout.pipe(process.stdout); | ||
}); | ||
} | ||
} | ||
|
||
runSeries(tasks, function(err, results) { | ||
var failed = results.filter(function(r) { return r; }); | ||
|
||
if(failed.length) { | ||
console.log('\ntest-performance summary:'); | ||
failed.forEach(function(r) { console.warn('- ' + r.cmd + ' failed'); }); | ||
console.log(''); | ||
|
||
// Create CSV file for failed cases | ||
var str = [ | ||
'number of traces', | ||
'chart type & mode', | ||
'data points', | ||
'run id', | ||
'rendering time(ms)' | ||
].join(',') + '\n'; | ||
|
||
failed.forEach(function(r) { | ||
// split command string frist by space then by equal to get | ||
var cmdArgs = r.cmd.split(' ').map(part => { | ||
return part.split('='); | ||
}); | ||
|
||
var test = {}; | ||
|
||
for(var i = 0; i < cmdArgs.length; i++) { | ||
if('--tracesCount' === cmdArgs[i][0]) { | ||
test.nTraces = cmdArgs[i][1]; | ||
} | ||
} | ||
|
||
for(var i = 0; i < cmdArgs.length; i++) { | ||
if('--tracesType' === cmdArgs[i][0]) { | ||
test.traceType = cmdArgs[i][1]; | ||
} | ||
} | ||
|
||
for(var i = 0; i < cmdArgs.length; i++) { | ||
if('--tracesMode' === cmdArgs[i][0]) { | ||
test.mode = cmdArgs[i][1]; | ||
} | ||
} | ||
|
||
for(var i = 0; i < cmdArgs.length; i++) { | ||
if('--tracesPoints' === cmdArgs[i][0]) { | ||
test.n = cmdArgs[i][1]; | ||
} | ||
} | ||
|
||
str += [ | ||
(test.nTraces || 1), | ||
(test.traceType + (test.mode ? ' ' + test.mode : '')), | ||
test.n, | ||
'failed', | ||
'' | ||
].join(',') + '\n'; | ||
}); | ||
|
||
var failedCSV = pathToRoot + '../Downloads/failed.csv'; | ||
console.log('Saving:', failedCSV) | ||
console.log(str); | ||
fs.writeFileSync(failedCSV, str); | ||
} | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.