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

Find all the files to alter in bash instead of ruby #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sailor
Copy link

@sailor sailor commented Jan 7, 2021

Related to the work started here #21, this PR aims at reducing the boot time on big react applications (~1000 files).

For large projects, we can encounter R10 errors because the time spent trying to inject the environment variables on runtime can exceed the default timeout of 60 seconds.

This patch is reducing the amount of files pass to the ruby runtime (which is kind of slow), by greping first all the files containing the REACT_APP_VARS_AS_JSON (in bash). Only the files will be passed to the injectable_env.rb script.

On my local machine i get the following result with the patch:

time .profile.d/inject_react_app_env.sh
.profile.d/inject_react_app_env.sh  1.87s user 0.16s system 82% cpu 2.454 total

And without:

time .profile.d/inject_react_app_env.sh
.profile.d/inject_react_app_env.sh  13.07s user 6.86s system 90% cpu 22.003 total

which can be of a huge help for big apps.

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.

1 participant