This repository was archived by the owner on Aug 25, 2025. It is now read-only.
install-template.sh: speed up this script by reducing # of forks.#111
Open
he32 wants to merge 1 commit intorust-lang:masterfrom
Open
install-template.sh: speed up this script by reducing # of forks.#111he32 wants to merge 1 commit intorust-lang:masterfrom
he32 wants to merge 1 commit intorust-lang:masterfrom
Conversation
Replace inner-loop use of "grep", "sed" and "cut" for pattern matching and substitution when case/esac and appropriate parameter expansion works just as well. A test rig shows around 4x speed-up.
wip-sync
pushed a commit
to NetBSD/pkgsrc-wip
that referenced
this pull request
May 25, 2021
When building the bootstrap kit, drop "docs" and "compiler-docs" from the build. This will make the install of the bootstrap kit a lot faster, since it drops 5-6.000 files from the kit, which would need to be processed by the install.sh script. Note that this will also impact the rust-bin package, since we also use the bootstrap kits for installation there for the ports we maintain locally. To get these "docs" sub-sets installed, use the full "lang/rust" normal build and/or a corresponding binary package. Also, speed up the install.sh script (via install-template.sh) by significantly reducing the number of forks in the inner loop. Instead of relying on "grep", "sed" and "cut" for pattern matching, substitution and field extraction, use case/esac and parameter expansion modification to do the same, i.e. using in-shell mechanisms. Submitted upstream, ref. rust-lang/rust-installer#111 On an emulated (and loaded...) armv7 system, this reduced the time (as shown with csh "time") for a test rig of install.sh (which doesn't even actually do the file copying etc.) from 13000.143u 48616.601s 14:21:27.13 119.2% 57+151k 598+7367io 0pf+0w to 3247.518u 9754.898s 3:45:48.70 95.9% 31+75k 927+4952io 14pf+0w (This is with the "docs" and "compiler-docs" still in the bootstrap kit.) Bump PKGREVISION.
he32
added a commit
to he32/rust
that referenced
this pull request
Aug 24, 2025
This round replaces repetitive pattern matching in the inner loop of this script using grep (which causes a fork() for each test) with built-in pattern matching in the bourne shell using the case / esac construct. This in reference to rust-lang#80684 and is a separated-out request from rust-lang/rust-installer#111 which apparently never got any review. The forthcoming planned "step 2" change builds on top of this change, and replaces the inner-loops needless uses of sed (which again causes a fork() for each instance) with the suffix removal constructs from the bourne shell. Since this change touches lots of the same lines this change does, that pull request cannot be submitted before this one is accepted. Hopefully this first step is less controversial than the latter change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace inner-loop use of "grep", "sed" and "cut" for pattern matching
and substitution when case/esac and appropriate parameter expansion
works just as well. A test rig shows around 4x speed-up.