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

Slow generation of some RegExps #43

Open
TheJavaGuy opened this issue Feb 7, 2018 · 0 comments
Open

Slow generation of some RegExps #43

TheJavaGuy opened this issue Feb 7, 2018 · 0 comments

Comments

@TheJavaGuy
Copy link

Hello @mifmif ,

I noticed one issue when generating some RegExps. If we try this:

Generex generex = new Generex("(.{1,6})( *, *(.{1,6})){0,5}");
System.out.println(generex.random());

it takes about 1 second to finish. But, if we try this RegEx:

Generex generex = new Generex("(.{1,6})( *, *(.{1,6})){0,12}");
System.out.println(generex.random());

it takes about 40 seconds.

Finally, the code

Generex generex = new Generex("(.{1,6})( *, *(.{1,6})){0,15}");
System.out.println(generex.random());

took a whopping 3 minutes and generated one character as a result.

Now I'm perfectly aware that users can write all sorts of RegExps. It's probably impossible to make code which efficiently generates them all. Yet I hope there's a possibility that for some cases generation might be faster.

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

No branches or pull requests

1 participant