Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate js-db and concurrency testing #419

Merged
merged 14 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
},
"block": {
"exceptions": ["*"]
}
},
"markers": ["/"]
}
],
"capitalized-comments": [
Expand Down
20 changes: 10 additions & 10 deletions benches/gitgc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';
import b from 'benny';
import { suiteCommon } from './utils';

async function main () {
async function main() {
let map = new Map();
let obj = {};
let arr: any = [];
Expand All @@ -18,10 +18,10 @@ async function main () {
for (let i = 0; i < 1000; i++) {
map.delete(i);
}
for (const i of map) {
for (const _i of map) {
// NOOP
}
}
};
}),
b.add('obj', async () => {
obj = {};
Expand All @@ -32,26 +32,26 @@ async function main () {
for (let i = 0; i < 1000; i++) {
delete obj[i];
}
for (const i in obj) {
for (const _i in obj) {
// NOOP
}
};
}),
b.add('arr', async () => {
// you first have to count the number of objects
// You first have to count the number of objects
arr = [];
return async () => {
// you have to iterate for each object
// You have to iterate for each object
// then for each value in length
for (let i = 0; i < 1000; i++) {
if (i === arr.length) {
// double the vector
// Double the vector
arr.length = arr.length * 2 || 2;
}
arr[i] = { id: i, mark: false };
// arr.push({ id: i, mark: false});
// Arr.push({ id: i, mark: false});
}
// this has to iterate the length of the array
// This has to iterate the length of the array
// but stop as soon as it reaches the end
// it gets complicate, but for 5x improvement
// it could be interesting
Expand All @@ -74,7 +74,7 @@ async function main () {
for (let i = 0; i < 1000; i++) {
set.delete(i);
}
for (const i of set) {
for (const _i of set) {
// NOOP
}
};
Expand Down
5 changes: 4 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ module.exports = {
// Setup files after env are executed before each test file
// after the jest test environment is installed
// Can access globals
setupFilesAfterEnv: ['<rootDir>/tests/setupAfterEnv.ts'],
setupFilesAfterEnv: [
'jest-extended/all',
'<rootDir>/tests/setupAfterEnv.ts'
],
moduleNameMapper: moduleNameMapper,
};
Loading