Knockout-Contrib / Knockout-Contrib/Knockout-Validation

applyBindingsWithValidation Running Slow

Open
#446 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1k
Forks
366
PR merge metrics
No merged PRs in 30d

Description

If I have a 100 items in my viewModelArray, the applyBindingsWithValidation() function takes between two and three seconds to run. (Includes jQuery time to find the trElement). Is there any way to speed this up? Or am I doing something wrong?

for (var i = 0; i < viewModelArray.length; i++) {
var line = viewModelArray[i];
var trElement = $('tr[data-partnumber="' + line.mouserPartNumber + '"]')[1];
if (line.mouserPartNumber && trElement) {
ko.applyBindingsWithValidation(line, trElement);
}
}

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported 2–3 second runtime with 100 items and the provided loop. Profile the jQuery tr[data-partnumber] lookup separately from ko.applyBindingsWithValidation to identify the bottleneck. Done means the cause is established and a measurable performance improvement or confirmed usage issue is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.