Skip to content

Commit 1509aa6

Browse files
authored
chore(benchmarks): cleanup the gabe benchmarks a bit (#27005)
1 parent 2e9a38b commit 1509aa6

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

benchmarks/gabe-csv-markdown/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ yarn-error.log
6969
.yarn-integrity
7070

7171
gendata.csv
72+
yarn.lock

benchmarks/gabe-csv-markdown/gen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const FILE = path.resolve("gendata.csv")
1111
// We then hand that off to markdown
1212

1313
console.log("Now generating " + N + " articles into", FILE)
14-
fs.writeFileSync(FILE, "articleContent,a,b,c\n")
14+
fs.writeFileSync(FILE, "articleContent\n")
1515

1616
function createArticle(n) {
1717
const title = faker.lorem.sentence()
@@ -47,7 +47,7 @@ ${faker.lorem.paragraphs(2)}
4747
'"' + pageContent
4848
.trim()
4949
.replace(/"/g, '""')
50-
+ '",1,2,3' +
50+
+ '"' +
5151
"\n" // markdown does care about newlines
5252
)
5353
}

benchmarks/gabe-csv-text/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ yarn-error.log
6969
.yarn-integrity
7070

7171
gendata.csv
72+
yarn.lock

benchmarks/gabe-csv-text/gen.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ function createArticle(n) {
3737
<p>${faker.lorem.paragraphs(1)}</p>
3838
`,
3939
]
40-
.map(s =>
41-
s
42-
.trim()
43-
// Need to escape newlines and commas
44-
.replace(/,/g, "\\,")
45-
.replace(/\n/g, "") // html don't care about newlines
46-
)
40+
// Can only escape double quotes, by doubling them
41+
.map(s => s.trim().replace(/"/g, '""'))
42+
// Can only use commas and newlines in text by double-quote wrapping them. Or by removing them
43+
.map(s => `"${s}"`)
4744
.join(",") + "\n"
4845
)
4946
}

benchmarks/gabe-fs-markdown/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ yarn-error.log
6969
.yarn-integrity
7070

7171
generated_articles
72+
yarn.lock

benchmarks/gabe-fs-mdx/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ public/
44
.env
55
generated_articles
66
.DS_Store
7+
yarn.lock

0 commit comments

Comments
 (0)