fsprojects-archive / zzarchive-VisualFSharpPowerTools

[ARCHIVED] Power commands for F# in Visual Studio
http://fsprojects.github.io/VisualFSharpPowerTools/
Apache License 2.0
310 stars 77 forks source link

Performance profile change? #771

Closed bentayloruk closed 9 years ago

bentayloruk commented 9 years ago

Love FSPT, but I've had to disable it as VS has become unusable for me with it enabled. The editor is unable to keep up with my typing and will stutter trying to catch up. I'm assuming it is FSPT as if I disable it, the issue goes away. I saw this with 1.5.0 and 1.5.2.

@dungpa mentioned there is a reason for this on Twitter. However, is there anything I can help do to improve this? Perhaps run some profiling or something?

I am developing on a VMWare Fusion image, but have not experienced problems before (I'm on an MBP with 16GB and a 124GB SSD).

dsyme commented 9 years ago

Can you try selectively disabling features in the options panel until you identify the on that's causing the problem?

I'll admit I've also had some perf problems in recent releases, though it seems better after I disabled the "smart tag" features, which I don't need or use for the kind of coding I'm doing.

bentayloruk commented 9 years ago

Had the same thought just after I posted :-) Disabled a bunch of stuff and it got a lot better, but it's still slower than my typing and intellisense is sluggish. Gonna try a more "scientific" approach tomorrow.

vasily-kirichenko commented 9 years ago

Some time ago I regularly tested VFPT on a VirtualBox (for VS 2012 compatibility). And it was very painful despite I loaded a solution containing single project with single file in it. I don't think it's practical to try to optimize VFPT to the stage when it's usable on virtual machines.

vasily-kirichenko commented 9 years ago

I think it'd be very useful to add performance logging right into the code, then flush it to the VS log (every 1 minute for example + on VS exit). Something like this:

Resolve unopened declarations: 00:21:00 Colorization (unused opens): 00:10:00 Colorization (unused symbols): 00:05:00 Colorization (rest): 00:01:00 ... We could even pop up a dialog like "We suggest to turn off "resolve onopened declarations" feature to improve performance. Regards, VFPT team" :)

dungpa commented 9 years ago

@vasily-kirichenko Could you explain to Ben how we do performance profiling? We haven't done thorough profiling for some time so it's possible to have performance regression.

To my understanding, v1.5.0 shouldn't do more than v1.4.0 under cursor changes. In v1.5.2, we add aggressive cache invalidation so it might be slower than previous versions.

vasily-kirichenko commented 9 years ago

@bentayloruk Just create Performance Session, add FSharpVSPowerTools project (the C# one) as the only Target, choose 'start with profiling poused'. VS will appear. Open your real solution, wait until colorization appear. Now Resume Profiling and type code into the editor. Don't do this for long time because the profiler won't be able to process large report, 10 seconds are sufficient. Show us the report :)

vasily-kirichenko commented 9 years ago

@bentayloruk also try the current master, it has some colorization performance improvements.

bentayloruk commented 9 years ago

@vasily-kirichenko OK, will do. Sad that you don't think VFPT wont ever perform on a VM. That's currently my required development environment as I have multiple OS+software configurations.

vasily-kirichenko commented 9 years ago

@bentayloruk So, volunteers are always very welcome :)

bentayloruk commented 9 years ago

@vasily-kirichenko :) - I'd be profiling right this second if the damn VM wasn't hung "Installing 2 of 17" updates. Ironically, number 2 is the "Windows Malicious Software Removal Tool"!

bentayloruk commented 9 years ago

@vasily-kirichenko I'm getting the error "Unable to open the profile driver" when trying to start the profiler. It asks if I want to upgrade my user account (which I say Yes to) and then it crashes and the profile does not start. I've tried some of these workarounds with no luck. Has anyone else experienced this? Did I mention I hate computers and software?

vasily-kirichenko commented 9 years ago

Mmm. I've never seen that error. However, I've never tried to use the profiler inside a VM. Sorry, I cannot help :(

bentayloruk commented 9 years ago

No worries, sure I'll figure it out eventually.

dungpa commented 9 years ago

@bentayloruk Have you got further with profiling? I think we can improve much more once we have detailed profiling results.

bentayloruk commented 9 years ago

@dungpa unfortunately, I have been unable to get profiling to work on my VM and have given up for now (still have this problem). The perf issue seems to hit me when opening a long (code generated file). It has about 2500 lines. When looking/working in the file, the VS CPU spikes and sticks at ~60%. It stays this way regardless of whether I close the file or not (and the solution if I remember correctly). I do not have this problem when FSPT is disabled.

I'd be happy to send you files if you wanted to try it out yourself. It is not something I want to post publicly right now though, so would need an email. Otherwise, I will try and circle back round to fixing the perf session again. I did try with dotTrace too, but I couldn't figure out how to make it start a session for a VS extension. Anyone know if it is possible with dotTrace?

bentayloruk commented 9 years ago

For some reason dotTrace is not showing me the option to "Attach to Process". Their docs suggest I should be able to. The perf Gods are against me!

dungpa commented 9 years ago

We haven't had much success with dotTrace due to the huge size of a Visual Studio instance. Please send me a reproducible project via dungpa (at) hotmail (dot) com. I will examine further.

bentayloruk commented 9 years ago

OK, I just made the VS Experimental Instance lose the plot and I profiled it with dotTrace (and the latest release version of FSPT installed). CPU is stuck at 70%, despite me closing the solution that caused the issue in the first place.

I did this:

Here is an image of the hot spots: hotspots

Here is the 100MB of dotTrace.

I can't do anymore right now, but will try and get the project sorted out for you. I need to pull it out of a larger solution, so it may take a bit of time.

dungpa commented 9 years ago

SlnShutCPUNuts - Nice file name :). Thanks for the profiling report.

How VFPT behaves if you disable "Gray out unused declarations and opens", which is expensive according to the screenshot?

bentayloruk commented 9 years ago

I've enabled everything and disabled "Gray out unused declarations and opens" and it appears to be performing OK. I'm not working on that project today, but will update you when I've spent some more time with it. Thanks for the suggestion!

vasily-kirichenko commented 9 years ago

No activity here for a couple of months. I'm closing it for now.

bentayloruk commented 9 years ago

OK. I've been in JavaScript land, but endeavour to report back when I get to spend some quality time with F# and the latest FSPT bits again.