vscode_rainbow_csv icon indicating copy to clipboard operation
vscode_rainbow_csv copied to clipboard

Extension causes high cpu load

Open Yossit-sweetinn opened this issue 5 years ago • 9 comments

  • Issue Type: Performance
  • Extension Name: rainbow-csv
  • Extension Version: 1.6.0
  • OS Version: Darwin x64 19.3.0
  • VSCode version: 1.43.2

:warning: Make sure to attach this file from your home-directory: :warning:/Users/yossiturjeman/mechatroner.rainbow-csv-unresponsive.cpuprofile.txt { "nodes": [ { "id": 1, "callFrame": { "functionName": "(root)", "scriptId": "0", "url": "", "lineNumber": -1, "columnNumber": -1 }, "hitCount": 0, "children": [ 2, 51, 52 ] }, { "id": 2, "callFrame": { "functionName": "", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 726, "columnNumber": 150 }, "hitCount": 0, "children": [ 3 ] }, { "id": 3, "callFrame": { "functionName": "_activateByEvent", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 717, "columnNumber": 518 }, "hitCount": 0, "children": [ 4 ] }, { "id": 4, "callFrame": { "functionName": "activateByEvent", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 518, "columnNumber": 503 }, "hitCount": 0, "children": [ 5 ] }, { "id": 5, "callFrame": { "functionName": "_activateExtensions", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 520, "columnNumber": 441 }, "hitCount": 0, "children": [ 6 ] }, { "id": 6, "callFrame": { "functionName": "", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 520, "columnNumber": 891 }, "hitCount": 0, "children": [ 7 ] }, { "id": 7, "callFrame": { "functionName": "_activateExtension", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 521, "columnNumber": 18 }, "hitCount": 0, "children": [ 8 ] }, { "id": 8, "callFrame": { "functionName": "actualActivateExtension", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 716, "columnNumber": 590 }, "hitCount": 0, "children": [ 9 ] }, { "id": 9, "callFrame": { "functionName": "_activateExtension", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 718, "columnNumber": 751 }, "hitCount": 0, "children": [ 10 ] }, { "id": 10, "callFrame": { "functionName": "_doActivateExtension", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 719, "columnNumber": 469 }, "hitCount": 0, "children": [ 11, 40 ] }, { "id": 11, "callFrame": { "functionName": "_loadCommonJSModule", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 819, "columnNumber": 526 }, "hitCount": 0, "children": [ 12 ] }, { "id": 12, "callFrame": { "functionName": "s", "scriptId": "90", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js", "lineNumber": 31, "columnNumber": 918 }, "hitCount": 0, "children": [ 13 ] }, { "id": 13, "callFrame": { "functionName": "require", "scriptId": "77", "url": "internal/modules/cjs/helpers.js", "lineNumber": 66, "columnNumber": 30 }, "hitCount": 0, "children": [ 14 ] }, { "id": 14, "callFrame": { "functionName": "Module.require", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 766, "columnNumber": 35 }, "hitCount": 0, "children": [ 15 ] }, { "id": 15, "callFrame": { "functionName": "n._load", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 814, "columnNumber": 898 }, "hitCount": 0, "children": [ 16 ] }, { "id": 16, "callFrame": { "functionName": "i._load", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 818, "columnNumber": 456 }, "hitCount": 0, "children": [ 17 ] }, { "id": 17, "callFrame": { "functionName": "t._load", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 848, "columnNumber": 446 }, "hitCount": 0, "children": [ 18 ] }, { "id": 18, "callFrame": { "functionName": "Module._load", "scriptId": "81", "url": "electron/js2c/asar.js", "lineNumber": 715, "columnNumber": 19 }, "hitCount": 0, "children": [ 19 ] }, { "id": 19, "callFrame": { "functionName": "Module._load", "scriptId": "81", "url": "electron/js2c/asar.js", "lineNumber": 715, "columnNumber": 19 }, "hitCount": 0, "children": [ 20 ] }, { "id": 20, "callFrame": { "functionName": "Module._load", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 602, "columnNumber": 23 }, "hitCount": 0, "children": [ 21 ] }, { "id": 21, "callFrame": { "functionName": "Module.load", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 726, "columnNumber": 32 }, "hitCount": 0, "children": [ 22 ] }, { "id": 22, "callFrame": { "functionName": "Module._extensions..js", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 889, "columnNumber": 36 }, "hitCount": 0, "children": [ 23 ] }, { "id": 23, "callFrame": { "functionName": "o._compile", "scriptId": "90", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js", "lineNumber": 14, "columnNumber": 172 }, "hitCount": 0, "children": [ 24 ] }, { "id": 24, "callFrame": { "functionName": "", "scriptId": "1122", "url": "file:///Users/yossiturjeman/.vscode/extensions/mechatroner.rainbow-csv-1.6.0/extension.js", "lineNumber": 0, "columnNumber": 10 }, "hitCount": 0, "children": [ 25 ] }, { "id": 25, "callFrame": { "functionName": "n", "scriptId": "90", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js", "lineNumber": 14, "columnNumber": 506 }, "hitCount": 0, "children": [ 26 ] }, { "id": 26, "callFrame": { "functionName": "Module.require", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 766, "columnNumber": 35 }, "hitCount": 0, "children": [ 27 ] }, { "id": 27, "callFrame": { "functionName": "n._load", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 814, "columnNumber": 898 }, "hitCount": 0, "children": [ 28 ] }, { "id": 28, "callFrame": { "functionName": "i._load", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 818, "columnNumber": 456 }, "hitCount": 0, "children": [ 29 ] }, { "id": 29, "callFrame": { "functionName": "t._load", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 848, "columnNumber": 446 }, "hitCount": 0, "children": [ 30 ] }, { "id": 30, "callFrame": { "functionName": "Module._load", "scriptId": "81", "url": "electron/js2c/asar.js", "lineNumber": 715, "columnNumber": 19 }, "hitCount": 0, "children": [ 31 ] }, { "id": 31, "callFrame": { "functionName": "Module._load", "scriptId": "81", "url": "electron/js2c/asar.js", "lineNumber": 715, "columnNumber": 19 }, "hitCount": 0, "children": [ 32 ] }, { "id": 32, "callFrame": { "functionName": "Module._load", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 602, "columnNumber": 23 }, "hitCount": 0, "children": [ 33 ] }, { "id": 33, "callFrame": { "functionName": "Module.load", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 726, "columnNumber": 32 }, "hitCount": 0, "children": [ 34 ] }, { "id": 34, "callFrame": { "functionName": "Module._extensions..js", "scriptId": "73", "url": "internal/modules/cjs/loader.js", "lineNumber": 889, "columnNumber": 36 }, "hitCount": 0, "children": [ 35 ] }, { "id": 35, "callFrame": { "functionName": "o._compile", "scriptId": "90", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/loader.js", "lineNumber": 14, "columnNumber": 172 }, "hitCount": 0, "children": [ 36, 38, 39 ] }, { "id": 36, "callFrame": { "functionName": "runInThisContext", "scriptId": "74", "url": "vm.js", "lineNumber": 120, "columnNumber": 18 }, "hitCount": 2, "children": [ 37 ], "positionTicks": [ { "line": 121, "ticks": 2 } ] }, { "id": 37, "callFrame": { "functionName": "runInThisContext", "scriptId": "0", "url": "", "lineNumber": -1, "columnNumber": -1 }, "hitCount": 3, "positionTicks": [ { "line": 126, "ticks": 3 } ] }, { "id": 38, "callFrame": { "functionName": "dirname", "scriptId": "38", "url": "path.js", "lineNumber": 1127, "columnNumber": 9 }, "hitCount": 1, "positionTicks": [ { "line": 1128, "ticks": 1 } ] }, { "id": 39, "callFrame": { "functionName": "", "scriptId": "1124", "url": "file:///Users/yossiturjeman/.vscode/extensions/mechatroner.rainbow-csv-1.6.0/rbql_core/rbql-js/csv_utils.js", "lineNumber": 0, "columnNumber": 10 }, "hitCount": 2, "positionTicks": [ { "line": 1, "ticks": 2 } ] }, { "id": 40, "callFrame": { "functionName": "_loadExtensionContext", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 720, "columnNumber": 21 }, "hitCount": 1, "children": [ 41 ], "positionTicks": [ { "line": 721, "ticks": 1 } ] }, { "id": 41, "callFrame": { "functionName": "t.ExtensionMemento", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 372, "columnNumber": 210 }, "hitCount": 0, "children": [ 42 ] }, { "id": 42, "callFrame": { "functionName": "getValue", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 643, "columnNumber": 307 }, "hitCount": 1, "children": [ 43, 44 ], "positionTicks": [ { "line": 644, "ticks": 1 } ] }, { "id": 43, "callFrame": { "functionName": "get", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 684, "columnNumber": 4 }, "hitCount": 1, "positionTicks": [ { "line": 685, "ticks": 1 } ] }, { "id": 44, "callFrame": { "functionName": "t.<computed>.i.charCodeAt.t.<computed>", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 684, "columnNumber": 66 }, "hitCount": 0, "children": [ 45 ] }, { "id": 45, "callFrame": { "functionName": "_remoteCall", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 687, "columnNumber": 485 }, "hitCount": 0, "children": [ 46 ] }, { "id": 46, "callFrame": { "functionName": "serializeRequest", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 690, "columnNumber": 861 }, "hitCount": 0, "children": [ 47, 48 ] }, { "id": 47, "callFrame": { "functionName": "h", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 681, "columnNumber": 628 }, "hitCount": 1, "positionTicks": [ { "line": 682, "ticks": 1 } ] }, { "id": 48, "callFrame": { "functionName": "_requestJSONArgs", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 691, "columnNumber": 208 }, "hitCount": 0, "children": [ 49 ] }, { "id": 49, "callFrame": { "functionName": "alloc", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 688, "columnNumber": 309 }, "hitCount": 0, "children": [ 50 ] }, { "id": 50, "callFrame": { "functionName": "writeUInt32", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 688, "columnNumber": 651 }, "hitCount": 1, "positionTicks": [ { "line": 689, "ticks": 1 } ] }, { "id": 51, "callFrame": { "functionName": "(program)", "scriptId": "0", "url": "", "lineNumber": -1, "columnNumber": -1 }, "hitCount": 1 }, { "id": 52, "callFrame": { "functionName": "processImmediate", "scriptId": "42", "url": "internal/timers.js", "lineNumber": 395, "columnNumber": 27 }, "hitCount": 0, "children": [ 53 ] }, { "id": 53, "callFrame": { "functionName": "", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 188, "columnNumber": 776 }, "hitCount": 0, "children": [ 54 ] }, { "id": 54, "callFrame": { "functionName": "_writeNow", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 188, "columnNumber": 809 }, "hitCount": 0, "children": [ 55 ] }, { "id": 55, "callFrame": { "functionName": "write", "scriptId": "107", "url": "file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js", "lineNumber": 196, "columnNumber": 494 }, "hitCount": 0, "children": [ 56 ] }, { "id": 56, "callFrame": { "functionName": "Writable.write", "scriptId": "62", "url": "_stream_writable.js", "lineNumber": 274, "columnNumber": 35 }, "hitCount": 1, "children": [ 57 ], "positionTicks": [ { "line": 302, "ticks": 1 } ] }, { "id": 57, "callFrame": { "functionName": "writeOrBuffer", "scriptId": "62", "url": "_stream_writable.js", "lineNumber": 367, "columnNumber": 22 }, "hitCount": 0, "children": [ 58 ] }, { "id": 58, "callFrame": { "functionName": "doWrite", "scriptId": "62", "url": "_stream_writable.js", "lineNumber": 407, "columnNumber": 16 }, "hitCount": 0, "children": [ 59 ] }, { "id": 59, "callFrame": { "functionName": "Socket._write", "scriptId": "53", "url": "net.js", "lineNumber": 708, "columnNumber": 34 }, "hitCount": 0, "children": [ 60 ] }, { "id": 60, "callFrame": { "functionName": "Socket._writeGeneric", "scriptId": "53", "url": "net.js", "lineNumber": 671, "columnNumber": 41 }, "hitCount": 0, "children": [ 61 ] }, { "id": 61, "callFrame": { "functionName": "writeGeneric", "scriptId": "67", "url": "internal/stream_base_commons.js", "lineNumber": 132, "columnNumber": 21 }, "hitCount": 0, "children": [ 62, 64 ] }, { "id": 62, "callFrame": { "functionName": "handleWriteReq", "scriptId": "67", "url": "internal/stream_base_commons.js", "lineNumber": 35, "columnNumber": 23 }, "hitCount": 0, "children": [ 63 ] }, { "id": 63, "callFrame": { "functionName": "writeBuffer", "scriptId": "0", "url": "", "lineNumber": -1, "columnNumber": -1 }, "hitCount": 1, "positionTicks": [ { "line": 42, "ticks": 1 } ] }, { "id": 64, "callFrame": { "functionName": "afterWriteDispatched", "scriptId": "67", "url": "internal/stream_base_commons.js", "lineNumber": 140, "columnNumber": 29 }, "hitCount": 2, "positionTicks": [ { "line": 141, "ticks": 2 } ] } ], "startTime": 877040766401, "endTime": 877046710454, "samples": [ 36, 36, 36, 37, 37, 37, 38, 39, 39, 43, 42, 47, 50, 40, 51, 56, 63, 64, 64 ], "timeDeltas": [ 5925381, 612, 78, 5569, 97, 1391, 244, 197, 12, 540, 72, 118, 2164, 172, 65, 132, 5915, 39, 174 ] }

Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load

