I created a google apps script deployed as a web app executed as "user_deploying" and accessible by "anyone_anonymos". Executing this with Rhino takes 343ms and executing this with V8 takes 45,042ms, as calculated at the Marks in the below code. Why the difference and how can I increase the performance of V8, specifically Mark II?
Execution time averages in ms (rhino/V8):
- 227/497 Mark I - Jdbc.getCloudSqlConnection()
- 112/44,497 Mark II - While(results.next()) {}
- 5/49 Mark III - close connections
the code:
// GET SCENARIO LIST
function getScenarioQuickList() {
var start = new Date().getTime();
var conn = Jdbc.getCloudSqlConnection('jdbc:google:mysql://...', user, userPwd);
var query = 'SELECT a.`lvl`, a.`pubShort`, a.`scenTitle`, a.`pdfLink`';
query += 'FROM `SA` a WHERE a.`scenId` <> "ZZZ99998" AND a.`scenId` <> "ZZZ99999" ORDER BY a.`scenId`;';
var stmt = conn.prepareStatement(query);
var results = stmt.executeQuery();
var scenList = [];
console.log(new Date().getTime()-start); // mark 1
// Push results to array
start = new Date().getTime();
while (results.next()) {
scenList.push({
'lvl': results.getString(1),
'pubShort': results.getString(2),
'scenTitle': results.getString(3),
'pdfLink': results.getString(4),
}); // close push
} // close while
console.log(new Date().getTime()-start); // mark 2
start = new Date().getTime();
results.close();
stmt.close();
conn.close();
console.log(new Date().getTime()-start); // mark 3
return scenList;
}