-/**
- * Intentionally inefficient implementation.
- * @param {number} n - The number of fibonacci numbers to generate.
- * @returns {number} - The nth fibonacci number.
- */
-const fibonacci = n => {
- if (n <= 1) return n
- return fibonacci(n - 1) + fibonacci(n - 2)
-}
-
-/**
- * Intentionally inefficient implementation.
- * @param {number} n - The number to calculate the factorial of.
- * @returns {number} - The factorial of n.
- */
-const factorial = n => {
- if (n === 0) {
- return 1
- }
- return factorial(n - 1) * n
-}
-
-const readWriteFiles = (
- n,
- baseDirectory = `/tmp/poolifier-benchmarks/${crypto.randomInt(
- 281474976710655
- )}`
-) => {
- if (fs.existsSync(baseDirectory) === true) {
- fs.rmSync(baseDirectory, { recursive: true })
- }
- fs.mkdirSync(baseDirectory, { recursive: true })
- for (let i = 0; i < n; i++) {
- const filePath = `${baseDirectory}/${i}`
- fs.writeFileSync(filePath, i.toString(), {
- encoding: 'utf8',
- flag: 'a'
+export const convertTatamiNgToBmf = report => {
+ return report.benchmarks
+ .map(({ name, stats }) => {
+ return {
+ [name]: {
+ latency: {
+ value: stats?.avg,
+ lower_value: stats?.min,
+ upper_value: stats?.max
+ },
+ throughput: {
+ value: stats?.iter
+ }
+ }
+ }