question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve packaging performance

See original GitHub issue

_Excerpt from: https://github.com/serverless/serverless/issues/6580_

While bigger packaging refactor is scheduled, it appears we can improve significantly our current packing logic in place with following steps:

Implementation proposal

  1. (if package.excludeDevDepencies: true) Resolve all devDependencies, and coin their paths in node_modules (take into account https://github.com/serverless/serverless/issues/4358 error case)
  2. Resolve all files in a service folder (if package.excludeDevDepencies: true avoid traversing into dev dependencies) - To ensure better performance construct logic with callbacks not promises.
  3. Show warning if symlinks are approached (we may consider adding support for them in next PR)
  4. Filter obtained files list against eventual package patterns, but intelligently, do not test to be included filenames against include patterns, and do not test excluded filenames against exclude patterns.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

4reactions
BenLangloiscommented, Feb 24, 2021

I recently experienced a performance issue related to this when packaging my project. In serverless.yml, we specify:

package:
  exclude:
    '**'

This disables the default behaviour of including all files in the current directory. However, globby is only passed params.include, not params.exclude. So, globby will return all files in the project directory only for micromatch to later filter out most of them. This means that using exclude: '**' instead of include: '!**' has a big performance impact.

To fix this, globby needs to consider excluded patterns too. The fix for this should be simple: instead of

globby(['**'].concat(params.include), /* ... */)

use

globby(['**'].concat(patterns), /* ... */)

since patterns contains params.include and the negation of params.exclude.

1reaction
ryan-roemercommented, Feb 24, 2021

Yeah @BenLanglois – I’ve got a long comment and suggestion for future packaging tweaks here that also discusses the performance problems you’ve also identified: https://github.com/serverless/serverless/issues/6007#issuecomment-520092329

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Ways to Improve Your Packaging Efficiency - Pollock Orora
Consider including challenges with performance-based incentives to increase productivity even further. There you have a mini packaging efficiency audit.
Read more >
Beyond Protection: 4 Ways Packaging Improves Performance ...
Time efficiencies: Time is valuable and shouldn't be spent struggling with packaging. Better packaging design makes products easier for ...
Read more >
3 Key Steps to Improving Packaging Efficiency - Chainalytics
Step #1: Understand your packaging process. Taking a deep dive into your packaging operation allows you to identify where productivity issues ...
Read more >
Improve packaging performance - Nestlé Central & West Africa
We work to optimise our packaging to minimise resource use; use more materials from sustainably managed renewable resources; support initiatives to recycle or ......
Read more >
4 ways to improve packaging line performance with Big Data ...
4 ways to improve packaging line performance with Big Data and analytics · 1. Learning from the past for a better future ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found