rogalmic / vscode-xml-complete

XML editing helper (using XSD schemaLocation)
MIT License
28 stars 16 forks source link

Extension causes high cpu load #23

Open arkceajin opened 4 years ago

arkceajin commented 4 years ago

:warning: Make sure to attach this file from your home-directory: :warning:C:\Users\siu\rogalmic.vscode-xml-complete-unresponsive.cpuprofile.txt rogalmic.vscode-xml-complete-unresponsive.cpuprofile.txt

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

rogalmic commented 4 years ago

Thank you for this report.

Any chance to get the actual xml/xsd files used for this run to confirm my suspicions?

arkceajin commented 4 years ago

Hi, here it is https://raw.githubusercontent.com/autosaros/Standards/master/Adaptive%20Platform/19.03/MethodologyAndManifests/AUTOSAR_MMOD_XMLSchema/AUTOSAR_00047.xsd I think you already tried this, the error may not 100% reproducible, seems a performance issue.

BTW, for me, the big issue is the completion didn't same as https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml. I am not sure does it caused by the big XSD file. And suggest the priority of vscode config high than XML specification. if the indicated xsdUri and xmlns can be correctly parsed and found, the xsi:schemaLocation won't be parsed.

"xmlComplete.schemaMapping":
[
    {
        "xmlns": "http://autosar.org/schema/r4.0",
        "xsdUri": "file:///C:/Users/s-jiu/Desktop/AP-R19-03/MethodologyAndManifests/AUTOSAR_MMOD_XMLSchema/AUTOSAR_00047.xsd",
        "strict": true // shows errors instead of tips
    }
]
<AUTOSAR 
xmlns="http://autosar.org/schema/r4.0" 
xsi:schemaLocation="http://autosar.org/schema/r4.0" <-- this path will be ignore
>
rogalmic commented 4 years ago

Is the opened/parsed xml* file big, containing many similar nodes? Or does it reproduce for simple xml root without any nodes?

*Not talking about schema xsd file here

arkceajin commented 4 years ago

Hi, This is the xml AUTOSAR_SWS_ExecutionManagement.zip

containing many similar nodes?

I don't think it contains too much similar nodes.

Or does it reproduce for simple xml root without any nodes?

It hard to reproduce, but the xml I used almost same size as the uploaded one. Simple xml seems won't occur, but still give very long loading time for the auto-complete.

rogalmic commented 4 years ago

I think i was able to reproduce this terrible performance.

Fix applied: https://github.com/rogalmic/vscode-xml-complete/commit/2005888df337ca565957508d97d4584bb39cfd6e#diff-dd023fbd0c2c0b45603ea23421f17eed

To test, manually uninstall extension, RESTART vscode, install following vsix: https://github.com/rogalmic/vscode-xml-complete/releases/tag/untagged-d5e59da4586c9b367deb

Please let me know if you see any issues still...

arkceajin commented 4 years ago

@rogalmic Hi, I tried the vsix, looks like it works, the autocomplete windows popup faster. Thanks. But when I fixed incorrect tag, the highlight disappear very slow. And the autocomplete still don't gives expected result. Fox example, tag suppose only allow and under it, the autocomplete gives ton of result. image Shall I start an new issue for this problem?

rogalmic commented 4 years ago

The autocompletion for tags will give full list of tags - it is current limitation as full schema parsing is not provided yet. No need for new issue (https://github.com/rogalmic/vscode-xml-complete/issues/18).

As for the parsing performance after edit, I will check that withing this issue.