Yossit-sweetinn avatar Mar 29 '20 14:03 Yossit-sweetinn

Hi @Yossit-sweetinn, Do you consistently see this high-cpu-load error, and if you do, when does it happen? Do you open VSCode editor at that moment or open a new file or run some Rainbow-CSV related functionality? Because if I correctly interpret the profile you've attached it happens on extension initialization (code loading), But the code size is actually not that big, like 1000-1500 lines, so I am not sure why it would cause high cpu load.

mechatroner avatar Apr 03 '20 04:04 mechatroner

Could not reproduce it anyway

On Fri, 3 Apr 2020 at 7:33 Dmitry Ignatovich [email protected] wrote:

Hi @Yossit-sweetinn https://github.com/Yossit-sweetinn, Do you consistently see this high-cpu-load error, and if you do, when does it happen? Do you open VSCode editor at that moment or open a new file or run some Rainbow-CSV related functionality? Because if I correctly interpret the profile you've attached it happens on extension initialization (code loading), But the code size is actually not that big, like 1000-1500 lines, so I am not sure why it would cause high cpu load.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mechatroner/vscode_rainbow_csv/issues/55#issuecomment-608223361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG3LGYARK7YX7ZUJGN4MW7LRKVRH3ANCNFSM4LV76KQA .

-- Yossi Turjeman Product Manager Amot To'Ha Yigal Alon St 114, Tel Aviv-Yafo, 6744320 Mobile : (+972) 52 661 71 60

