postsharp / Metalama

Metalama is a Roslyn-based meta-programming framework. Use this repo to report bugs or ask questions.
164 stars 4 forks source link

Perf: Typing in longer aspects is quite slow #203

Closed WhitWaldo closed 9 months ago

WhitWaldo commented 11 months ago

My aspect is about 600 lines long itself and relies on several other classes from other files. I don't know if the length has anything to do with it, but I find that the responsiveness of typing in my aspect class alone is astonishingly slow. I can expect to wait several seconds for anything I type to show up in the window whether it's code or a comment.

Any other class, I don't experience any sort of performance decrease - just the entry point to each aspect, which makes me think this is a Metalama issue.

Disabling the Metalama extension improves performance dramatically. How might I pull some sort of profiling to help in debugging this?

PostSharpBot commented 11 months ago

Hello @WhitWaldo, thank you for submitting this issue. We will try to get back to you as soon as possible. Note to the PostSharp team, this ticket is being tracked in our dashboard under ID TP-33612.

gfraiteur commented 11 months ago

This is due to syntax highlighting of compile-time code. I'm not sure of what we can do with that other than reducing the frequency at which we update the highlighting. We will need to do some fine-tuning.

It seems it's not only due to the size of the aspect but the overall size of the project too. We will need to investigate.

WhitWaldo commented 11 months ago

I can pull some stats for you about my own project if it'll help.

gfraiteur commented 11 months ago

I don't think it would help at the moment. I can reproduce the issue with NopCommerce but less acutely.

WhitWaldo commented 11 months ago

I just had Powershell count the number of lines of .cs files in the project directory. It spans one large aspect and one smaller child aspect totaling 2273 lines. One of these days I intend to open source it as well, but it's not quite cooked enough yet.

WhitWaldo commented 10 months ago

I thought I'd record a brief video documenting the sluggishness I'm experiencing here in an aspect with just 646 lines in this file and 2344 lines across all the .cs files in the project (said project is one of 66 in solution).

Here, I'm doing a rename operation and hit F2 and finished typing the new name by the 5 second mark. It then takes 43 seconds for the operation to catch up, going one letter at a time.

https://github.com/postsharp/Metalama/assets/2238529/96ba1a0d-8a48-4735-b27c-1f17f664abd1

gfraiteur commented 9 months ago

Solved in 2023.3.5-rc.