Comments (6)
keep source file content only for opened files. Content should be assigned after opening file and removed on close. This should give substantial memory saving.
That would kind of remove the whole point of parsing at initialization. If you do a global symbol search, you need all ASTs (or at least a list of all symbols, in any case the PhpDocument
object). I think it is a good idea for a later improvement to only keep the information relevant to us (as LSP structures) in memory and discard the AST (and reparse if needed). But this is better done once we actually have all the major requests implemented and know what we actually need. Memory optimization is a low priority for now. Personally I also value fast response times higher than low memory usage.
Similar to previous, send publishDiagnostics notification also only for opened file. This is just minor optimization but sending lots of events that will be not used in client is just wasting resources.
I wouldn't say they are not used - they are shown in the error panel of VS Code for example.
from php-language-server.
At the moment PhpDocument keeps only content of source file (as string) and SymbolInformation[], AST is used only to find all symbols in file and later isn't stored in PhpDocument. That's the reason why amount of memory allocated after parsing is relatively small. After parsing file content is used only for formatting and formatting is done only for opened files. In general source file content will be used only in context of editor (read: opened file).
From my experience I can only say that keeping memory consumption low should be equally important to keeping high performance ;)
Personally I also value fast response times higher than low memory usage.
Is there any problem with response time?
I wouldn't say they are not used - they are shown in the error panel of VS Code for example.
Ahh you are right :) I forgot about Problems panel.
from php-language-server.
Sorry I did not remember this was implemented already. Discarding the content should be fine I guess, we only need it for formatting and for calculating the columns after AST parsing and on parsing errors.
Is there any problem with response time?
No, in this case not. I thought you suggested re-parsing JIT vs keeping AST in memory.
from php-language-server.
keep source file content only for opened files. Content should be assigned after opening file and removed on close. This should give substantial memory saving.
Makes sense. Although I don't think the savings will be that big. :)
from php-language-server.
Although I don't think the savings will be that big. :)
A project with 10,000 PHP files with 1 KB each == 10 MB memory. There are bigger project and bigger files, so the savings for real life projects is measured in 10s of MB.
from php-language-server.
Of course it depends on project size. It makes more sense for larger projects. For 24k files project memory allocation result was 630MB => 520MB (~20%).
from php-language-server.
Related Issues (20)
- VS Code error
- PHP intelisense not working with MacOS 11.3
- open source funding available from Gitpod
- Keep getting alert for PHP 7
- Intellisense is "Unable to open" "Unable to read file" "Error: Unable to resolve non-existing file" after a directory is renamed in PHP Project HOT 1
- not found LanguageServer\StderrLogger
- Extension causes high cpu load
- Language Server Crashing and VS Code is hanged when opening Laravel 8 project with PHP 8.0 HOT 1
- File Copy Participants never finishes
- [Feature request] Autocomplete `$variable` without needing to type the `$`
- [FEATURE] Autocomplete classes in PHP DocBlock
- Requirements could not be resolved.
- New Issue HOT 1
- PHP language server crash in VS Code HOT 1
- __callStatic via trait not absorbed HOT 1
- Plugin Not Starting? - Help me please HOT 1
- more open source funding available from Gitpod HOT 1
- PHP (felixfbecker) language server has excited and exceeded the restart limit HOT 4
- "type is missing before a type separator" HOT 2
- is a malware????
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-language-server.