Skip to content

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

Merged
snuyanzin merged 1 commit intodatafaker-net:mainfrom
snuyanzin:awshex
Nov 4, 2022
Merged

20x times speed up Aws and Azure by using hex#528
snuyanzin merged 1 commit intodatafaker-net:mainfrom
snuyanzin:awshex

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.

1 participant