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

Added benchmarks for larger regex fsm and runtime benchmarks for the same #925

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kc611
Copy link

@kc611 kc611 commented May 28, 2024

Step towards #549,

This PR adds a lager regex benchmark and a few runtime benchmarks.

@brandonwillard brandonwillard added enhancement tests Linked to library tests optimization Related to performance optimizations labels May 28, 2024
@brandonwillard brandonwillard linked an issue May 28, 2024 that may be closed by this pull request
Comment on lines +59 to +62
for token in fsm.allowed_token_ids(start_state):
# Access every end state individually, to get an amortized
# cost of dictionary accesses.
next_state = fsm.next_state(start_state, token)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned previously, let's split these into to separate benchmarks.

@lapp0
Copy link
Contributor

lapp0 commented May 29, 2024

Thanks for this work, it's really important that we prevent performance degradation!

Related / conflicting PR which moves tests from pytest-benchmark to ASV: #903

If you're looking to add additional benchmarks after this PR, you might consider adapting some benchmarks from #587 there's a lot of benchmarks in there for CFG generation.

@lapp0
Copy link
Contributor

lapp0 commented Jun 19, 2024

Hi @kc611 the ASV infrastructure is in main. Could you please move these to benchmarks/?

Here is an example :https://github.com/outlines-dev/outlines/blob/main/benchmarks/bench_regex_guide.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement optimization Related to performance optimizations tests Linked to library tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run-time structured generation benchmarks
3 participants