Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up Pattern Lab compile times by 3x; speed up Travis #1802

Merged
merged 5 commits into from
Mar 31, 2020

Conversation

sghoweri
Copy link
Contributor

@sghoweri sghoweri commented Mar 30, 2020

Jira

http://vjira2:8080/browse/BDS-2076

Summary

Significantly speeds up Pattern Lab's compile times through a number of performance-related patches.

On Travis:

  • Before:
    • Pattern Lab Data compiled in ~12.4s
    • Pattern Lab compiled in ~1m 57.4s
  • After:
    • Pattern Lab Data compiles in ~605ms (or ~11.8s faster)
    • Pattern Lab compiles in ~46s (or about 71.4s faster)

Locally (running the php core/console --generate command)

  • Before:
    • Pattern Lab compiles in ~33.5s
  • After:
    • Pattern Lab compiles in ~12s (no cache) --> about 2x faster!
    • Pattern Lab compiles/recompiles in ~8.8s (with cache) --> more than 3.5x faster!

Details

  • Patches Pattern Lab PHP to add support for Twig's built-in caching + enables auto_reload by default
  • Disables debug mode in Pattern Lab (ie. no more {{ dump() }}) in order to gain significant performance improvements when rendering Twig
  • Updates the original Pattern Lab code handling markdown and front-matter parsing with a much faster off the shelf library.
  • Updates our Faker.php Twig extension to support PHP 7.4 without breaking PHP 7.3 compatibility
  • Blacklists additional files for Pattern Lab to ignore parsing

How to test

  • Review changes
  • Confirm Pattern Lab compile times have significantly improved when running locally

@sghoweri sghoweri marked this pull request as ready for review March 30, 2020 19:37
@sghoweri sghoweri changed the title Speed up Pattern Lab compile times by 3x; speed up Travis CI build by ~2 minutes Speed up Pattern Lab compile times by 3x; speed up Travis CI builds Mar 30, 2020
@sghoweri sghoweri changed the title Speed up Pattern Lab compile times by 3x; speed up Travis CI builds Speed up Pattern Lab compile times by 3x; speed up Travis builds Mar 30, 2020
@sghoweri sghoweri changed the title Speed up Pattern Lab compile times by 3x; speed up Travis builds Speed up Pattern Lab compile times by 3x; speed up Travis Mar 30, 2020
@sghoweri sghoweri added this to the v2.21.0 milestone Mar 30, 2020
Copy link
Collaborator

@danielamorse danielamorse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sghoweri approved with a few inline questions to help me understand the changes.

Locally I found PL compiles in 8-10 secs every time, tested MD files too. Looking forward to these changes!

@sghoweri sghoweri merged commit 3fea714 into master Mar 31, 2020
@sghoweri sghoweri deleted the feature/faster-twig-rendering branch March 31, 2020 16:20
@sghoweri
Copy link
Contributor Author

sghoweri commented Apr 8, 2020

PR was released with v2.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants