lucene icon indicating copy to clipboard operation
lucene copied to clipboard

Create a simple "real world" regexp benchmark [LUCENE-9986]

Open asfimport opened this issue 5 years ago • 6 comments

For issues like #11022, where we are struggling to decide which low-level optimizations to make for our (complicated!) determinize method, it would really help to have a large, real-world corpus of regexps to evaluate performance metrics of our automata operations, like CPU and HEAP required to parse the regexp and determinize.

Does anyone know of such an existing, hopefully compatibly licensed, corpus?

Probably we would add these benchmarks to luceneutil.


Migrated from LUCENE-9986 by Michael McCandless (@mikemccand)

asfimport avatar Jun 02 '21 11:06 asfimport

Michael Sokolov (@msokolov) (migrated from JIRA)

This SO post links to many test suites in various open source projects. Not sure which would be best/best licensed for copying here?

asfimport avatar Jun 02 '21 12:06 asfimport

Hi, I’d love to take on this issue as my first open-source contribution. I’m new to Lucene but working as a professional developer for the past year and have solid experience with Java. Would love the opportunity to contribute.

And if you think this task is within my ability, I’d be grateful to have this ticket assigned to me. I’ll give it my best effort to deliver a high-quality contribution.

Jacky040124 avatar Sep 13 '25 04:09 Jacky040124

Hi @Jacky040124, that's great! We are "flying blind" today on regexp performance. Thank you!

mikemccand avatar Sep 14 '25 00:09 mikemccand

Hi, this is my first contribution to Lucene, so I’m not entirely sure if I’m approaching things the right way. I’ve tried to follow the style of the existing benchmarks and have opened a PR with some initial work. I’d really appreciate any guidance on how best to move forward—and apologies in advance if I’ve missed anything.

For the test set, I suggest using the one from OpenJDK: https://hg.openjdk.org/jdk7u/jdk7u6/jdk/file/8c2c5d63a17e/test/java/util/regex/RegExTest.java I also saw it on the SO post mentioned above

I’m also unsure how to properly set up the warmup and measurement phases for the benchmark. Any pointers or best practices would be very helpful.

Thanks a lot for your time and support!

Jacky040124 avatar Sep 17 '25 20:09 Jacky040124

@Jacky040124 can you link your PR here? I don't see it anywhere. Ah I see you committed to your own fork -- it works best to get our attention if you also github's pull request feature. Then we get UI for commenting in line on the code. TBH I'm not an expert at this benchmark stuff, just trying to help get you some attention on your change. Does it run and produce results? Maybe post them here (or on the PR you will create :)

msokolov avatar Sep 23 '25 18:09 msokolov

Hi @msokolov

Thanks for the guidance! I've opened the pull request and, as requested, and included teh benchmark results. Happy to make any changes or additions you think are needed!

Jacky040124 avatar Sep 25 '25 16:09 Jacky040124