vscode-solidity-auditor icon indicating copy to clipboard operation
vscode-solidity-auditor copied to clipboard

Extreme performance degrade on ~1000 lines contracts

Open joaquinlpereyra opened this issue 2 years ago • 6 comments

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.

joaquinlpereyra avatar Apr 07 '22 17:04 joaquinlpereyra

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

vast-z avatar Apr 16 '22 14:04 vast-z

I am experiencing issues too:

  • M2 Macbook Air on Sonoma
  • Large non-trivial contract with a lot of inheritance

Steps to reproduce:

  • Clone a complex protocol that contains a contract with 2000+ lines
  • Hold down TAB to create spaces
  • Observe lag

zarifpour avatar Oct 06 '23 19:10 zarifpour

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.

tintinweb avatar Oct 13 '23 12:10 tintinweb

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 avatar Oct 16 '23 19:10 zarifpour

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

zarifpour avatar Oct 16 '23 19:10 zarifpour

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.

zarifpour avatar Oct 17 '23 19:10 zarifpour