add demo application (benchmark)

This commit is contained in:
Géry Debongnie
2019-03-18 11:35:03 +01:00
parent 050025a922
commit cf289323c8
10 changed files with 175 additions and 5 deletions
+22
View File
@@ -0,0 +1,22 @@
export const messages = [];
const authors = ["Aaron", "David", "Vincent"];
const content = [
"Lorem ipsum dolor sit amet",
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem",
"Excepteur sint occaecat cupidatat non proident"
];
function chooseRandomly(array) {
const index = Math.floor(Math.random() * array.length);
return array[index];
}
for (let i = 1; i < 6000; i++) {
messages.push({
id: i,
author: chooseRandomly(authors),
msg: `${i}: ${chooseRandomly(content)}`,
likes: 0
});
}