-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Remove System.Reactive package #9749
Conversation
public IDisposable Subscribe(IObserver<T> observer) | ||
{ | ||
_ = observer ?? throw new ArgumentNullException(nameof(observer)); | ||
|
||
Dispatcher.UIThread.VerifyAccess(); | ||
//Dispatcher.UIThread.VerifyAccess(); |
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.
@grokys @kekekeks I have no idea, but for some reason VerifyAccess really slows down application here.
LightweightSubject implementation inherits this LightweightObservableBase, and pointer events using it feel really and really slow. Even though Subscribe call isn't actually executed on pointer movements.
Commenting this line out magically removes the problem.
I also checked, there are no exceptions thrown here, and replacing method with bool CheckAccess()
call doesn't make it better.
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.
iirc this is a hot path so adding a thread access verification might really slow things down... but that's just my conjecture though.
You can test this PR using the following package version. |
Tested this PR and saw a nearly 20% dramatically size improvement on NativeAOT-ed CC.NetCore. Really impressive. |
Wow! Finally, this is happening! |
…kage # Conflicts: # src/Avalonia.Base/Animation/AnimationInstance`1.cs # src/Avalonia.Base/Data/InstancedBinding.cs
837623c
to
a92bf0a
Compare
You can test this PR using the following package version. |
You can test this PR using the following package version. |
…kage # Conflicts: # src/Avalonia.Base/Input/Gestures.cs
You can test this PR using the following package version. |
I'm wondering if we can also remove the System.Reactive dependency from MiniMvvm and ControlCatalog? |
You can test this PR using the following package version. |
You can test this PR using the following package version. |
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.
You can test this PR using the following package version. |
Why are the replacement helper classes internal? This PR breaks features as simple as We could of course add the Reactive package to our application, but a) that defeats the purpose of this PR and b) new Avalonia developers aren't going to know which package to add. For now I'll take a copy of the "internal" helper classes and put them in my own solution. |
@tomenscape this PR is more about having a choice - to include or not System.Reactive. |
I can see your concerns about the very low-level methods and classes. But please reconsider at least for the
|
AFAIK, it doesn't conflict with reactive extensions.
I see why Subscribe is needed for the developers, especially not as experienced, who don't know about reactive extensions much. That's something that we should revisit now... But I don't see any reason to add public extensions for the Select method. Without full set of reactive extension (which we will not provide), this method isn't as useful. And with combination with Subscribe method you can simply do mapping in the subscribe handler. |
textBlock.Bind(Layoutable.WidthProperty, border.GetObservable(Visual.BoundsProperty).Select(r => r.Width)); The |
What does the pull request do?
Replaces System.Reactive package with internal helpers.
Why?
Problems with System.Reactive package:
net6.0-windows
builds, see System.Reactive reference pulls in all of WPF/SWF when TFM isnet7.0-windows10.0.19041.0
or higher #9549Breaking changes
Fixed issues
Fixes #9549