Comments (9)
Short update: It got better a bit and performance checks are now also part of automated tests, see
b9d2f0b#diff-23cdebbe45c2dda5cda2ff746b280fe6R139
However, there's still some room for improvements concerning Phar\Reader
...
from phar-stream-wrapper.
I guess(!) it's the debug_backtrace
since the unserialize
polyfill most probably is not used in Drupal. If you could create an xdebug cachegrind (https://xdebug.org/docs/profiler) or similar performance report and attach the profiling data with each function call it would be easier to analyse what's really going on in Drush/Drupal.
from phar-stream-wrapper.
Yep, will take a closer look tomorrow. We did have one profiling run and it indicated a ton of files/folders were getting scanned every command we ran, but that was on a more complex site in production. The above timings were done on a separate clean install and didn't have time to set up full xdebug access there yet.
There's a backtrace in the version diff (don't have it in front of me now)? How did I miss that hehe...
from phar-stream-wrapper.
Yes... unfortunately there is... and there's another one pending in PR #22
I could dig into these specific setups as well in case it can be reproduced on e.g. some DDEV/Docker environment.
from phar-stream-wrapper.
I cant' upload the profiles since they are too large - 107MB (4.5MB gzipped) for 2.0.1 and 717MB (32MB gzipped) for 2.1.0.
Interestingly, the v2.1.0 debug_backtrace
calls (9885 of them) only take 50ms (all of it own time) which is just 0,1% of the total time 69 365 with profiling enabled in v2.1.0. It had the same number of calls in v2.0.1 but took 21ms. (I thought it was only in 2.1.0 but apparently not.)
Directory scanning does seem to be the major time sink here. The number of calls to drush_scan_directory()
stays the same at 2570, but the time shoots up from 6435 (72.3%) to 66176 (95.4%). Its own time stays around ~400ms.
Own time leader for 2.1.0 is TYPO3\PharStreamWrapper\Phar\Reader->extractData
with 18299ms (27.2%) which seems to go crazy with tons file operations. It also calls strpos
1 710 430 times and strlen
1 482 802 times. It only takes 72+18ms but still... Most of it seems to be down to callling TYPO3\PharStreamWrapper\Phar\Reader->resolveManifestLength
741 375 times, which in turn calls TYPO3\PharStreamWrapper\Phar\Reader::resolveFourByteLittleEndian
780 915 times and does another 780-850k of substr
, unpack
and ìs_string`each.
None of these calls were in 2.0.1 so I guess that's where most of the extra time is.
Some other calls in TYPO3\PharStreamWrapper\Phar\Reader
end up taking a lot of own time, see screenshots for comparison.
from phar-stream-wrapper.
Thx for analyzing that further. Could you please send me these gzipped profiles? Either via mail to [email protected], Drupal Slack (@olly) or some other download link (Dropbox, GoogleDrive, Gist, ...)? Thx in advance!
from phar-stream-wrapper.
Sure, here you go:
2.0.1
2.1.0
In case you get issues with path mappings the docroot was in /var/aegir/platforms/test
and the fresh site was under /var/aegir/platforms/test/sites/drushtest.ny-webb.se
for both profiles.
from phar-stream-wrapper.
Please test the references pull-requests #31 (PHP7) or #32 (PHP5) and check whether the originally reported bug of this ticket is solved. Thanks!
from phar-stream-wrapper.
I can confirm that the current release is performing much better. I have not made any timing measurements, but I also no longer have a reason to do so. Thank you very much! :)
from phar-stream-wrapper.
Related Issues (20)
- Interceptors fail using Phar archives using internal aliases
- Monitor Drupal reports
- Publish new v2.1.0 & v3.1.0 releases
- Including dependencies packed with clue/phar-composer results in exception HOT 8
- Breaking included AWS Phar HOT 8
- Manifest / End of Stub Detection
- Enhance variety of test fixtures
- Normalize resolved Windows path to Unix-style
- Deprecate unused constant in PharInvocationResolver
- Connect up appveyor HOT 1
- Alias resolving on included Phar files fails
- Extend invocation test cases HOT 1
- Breaks typo3 8.7.25 on symlinked webroot HOT 5
- Ensure PHP 7.4 compatibility HOT 6
- Check meta-data deserialization capabilities in PHP 8 HOT 3
- PHP Notice: stream_wrapper_restore(): phar:// was never changed HOT 1
- Does not handle fgets returning an error gracefully HOT 6
- Version 2.2.2 not backwards compatible because of strict_types=1 HOT 1
- Add possibility to retrieve low-level Phar internals
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 phar-stream-wrapper.