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

Temporarily freezes some release pages #491

Closed
jesus2099 opened this issue Mar 4, 2020 · 4 comments
Closed

Temporarily freezes some release pages #491

jesus2099 opened this issue Mar 4, 2020 · 4 comments

Comments

@jesus2099
Copy link
Owner

I don't understand why it freezes these two particular release pages.

They have the same artist, so it's because of something in the artist open edits.

In fact, any of the pages for Mohsen Namjoo will have this freeze, including simply the artist page itself.

But there are only 64 open edits, which is far less than Various Artists 500+ edits with no freezes on any of my VA releases.

@jesus2099
Copy link
Owner Author

I quickly used Performance tab in Vivaldi dev tools for the first time and it tells me that almost all of CPU is taken by some /[^<>]+(?=<\/bdi><\/a><\/h2>)/g regular expression:

types: this.responseText.match(/[^<>]+(?=<\/bdi><\/a><\/h2>)/g),

@jesus2099
Copy link
Owner Author

In https://regexr.com I try this /[^<>]+(?=<\/bdi><\/a><\/h2>)/g regular expression on Open Edits for Mohsen Namjoo source code and it tells me:

EXEC RROR: The expression took more than 250ms to execute.

When I try same thing on Open Edits for Various Artists source code, it executes fine and finds 100 matches in 35.3ms.

@jesus2099
Copy link
Owner Author

The VA open edits source code is bigger in size… 🤔
I try zero space positive look behind in addition to my zero space positive look ahead to see if it improves performance: /(?<=<bdi>)[^<>]+(?=<\/bdi><\/a><\/h2>)/
It's acting better in EmEditor but It does not seem to be supported by Vivaldi…

@jesus2099
Copy link
Owner Author

jesus2099 commented Mar 4, 2020

I came up with /<h2><a href="[^"]+"><bdi>([^<]+)<\/bdi><\/a><\/h2>/ the fastest regular expression for what I want in RexExr but it requires some changes in my script to retrieve the grouped value, now that I don't use the zero width positive look ahead no more (which seemed to be the CPU heavy demanding feature).

  • Mohsen Namjoo is scanned in 1.2ms instead of very long time
  • Various Artists is scanned in 1.6ms instead of 35.3ms!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant