Open
Description
Describe the bug 🐞
Recently we moved the ReactiveProperty from Reactive.Bindings.ReactiveProperty to ReactiveUI.ReactiveProperty.
Now we encountered massiv performance problems for the following use case.
If you subscribe a ReactiveProperty very often, the application will freeze. It is very performace intensiv.
With Reactive.Bindings.ReactiveProperty it was not a problem.
Example
public class BasicComparisonViewModel
{
private readonly SourceCache<BasicViewModel, int> cache = new(static x => x.Id);
// ReactiveUI => slow
public ReactiveProperty<int> Property => new (42);
// System.Reactive => fast
//public Reactive.Bindings.ReactiveProperty<int> Property => new Reactive.Bindings.ReactiveProperty<int>(42);
public BasicComparisonViewModel()
{
this.cache.Edit(x =>
{
for(var i = 0; i < 3000; i++)
{
x.AddOrUpdate(new BasicViewModel(i, this));
}
});
}
}
internal class BasicViewModel
{
public int Id { get; }
public BasicViewModel(int id, BasicComparisonViewModel vm)
{
this.Id = id;
vm.Property.Subscribe();
}
}
Our measurements
Reactive.Bindings.ReactiveProperty: ~3ms
ReactiveUI.ReactiveProperty: ∞
Step to reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Reproduction repository
https://github.com/reactiveui/ReactiveUI
Expected behavior
This should happen...
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
ReactiveUI Version
No response
Additional information ℹ️
No response