-
Notifications
You must be signed in to change notification settings - Fork 33
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
Skip three iteration of rFA cycles and process queues in 4th iteration. #54
Conversation
src/metal/engine.ts
Outdated
@@ -16,6 +16,7 @@ export class Engine implements EngineInterface { | |||
private reads: Array<Function> = []; | |||
private work: Array<Function> = []; | |||
private running: Boolean = false; | |||
private skipCounter: number = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you create a const
at top of file named something like NUM_SKIPPED_FRAMES
or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks nice, just a couple comments
@@ -40,13 +40,13 @@ testModule('Watcher Exposed Event', class extends WatcherTestClass { | |||
['@test should fire twice if moved in, out, and then back in viewport']() { | |||
return this.context.scrollTo(100) | |||
.scrollTo(140) | |||
.wait(RAF_THRESHOLD) | |||
.wait(RAF_THRESHOLD * 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more clear to keep RAF_THRESHOLD=16
and then do RAF_THRESHOLD * 4
here, since 4=skipCounter
.
test/constants.js
Outdated
@@ -4,7 +4,8 @@ const constants = { | |||
RAF_THRESHOLD : 16, | |||
SMALL: 5 | |||
}, | |||
ITEM_TO_OBSERVE: 5 | |||
ITEM_TO_OBSERVE: 5, | |||
SKIP_CYCLE: 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is SKIP_CYCLE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Number RAF cycles we are skipping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I change the name consistent with src/engine.ts constant? I nameed it as NUM_SKIPPED_FRAMES in src/engine.ts and Should I use same constant name in test files as well to avoid confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Also, SKIP_CYCLE
is 3 and NUM_SKIP_CYCLES
is 4. Shouldn't they be the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We basically skip 3 cycles and 4th one we enter the processing. I understand the confusion here. I will update those two be consistent.
Looks good, @SparshithNR can you just squash into one commit? then I'll merge |
#52: first phase of improvement, skipped three iteration of the rFA