Consensys / vscode-solidity-auditor

Solidity language support and visual security auditor for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor
GNU General Public License v3.0
569 stars 60 forks source link

Extreme performance degrade on ~1000 lines contracts #95

Open joaquinlpereyra opened 2 years ago

joaquinlpereyra commented 2 years ago

Hi! Great plugin. Experimenting a bit with it and noticing some very bad degrade of performance when interacting with non-trivial contracts (>1000 lines).

I'm not usually a VSCode user so I'm not sure what information would be useful in this case. I'm using:

System information:

Version: 1.66.0
Commit: e18005f0f1b33c29e81d732535d8c0e47cafb0b5
Date: 2022-03-30T05:50:41.156Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Linux x64 5.13.0-39-generic

All extensions settings (and the related extensions settings as well) set to their default value.

I'd be glad to attach any extra debugging information which may help.

vast-z commented 2 years ago

I ran into the same situation, with a latency of about 2s, but CPU utilization under 30%

Version: 1.66.2 (Universal) Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977 Date: 2022-04-11T07:49:20.994Z (5 days ago) Electron: 17.2.0 Chromium: 98.0.4758.109 Node.js: 16.13.0 V8: 9.8.177.11-electron.0 OS: Darwin arm64 21.4.0

zarifpour commented 9 months ago

I am experiencing issues too:

Steps to reproduce:

tintinweb commented 8 months ago

please check out https://github.com/Consensys/vscode-solidity-auditor/releases/tag/v0.2.0 and report. should be much better although not completely fixable right now as cancellation tokens don't seem to properly work with editor change events.

zarifpour commented 8 months ago

please check out v0.2.0 (release) and report. should be much better although not completely fixable right now as cancellation tokens don't seem to properly work with editor change events.

A big thank you for this release! The performance has improved significantly, but it is still not perfect.

Try opening a large contract (maybe one that inherits some methods) and hold down tab to observe the lag.

zarifpour commented 8 months ago

https://github.com/Consensys/vscode-solidity-auditor/assets/16494335/c78517b0-d8ea-430b-b157-4bdf15514dca

zarifpour commented 8 months ago

I've observed some concerning performance issues even with contracts that are shorter in lines of code. Notably, when flattened, one such contract expands to about ~38,000 lines, almost 10 times bigger than the previous problematic contract (when flattened). This leads me to think there might be underlying processes accounting for this expanded view.

While I'm uncertain about the exact role of "cancellation tokens", I speculate that the lag could be associated with loading editor decorations and other background processes.

Could it be that the entire source undergoes recompilation or a similar time-intensive process, leading to the lag? A potential solution could be caching unchanged objects and triggering recompilation only when there are modifications in inheritance, imports, or parent structures. For instance, simple white space changes shouldn't require intensive background processing if no inheritance attributes or relevant objects are altered.

I hope these insights are useful, and I appreciate the efforts on improving the plugin.