-
Notifications
You must be signed in to change notification settings - Fork 3k
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
refactor: smallify all the things #5729
refactor: smallify all the things #5729
Conversation
- Smaller implementation - Improved docs - Adds comments - Adds a test - Fixes weird adjustment in `reduce`. Closes ReactiveX#4348 Closes ReactiveX#3879
- Refactor to make it smaller - Replaced a faulty test with a test that tests the same thing. Verified the behavior has not changed since 6.x.
- Centralize all try/catching for next calls.
- map is smaller
- Uses OperatorSubscriber - Much smaller
- Smaller implementation - Uses OperatorSubscriber
- Removes runtime assertions
- Adds supporting features to OperatorSubscriber
…new window when old one closes This was a long-broken bit of functionality, but windowTime was so little used, I chose to ignore it. With this change, we could make `bufferTime` based off of `windowTime` and `toArray`.
- Does a little work to make sure that we don't push onto the buffer unless we have to.
@cartant and @jayphelps ... I think I've addressed all of your comments. I've unified on an approach for freeing up resources like buffered values, I think... basically, a returned function from the lift is a terse way to add a teardown to the destination subscriber. This ensures that the resource will be freed regardless of source (or inner) completion or error, or destination unsubscription. It could delay the release of those resources in some cases, so things will still have to be addressed on a case-by-case basis. But over all it looks like this: return (source: Observable<T>) => lift(source, function(this: Subscriber<R>, source: Observable<T>) {
const subscriber = this;
/* stuff here */
// Additional teardown
return () => {
buffer = null!
};
}); This is equivalent to making the last line: |
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.
🚢
Going through, operator by operator, and making them smaller. Centralizing on a new type called
OperatorSubscriber
that enables most behaviors fairly cleanly and concisely.WIP
Will show stats when finished.
Progress Update 9/17
BEFORE: 93KB
AFTER: 59KB (63% of the original size)AFTER: 57KB (61% of the original size)
Review Checklist:
Reviewed files:
Check only files that have been reviewed and have no issues. If there are issues with a review, add a link to the review to the listed file.