Yossit-sweetinn avatar Apr 03 '20 08:04 Yossit-sweetinn

Actually it could be a good idea to split the main extension.js module into a multiple lazy-loaded components to improve startup performance. I will do it when I have more time.

mechatroner avatar Apr 06 '20 03:04 mechatroner

I also notice that scrolling is notably slower compared to when the extension is disabled. Any idea where that might come from and if that can be alleviated?

chtenb avatar Jan 27 '21 12:01 chtenb

@Chiel92 I guess there are many things that could cause this, maybe interaction with other extensions? The only difference with plain text when it comes to scrolling is the presence of different colors, so it could be that it takes more time for the engine to render multi-color values versus single-color lines? But it is hard to believe that this could cause a noticeable degradation. How big is your file in terms of bytes/lines/columns? Could you attach a non-sensitive version of it where you can reproduce the slowness? BTW Does it still happen if you disable all other extensions? And I also need to know your VSCode version, perhaps we can propagate this problem upstream to the VSCode team.

mechatroner avatar Jan 29 '21 02:01 mechatroner

Does it still happen if you disable all other extensions? And I also need to know your VSCode version, perhaps we can propagate this problem upstream to the VSCode team.

Yes, and I've used the latest 1.53.0 insiders version.

How big is your file in terms of bytes/lines/columns?

After some more testing I believe it is mainly correlated to the number of columns in the file. I notice the difference between rainbow on/off when the number of character columns exceeds 500. It is much less smooth to scroll up and down the file.

chtenb avatar Jan 29 '21 15:01 chtenb

@Chiel92 thank you for the investigation! Do I understand correctly that you have over 500 columns (i.e. > 500 separators for each line) in a CSV file?

If this only happens with over 500 columns I can set the upper limit for CSV autodetection to be 500 columns and, when Rainbow CSV is enabled manually for such extreme cases show a warning that Rainbow CSV can degrade the scrolling performance.

mechatroner avatar Jan 30 '21 03:01 mechatroner

@mechatroner I can't attach the file unfortunately because it contains a lot of sensitive data.

Do I understand correctly that you have over 500 columns (i.e. > 500 separators for each line) in a CSV file?

No, I meant actual character columns. Right now I'm viewing a file of 4000 lines with an average line length of over 1000 characters and I clearly notice the degradation in performance when scrolling. image

chtenb avatar Jan 30 '21 13:01 chtenb

For the record, the file has 387 CSV column (i.e. has 387 commas).

chtenb avatar Jan 30 '21 13:01 chtenb