Skip to content

Fixed the problem of finder or memory surge in multi-class situations#93

Open
Yyunfan wants to merge 1 commit into
antonmedv:masterfrom
Yyunfan:master
Open

Fixed the problem of finder or memory surge in multi-class situations#93
Yyunfan wants to merge 1 commit into
antonmedv:masterfrom
Yyunfan:master

Conversation

@Yyunfan

@Yyunfan Yyunfan commented Jun 11, 2025

Copy link
Copy Markdown

situation:
dom:

expect:
We need to get the selector as quickly as possible when using the finder library

@Yyunfan

Yyunfan commented Jun 11, 2025

Copy link
Copy Markdown
Author

dom case:<input id="s0-1-1-22-10-10-31-46-2-0-0-0-1-2-@dialog-16-1-9-0-0-2-0-0-10-0-0-2-0-0-11-se-textbox" class="textbox__control" type="text" value="" aria-invalid="true" style="padding-right: 34px;" aria-describedby="s0-1-1-22-10-10-31-46-2-0-0-0-1-2-@dialog-16-1-9-0-0-2-0-0-10-0-0-2-0-0-11-se-textbox-errors">

@Yyunfan

Yyunfan commented Jun 11, 2025

Copy link
Copy Markdown
Author

A lot of changes....

Comment thread finder.js
seedMinLength: 3,
optimizedMinLength: 2,
maxNumberOfPathChecks: Infinity,
maxNumberOfPathChecks: 50, // Much lower limit

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Isn't it too low?

Comment thread finder.js
while (current && current !== rootDocument) {
let totalGenerated = 0;

while (current && current !== rootDocument && i < 8) { // Limit depth

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Better to introduce config option

Comment thread finder.js
}

// Early exit if too many combinations
if (totalGenerated > 5000) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same, lets have a configuration.

Comment thread finder.js
}
function wordLike(name) {
// Fast return for obviously generated IDs/classes (long or with numbers/special chars)
if (name.length > 30 || /\d{3,}/.test(name) || /@/.test(name)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This looks pin pointing to your specific case. Can we just check for name.length?

@Yyunfan

Yyunfan commented Jun 11, 2025

Copy link
Copy Markdown
Author

@antonmedv Thanks for review. Do these changes match your expected design? Except for some configuration issues that need to be extracted. It still maintains the original library features right?

@antonmedv

Copy link
Copy Markdown
Owner

I guess, so. Main problem - selectors should be stable.

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

Successfully merging this pull request may close these issues.

2 participants