Code Monkey home page Code Monkey logo

Comments (1)

BurntSushi avatar BurntSushi commented on August 15, 2024

Nice find! There was indeed a pretty big perf regression since I last checked (which has been quite some time by now). Before your fix:

test bench::anchored_literal_long_match      ... bench:       562 ns/iter (+/- 18)
test bench::anchored_literal_long_non_match  ... bench:       158 ns/iter (+/- 0)
test bench::anchored_literal_short_match     ... bench:       564 ns/iter (+/- 7)
test bench::anchored_literal_short_non_match ... bench:       158 ns/iter (+/- 0)
test bench::easy0_1K                         ... bench:      2515 ns/iter (+/- 132) = 407 MB/s
test bench::easy0_32                         ... bench:        62 ns/iter (+/- 1) = 516 MB/s
test bench::easy0_32K                        ... bench:     81260 ns/iter (+/- 576) = 403 MB/s
test bench::easy1_1K                         ... bench:      5593 ns/iter (+/- 3725) = 183 MB/s
test bench::easy1_32                         ... bench:       118 ns/iter (+/- 515) = 271 MB/s
test bench::easy1_32K                        ... bench:    193004 ns/iter (+/- 19035) = 169 MB/s
test bench::hard_1K                          ... bench:    172947 ns/iter (+/- 343) = 5 MB/s
test bench::hard_32                          ... bench:      5620 ns/iter (+/- 48) = 5 MB/s
test bench::hard_32K                         ... bench:   5535176 ns/iter (+/- 87371) = 5 MB/s
test bench::literal                          ... bench:       229 ns/iter (+/- 0)
test bench::match_class                      ... bench:      4211 ns/iter (+/- 88)
test bench::match_class_in_range             ... bench:      4202 ns/iter (+/- 23)
test bench::medium_1K                        ... bench:    149129 ns/iter (+/- 1082) = 6 MB/s
test bench::medium_32                        ... bench:      4849 ns/iter (+/- 64) = 6 MB/s
test bench::medium_32K                       ... bench:   4759628 ns/iter (+/- 85867) = 6 MB/s
test bench::no_exponential                   ... bench:    268274 ns/iter (+/- 474)
test bench::not_literal                      ... bench:      2944 ns/iter (+/- 17)
test bench::one_pass_long_prefix             ... bench:      4176 ns/iter (+/- 10)
test bench::one_pass_long_prefix_not         ... bench:      4180 ns/iter (+/- 10)
test bench::one_pass_short_a                 ... bench:      3150 ns/iter (+/- 19)
test bench::one_pass_short_a_not             ... bench:      3319 ns/iter (+/- 9)
test bench::one_pass_short_b                 ... bench:      2044 ns/iter (+/- 12)
test bench::one_pass_short_b_not             ... bench:      2307 ns/iter (+/- 15)
test bench::replace_all                      ... bench:      2187 ns/iter (+/- 4)

After your fix:

test bench::anchored_literal_long_match      ... bench:       178 ns/iter (+/- 1)
test bench::anchored_literal_long_non_match  ... bench:        64 ns/iter (+/- 0)
test bench::anchored_literal_short_match     ... bench:       178 ns/iter (+/- 1)
test bench::anchored_literal_short_non_match ... bench:        64 ns/iter (+/- 0)
test bench::easy0_1K                         ... bench:      2511 ns/iter (+/- 81) = 407 MB/s
test bench::easy0_32                         ... bench:        61 ns/iter (+/- 1) = 524 MB/s
test bench::easy0_32K                        ... bench:     81274 ns/iter (+/- 771) = 403 MB/s
test bench::easy1_1K                         ... bench:      2999 ns/iter (+/- 860) = 341 MB/s
test bench::easy1_32                         ... bench:       118 ns/iter (+/- 119) = 271 MB/s
test bench::easy1_32K                        ... bench:     95742 ns/iter (+/- 4641) = 342 MB/s
test bench::hard_1K                          ... bench:     36505 ns/iter (+/- 330) = 28 MB/s
test bench::hard_32                          ... bench:      1196 ns/iter (+/- 24) = 26 MB/s
test bench::hard_32K                         ... bench:   1166028 ns/iter (+/- 3484) = 28 MB/s
test bench::literal                          ... bench:       203 ns/iter (+/- 2)
test bench::match_class                      ... bench:      1633 ns/iter (+/- 4)
test bench::match_class_in_range             ... bench:      1656 ns/iter (+/- 4)
test bench::medium_1K                        ... bench:     19639 ns/iter (+/- 244) = 52 MB/s
test bench::medium_32                        ... bench:       667 ns/iter (+/- 46) = 47 MB/s
test bench::medium_32K                       ... bench:    627499 ns/iter (+/- 1669) = 52 MB/s
test bench::no_exponential                   ... bench:    274265 ns/iter (+/- 512)
test bench::not_literal                      ... bench:      1132 ns/iter (+/- 3)
test bench::one_pass_long_prefix             ... bench:       609 ns/iter (+/- 3)
test bench::one_pass_long_prefix_not         ... bench:       614 ns/iter (+/- 2)
test bench::one_pass_short_a                 ... bench:      1153 ns/iter (+/- 11)
test bench::one_pass_short_a_not             ... bench:      1439 ns/iter (+/- 13)
test bench::one_pass_short_b                 ... bench:       785 ns/iter (+/- 4)
test bench::one_pass_short_b_not             ... bench:      1049 ns/iter (+/- 5)
test bench::replace_all                      ... bench:      1190 ns/iter (+/- 4)

These latter benchmarks line up closely with what I recorded last year (scroll to bottom).

Thanks! :D I uploaded this fix to regex_macros in version 0.1.18 on crates.io.

from regex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.