haxe
haxe copied to clipboard
slow diagnose
Any project file is diagnosed for an extremely long time (more than 10 seconds).
haxe .... SomeFile.hx@0@diagnostic
Condition:
- Large project (approximately 6000 files)
- haxe 4.0.3 or 4.2.3
- Diagnostics is started with https://github.com/vshaxe/haxe-language-server
Additionally:
- Initial diagnostics can take a couple of minutes (but it happens once, so it's not a problem)
- Small test project (less than 500 files) diagnosed quickly (less than a second)
- If you remove all dependencies from the file, it still takes a long time to diagnose
- A large number of errors in the file lead to a significant slowdown. errors / seconds 1 / 11 64 / 16 256 / 30 512 / 48
- In the "Process Monitor" I observe a huge number of operations (about 140 000!) Multiple duplicates for the same file, stretched for 10 seconds.
Added a couple of screenshots from a very small project (less than 10 files) :

What is in the screenshot is repeated exactly more than 10 times in one diagnostic

I guess compiler checks the modification time of a file every time a type from that file is requested. And this could be something to optimize.
I don't see why it would check any mtimes if run through vshaxe, because vshaxe disables exactly that:
Processing Arguments [--times,-D,macro-times,--display,{"jsonrpc":"2.0","id":1,"method":"server/configure","params":{"noModuleChecks":true,"print":{"completion":true,"reusing":false},"legacyCompletion":false}}]
The "noModuleChecks":true puts the compiler in dumb mode and makes it rely on server/invalidate requests for invalidated files.
Could you try again with the current development version? There's a chance that my recent work has already addressed some problems here.
Compiled the latest version: https://github.com/HaxeFoundation/haxe/tree/6bcae15678ab52e306a1b41dc2eced5ad18b8f36 (development, committed 23 hours ago)
The "noModuleChecks":true flag is set by default.
Unfortunately, same result.
PS In general, it seemed to me that the haxe-compiler ignores "file-change-message", and each time it loads the content of files from disk.
I had trouble parsing changed code until I saved the files to disk after every change. The haxe-plugin (for intellij idea) works in a similar way (saves files on every change)
I'm not sure what to do with this, and with all the changes to the caching recently there's a good chance that it has been addressed. If not, feel free to comment!