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

⚡️ Faster ulid mapper function #4098

Merged
merged 3 commits into from
Jul 19, 2023
Merged

⚡️ Faster ulid mapper function #4098

merged 3 commits into from
Jul 19, 2023

Conversation

dubzzz
Copy link
Owner

@dubzzz dubzzz commented Jul 19, 2023

Here are some stats extracted from a benchmark:

┌─────────┬────────┬──────────────────────┬─────────────────────┬─────────────────────┐
│ (index) │  name  │         mean         │         p99         │        p999         │
├─────────┼────────┼──────────────────────┼─────────────────────┼─────────────────────┤
│    0    │ 'old'  │ 0.036524547798902726 │ 0.06470000091940165 │ 0.24509999994188547 │
│    1    │ 'new'  │ 0.02174825419917982  │ 0.04059999994933605 │ 0.24960000067949295 │
│    2    │ 'old2' │ 0.03769995739969145  │ 0.06599999964237213 │ 0.3251000000163913  │
│    3    │ 'new2' │ 0.022186629200091585 │ 0.04079999960958958 │ 0.29510000068694353 │
└─────────┴────────┴──────────────────────┴─────────────────────┴─────────────────────┘

Benchmark have been done using:

const { Bench } = require('tinybench');
const data = [...Array(100)].map(() => Math.floor(Math.random() * 0xffffffffffff));
const bench = new Bench({ warmupIterations: 20, iterations: 1_000_000 });
bench.add('old', () => {
  for (const value of data) {
    uintToBase32StringMapperOld(value, 10);
  }
});
bench.run().then((data) => {
  console.table(data.map((e) => ({ name: e.name, mean: e.result.mean, p99: e.result.p99, p999: e.result.p999 })));
});

Category:

  • ✨ Introduce new features
  • 📝 Add or update documentation
  • ✅ Add or update tests
  • 🐛 Fix a bug
  • 🏷️ Add or update types
  • ⚡️ Improve performance
  • Other(s): ...

Potential impacts:

  • Generated values
  • Shrink values
  • Performance
  • Typings
  • Other(s): ...

Sorry, something went wrong.

dubzzz added 2 commits July 19, 2023 22:08
Here are some stats extracted from a benchmark:

```txt
┌─────────┬────────┬──────────────────────┬─────────────────────┬─────────────────────┐
│ (index) │  name  │         mean         │         p99         │        p999         │
├─────────┼────────┼──────────────────────┼─────────────────────┼─────────────────────┤
│    0    │ 'old'  │ 0.036524547798902726 │ 0.06470000091940165 │ 0.24509999994188547 │
│    1    │ 'new'  │ 0.02174825419917982  │ 0.04059999994933605 │ 0.24960000067949295 │
│    2    │ 'old2' │ 0.03769995739969145  │ 0.06599999964237213 │ 0.3251000000163913  │
│    3    │ 'new2' │ 0.022186629200091585 │ 0.04079999960958958 │ 0.29510000068694353 │
└─────────┴────────┴──────────────────────┴─────────────────────┴─────────────────────┘
```

Benchmark have been done using:

```js
const { Bench } = require('tinybench');
const data = [...Array(100)].map(() => Math.floor(Math.random() * 0xffffffffffff));
const bench = new Bench({ warmupIterations: 20, iterations: 1_000_000 });
bench.add('old', () => {
  for (const value of data) {
    uintToBase32StringMapperOld(value, 10);
  }
});
bench.run().then((data) => {
  console.table(data.map((e) => ({ name: e.name, mean: e.result.mean, p99: e.result.p99, p999: e.result.p999 })));
});
```
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 19, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit abbd342:

Sandbox Source
Vanilla Configuration
@fast-check/examples Configuration

@dubzzz dubzzz enabled auto-merge (squash) July 19, 2023 22:12
@dubzzz dubzzz merged commit 983cf86 into main Jul 19, 2023
@dubzzz dubzzz deleted the faster-ulid-mapper branch July 19, 2023 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant