php-language-server icon indicating copy to clipboard operation
php-language-server copied to clipboard

Cache DocBlocks

Open Declspeck opened this issue 7 years ago β€’ 4 comments
trafficstars

This PR adds caching for DocBlocks in DefinitionResolver. The cache is cleared after each file is parsed and after each server operation to avoid memory leaks. This makes indexing ~17% faster on my machine.

Performance.php before (total 76 sec):

0
1000
2000
3000
4000
5000
------------------------------
Time [drupal]: 20.532634019852
------------------------------
Time [wordpress]: 1.5450940132141
0
------------------------------
Time [php-language-server]: 0.35776019096375
0
1000
2000
3000
4000
5000
16000
7000
8000
9000
10000
11000
12000
13000
14000
------------------------------
Time [tolerant-php-parser]: 38.144486904144
0
------------------------------
Time [math-php]: 0.732008934021
0
1000
2000
------------------------------
Time [symfony]: 11.475233078003
------------------------------
Time [codeigniter]: 0.75957489013672
------------------------------
Time [cakephp]: 2.8739709854126

Performance.php after (total 63 sec):

0
1000
2000
3000
4000
5000
------------------------------
Time [drupal]: 16.952955961227
------------------------------
Time [wordpress]: 1.3229329586029
0
------------------------------
Time [php-language-server]: 0.25634002685547
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
11000
12000
13000
14000
------------------------------
Time [tolerant-php-parser]: 31.547545909882
0
------------------------------
Time [math-php]: 0.574462890625
0
1000
2000
------------------------------
Time [symfony]: 9.5325789451599
------------------------------
Time [codeigniter]: 0.60508608818054
------------------------------
Time [cakephp]: 2.0659110546112

Declspeck avatar Feb 24 '18 15:02 Declspeck

Codecov Report

Merging #608 into master will increase coverage by 0.04%. The diff coverage is 90.32%.

@@             Coverage Diff              @@
##             master     #608      +/-   ##
============================================
+ Coverage     81.63%   81.67%   +0.04%     
- Complexity      910      914       +4     
============================================
  Files            61       62       +1     
  Lines          2075     2085      +10     
============================================
+ Hits           1694     1703       +9     
- Misses          381      382       +1
Impacted Files Coverage Ξ” Complexity Ξ”
src/LanguageServer.php 77.47% <0%> (-0.71%) 27 <0> (ΓΈ)
src/PhpDocument.php 79.66% <100%> (+0.35%) 24 <0> (ΓΈ) :arrow_down:
src/DefinitionResolver.php 87.38% <100%> (+0.06%) 325 <1> (-5) :arrow_down:
src/CachingDocBlockFactory.php 90.47% <90.47%> (ΓΈ) 9 <9> (?)

codecov[bot] avatar Feb 24 '18 16:02 codecov[bot]

Is there something I can do to help getting this into master?

jens1o avatar Mar 23 '18 20:03 jens1o

any updates?

Mte90 avatar Mar 09 '20 21:03 Mte90

@felixfbecker I wonder whether you still have enough power (given the circumstances) to maintain this project? If so, I'd maybe invest some time in this in the following weeks. I'm happy to hearing back from you. :)

jens1o avatar Mar 29 '20 10:03 jens1o