Skip to content
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

ObservableEvents significantly slows down build times #134

Open
Xerxes004 opened this issue Aug 11, 2022 · 5 comments
Open

ObservableEvents significantly slows down build times #134

Xerxes004 opened this issue Aug 11, 2022 · 5 comments

Comments

@Xerxes004
Copy link

I'm working on a proprietary project which utilizes ObservableEvents for all event handling. In one of my views, I use .Events() 22 times. These 22 times cause an additional 3 minutes of build time for the project. If I comment them out, the slowness goes away.

It's hard to characterize exactly why this view slows down the build so dramatically, but it is directly correlated with the number of .Events() calls I have in the codebehind.

I made a test app with a single view, and codebehind that has 200 copies of this line:
this.Events().PropertyChanged.Subscribe(_ => ViewModel.MyValue = "fdsa");

The view implements INotifyPropertyChanged.

The constructor looks something like:

public SimpleControl()
{
    InitializeComponent();

    this.WhenActivated(d =>
    {
        ViewModel = new SimpleControlViewModel();

        this.Events().PropertyChanged.Subscribe(_ => ViewModel.MyValue = "fdsa");
        // repeat 199 more times
    }
}

And building this single-view app takes 50 seconds. Without these 200 lines, it takes less than 3 seconds.

This is how I include this package in my project:

<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.1.4">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

Let me know if you need more info.

@glennawatson
Copy link
Member

What IDE are you using including version number?

What Target framework?

New or old csproj format?

Thanks

@glennawatson
Copy link
Member

#133 could have a impact on this one also.

@Xerxes004
Copy link
Author

What IDE are you using including version number?

What Target framework?

New or old csproj format?

Thanks

Rider 2022.2.1
Net6 Winders
New

@MisinformedDNA
Copy link

I'm new to this library, but the intellisense took so long to load, that I thought I was doing something wrong or that it was broken.

VS 2022: 17.3.0
.NET 6 WinForms

@glennawatson
Copy link
Member

glennawatson commented Aug 27, 2022

#133 will help a lot with this. Roslyn 4 has a lot of optimisations.

Source generators do have slowness with intellisense in general though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants