diff --git a/analyze/config.js b/analyze/config.js deleted file mode 100644 index 393684fa..00000000 --- a/analyze/config.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.servers = exports.formattedServerNames = void 0; -exports.formattedServerNames = { - tailcall: "Tailcall", - gqlgen: "Gqlgen", - apollo: "Apollo GraphQL", - netflixdgs: "Netflix DGS", - caliban: "Caliban", - async_graphql: "async-graphql", - hasura: "Hasura", - graphql_jit: "GraphQL JIT", -}; -exports.servers = ["apollo", "caliban", "netflixdgs", "gqlgen", "tailcall", "async_graphql", "hasura", "graphql_jit"]; diff --git a/analyze/dataFileWriter.js b/analyze/dataFileWriter.js deleted file mode 100644 index 67653355..00000000 --- a/analyze/dataFileWriter.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.writeMetricsDataFiles = writeMetricsDataFiles; -var fileUtils_1 = require("./fileUtils"); -function writeMetricsDataFiles(serverMetrics, servers) { - var reqSecData = "/tmp/reqSec.dat"; - var latencyData = "/tmp/latency.dat"; - (0, fileUtils_1.writeDataFile)(reqSecData, "Server Value\n" + servers.map(function (server) { return "".concat(server, " ").concat(serverMetrics[server].reqSec); }).join('\n')); - (0, fileUtils_1.writeDataFile)(latencyData, "Server Value\n" + servers.map(function (server) { return "".concat(server, " ").concat(serverMetrics[server].latency); }).join('\n')); -} diff --git a/analyze/fileUtils.js b/analyze/fileUtils.js deleted file mode 100644 index a7459d1f..00000000 --- a/analyze/fileUtils.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.writeDataFile = writeDataFile; -exports.readFileContent = readFileContent; -exports.moveFile = moveFile; -exports.createDirectoryIfNotExists = createDirectoryIfNotExists; -var fs = require("fs"); -function writeDataFile(filename, data) { - try { - fs.writeFileSync(filename, data); - } - catch (error) { - console.error("Error writing data file ".concat(filename, ": ").concat(error.message)); - } -} -function readFileContent(filename) { - try { - return fs.readFileSync(filename, 'utf-8'); - } - catch (error) { - console.error("Error reading file ".concat(filename, ": ").concat(error.message)); - return ''; - } -} -function moveFile(source, destination) { - try { - if (fs.existsSync(source)) { - fs.renameSync(source, destination); - console.log("Moved ".concat(source, " to ").concat(destination)); - } - else { - console.log("Source file ".concat(source, " does not exist")); - } - } - catch (error) { - console.error("Error moving file ".concat(source, ": ").concat(error.message)); - } -} -function createDirectoryIfNotExists(dir) { - if (!fs.existsSync(dir)) { - try { - fs.mkdirSync(dir); - } - catch (error) { - console.error("Error creating directory: ".concat(error.message)); - } - } -} diff --git a/analyze/gnuplotGenerator.js b/analyze/gnuplotGenerator.js deleted file mode 100644 index ba7296da..00000000 --- a/analyze/gnuplotGenerator.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.generateGnuplotScript = generateGnuplotScript; -exports.writeGnuplotScript = writeGnuplotScript; -var fileUtils_1 = require("./fileUtils"); -function generateGnuplotScript(whichBench, reqSecMax, latencyMax) { - var reqSecHistogramFile = "req_sec_histogram".concat(whichBench, ".png"); - var latencyHistogramFile = "latency_histogram".concat(whichBench, ".png"); - return "\nset term pngcairo size 1280,720 enhanced font 'Courier,12'\nset output '".concat(reqSecHistogramFile, "'\nset style data histograms\nset style histogram cluster gap 1\nset style fill solid border -1\nset xtics rotate by -45\nset boxwidth 0.9\nset title 'Requests/Sec'\nset yrange [0:").concat(reqSecMax, "]\nset key outside right top\nplot '/tmp/reqSec.dat' using 2:xtic(1) title 'Req/Sec'\n\nset output '").concat(latencyHistogramFile, "'\nset title 'Latency (in ms)'\nset yrange [0:").concat(latencyMax, "]\nplot '/tmp/latency.dat' using 2:xtic(1) title 'Latency'\n"); -} -function writeGnuplotScript(script) { - var gnuplotScriptFile = '/tmp/gnuplot_script.gp'; - (0, fileUtils_1.writeDataFile)(gnuplotScriptFile, script); -} diff --git a/analyze/parser.js b/analyze/parser.js deleted file mode 100644 index f2e571da..00000000 --- a/analyze/parser.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseMetric = parseMetric; -exports.calculateAverage = calculateAverage; -exports.parseServerMetrics = parseServerMetrics; -function parseMetric(input, metric) { - var lines = input.split('\n'); - var metricLine; - if (metric === "Latency") { - metricLine = lines.find(function (line) { return line.trim().startsWith("Latency"); }); - } - else if (metric === "Requests/sec") { - metricLine = lines.find(function (line) { return line.trim().startsWith("Requests/sec"); }); - } - if (!metricLine) - return null; - var match = metricLine.match(/([\d.]+)/); - return match ? parseFloat(match[1]) : null; -} -function calculateAverage(values) { - if (values.length === 0) - return 0; - var sum = values.reduce(function (a, b) { return a + b; }, 0); - return sum / values.length; -} -function parseServerMetrics(servers, inputs) { - var serverMetrics = {}; - servers.forEach(function (server, idx) { - var startIdx = idx * 3; - var reqSecVals = []; - var latencyVals = []; - for (var j = 0; j < 3; j++) { - var inputIdx = startIdx + j; - if (inputIdx < inputs.length) { - var reqSec = parseMetric(inputs[inputIdx], "Requests/sec"); - var latency = parseMetric(inputs[inputIdx], "Latency"); - if (reqSec !== null) - reqSecVals.push(reqSec); - if (latency !== null) - latencyVals.push(latency); - } - } - serverMetrics[server] = { - reqSec: calculateAverage(reqSecVals), - latency: calculateAverage(latencyVals) - }; - }); - return serverMetrics; -} diff --git a/analyze/resultsFormatter.js b/analyze/resultsFormatter.js deleted file mode 100644 index f35c5763..00000000 --- a/analyze/resultsFormatter.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.formatResults = formatResults; -exports.writeResults = writeResults; -var fs = require("fs"); -function formatResults(serverMetrics, formattedServerNames, whichBench) { - var sortedServers = Object.keys(serverMetrics).sort(function (a, b) { return serverMetrics[b].reqSec - serverMetrics[a].reqSec; }); - var lastServer = sortedServers[sortedServers.length - 1]; - var lastServerReqSecs = serverMetrics[lastServer].reqSec; - var resultsTable = ""; - if (whichBench === 1) { - resultsTable += "\n| ".concat(whichBench, " | `{ posts { id userId title user { id name email }}}` |"); - } - else if (whichBench === 2) { - resultsTable += "\n| ".concat(whichBench, " | `{ posts { title }}` |"); - } - else if (whichBench === 3) { - resultsTable += "\n| ".concat(whichBench, " | `{ greet }` |"); - } - sortedServers.forEach(function (server) { - var formattedReqSecs = serverMetrics[server].reqSec.toLocaleString(undefined, { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }); - var formattedLatencies = serverMetrics[server].latency.toLocaleString(undefined, { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }); - var relativePerformance = (serverMetrics[server].reqSec / lastServerReqSecs).toFixed(2); - resultsTable += "\n|| [".concat(formattedServerNames[server], "] | `").concat(formattedReqSecs, "` | `").concat(formattedLatencies, "` | `").concat(relativePerformance, "x` |"); - }); - return resultsTable; -} -function writeResults(resultsTable, whichBench) { - var resultsFile = "results.md"; - try { - if (!fs.existsSync(resultsFile) || fs.readFileSync(resultsFile, 'utf8').trim() === '') { - fs.writeFileSync(resultsFile, "\n\n| Query | Server | Requests/sec | Latency (ms) | Relative |\n|-------:|--------:|--------------:|--------------:|---------:|"); - } - fs.appendFileSync(resultsFile, resultsTable); - if (whichBench === 3) { - fs.appendFileSync(resultsFile, "\n\n"); - updateReadme(resultsFile); - } - } - catch (error) { - console.error("Error writing results: ".concat(error.message)); - } -} -function updateReadme(resultsFile) { - try { - var finalResults = fs - .readFileSync(resultsFile, "utf-8") - .replace(/\\/g, ''); // Remove backslashes - var readmePath = "README.md"; - var readmeContent = fs.readFileSync(readmePath, "utf-8"); - var performanceResultsRegex = /[\s\S]*/; - if (performanceResultsRegex.test(readmeContent)) { - readmeContent = readmeContent.replace(performanceResultsRegex, finalResults); - } - else { - readmeContent += "\n".concat(finalResults); - } - fs.writeFileSync(readmePath, readmeContent); - console.log("README.md updated successfully"); - } - catch (error) { - console.error("Error updating README: ".concat(error.message)); - } -} diff --git a/analyze/types.js b/analyze/types.js deleted file mode 100644 index c8ad2e54..00000000 --- a/analyze/types.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true });