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

20x times speed up Aws and Azure by using hex #528

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

snuyanzin
Copy link
Collaborator

Usage of hex instead of regexify makes about 20x times faster

Benchmark                         Mode  Cnt      Score     Error   Units
DatafakerSimpleMethods.hex       thrpt   10  22772.434 ± 178.039  ops/ms
DatafakerSimpleMethods.regexify  thrpt   10   1034.842 ± 157.265  ops/ms

for tests

    @Benchmark
    @BenchmarkMode(Mode.Throughput)
    public void regexify(Blackhole blackhole) {
        blackhole.consume(DATA_FAKER.regexify("[a-f0-9]{16}"));
    }

    @Benchmark
    @BenchmarkMode(Mode.Throughput)
    public void hex(Blackhole blackhole) {
        blackhole.consume(DATA_FAKER.random().hex(16, false));
    }

@snuyanzin snuyanzin merged commit 08eb70c into datafaker-net:main Nov 4, 2022
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