Skip to content

Commit

Permalink
chore: add simple benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
norskeld committed Jul 29, 2023
1 parent eedae5e commit 3525b27
Show file tree
Hide file tree
Showing 8 changed files with 8,647 additions and 3 deletions.
934 changes: 934 additions & 0 deletions benchmarks/package-lock.json

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions benchmarks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "1.0.0",
"name": "@nrsk/backpack-benchmarks",
"description": "Benchmarks for @nrsk/backpack",
"private": true,
"scripts": {
"bench:perf": "tsx src/perf.ts",
"bench:size": "tsx src/size.ts"
},
"dependencies": {
"benny": "^3.7.1"
},
"devDependencies": {
"@faker-js/faker": "^8.0.2",
"@msgpack/msgpack": "^3.0.0-beta2",
"@nrsk/unindent": "^1.0.0",
"@types/benchmark": "^2.1.2",
"tsx": "^3.12.7"
}
}
23 changes: 23 additions & 0 deletions benchmarks/src/data/faker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { faker } from '@faker-js/faker'

faker.seed(42)

export function createFakeUser(length: number) {
return Array.from({ length }, () => ({
id: faker.string.uuid(),
linkedin: null,
picture: faker.internet.avatar(),
isActive: faker.datatype.boolean(),
name: faker.person.fullName(),
company: faker.company.name(),
balance: faker.commerce.price({ min: 100, max: 1000000 }),
age: faker.helpers.rangeToNumber({ min: 18, max: 70 }),
title: faker.person.jobTitle(),
birthdate: faker.date.birthdate(),
clients: Array.from({ length: faker.helpers.rangeToNumber({ min: 0, max: 100 }) }, () => ({
id: faker.string.uuid(),
firstName: faker.person.firstName(),
lastName: faker.person.lastName()
}))
}))
}
Loading

0 comments on commit 3525b27

Please sign in to comment.