-
Notifications
You must be signed in to change notification settings - Fork 358
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
Replace string concatenation in loop with string builder #505
Merged
Conversation
This file contains 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
I don't understand why this PR doesn't get merged. I see huge advantages and zero downside? |
caarlos0
approved these changes
Aug 24, 2023
maaslalani
approved these changes
Aug 24, 2023
thanks for the PR! (and sorry we took some time to merge) |
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Aug 28, 2024
⚠️ **CAUTION: this is a major update, indicating a breaking change!**⚠️ This MR contains the following updates: | Package | Update | Change | |---|---|---| | [charmbracelet/glow](https://github.com/charmbracelet/glow) | major | `v1.5.1` -> `v2.0.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>charmbracelet/glow (charmbracelet/glow)</summary> ### [`v2.0.0`](https://github.com/charmbracelet/glow/releases/tag/v2.0.0) [Compare Source](charmbracelet/glow@v1.5.1...v2.0.0) ### Hello v2! This release contains a massive amount of bug fixes and rendering improvements, many of which come by way of [Glamour v0.8.0](https://github.com/charmbracelet/glamour/releases/tag/v0.8.0) which was released a few weeks ago. As a bonus, the latest version of Glamour includes support for Tokyo Night. ```bash glow -s "tokyo-night" ``` <img alt="Tokyo Night x Glamour" src="https://github.com/charmbracelet/glamour/blob/master/styles/gallery/tokyo-night.png" width="600"> Additionally, the stash feature has been removed. #### Changelog ##### New! - [`d89d79a`](charmbracelet/glow@d89d79a): feat: --preserve-new-lines ([#​623](charmbracelet/glow#623)) ([@​caarlos0](https://github.com/caarlos0)) - [`b1d3772`](charmbracelet/glow@b1d3772): feat: add 'r' to refresh list and document ([#​624](charmbracelet/glow#624)) ([@​caarlos0](https://github.com/caarlos0)) - [`96d2a38`](charmbracelet/glow@96d2a38): feat: allow --width=0 to disable wordwrap ([#​366](charmbracelet/glow#366)) ([@​applejag](https://github.com/applejag)) - [`fe066f2`](charmbracelet/glow@fe066f2): feat: allow config from CHARM_CONFIG_HOME and XDG_CONFIG_HOME ([#​621](charmbracelet/glow#621)) ([@​caarlos0](https://github.com/caarlos0)) - [`9ebe39c`](charmbracelet/glow@9ebe39c): feat: improve gitlab/github readme url ([#​456](charmbracelet/glow#456)) ([@​caarlos0](https://github.com/caarlos0)) - [`f1cf0ba`](charmbracelet/glow@f1cf0ba): feat: man pages ([@​caarlos0](https://github.com/caarlos0)) - [`597e56b`](charmbracelet/glow@597e56b): feat: open editor in current line ([@​caarlos0](https://github.com/caarlos0)) - [`d7032fe`](charmbracelet/glow@d7032fe): feat: shell completions ([@​caarlos0](https://github.com/caarlos0)) - [`2d5bd3b`](charmbracelet/glow@2d5bd3b): feat: show line numbers configuration option ([@​caarlos0](https://github.com/caarlos0)) - [`0dcf127`](charmbracelet/glow@0dcf127): feat: suspend ([@​caarlos0](https://github.com/caarlos0)) - [`c991ec4`](charmbracelet/glow@c991ec4): feat: use x/editor ([#​543](charmbracelet/glow#543)) ([@​caarlos0](https://github.com/caarlos0)) ##### Fixed! - [`9c79fa1`](charmbracelet/glow@9c79fa1): fix(ci): remove soft-serve workflow ([@​aymanbagabas](https://github.com/aymanbagabas)) - [`bccf3d0`](charmbracelet/glow@bccf3d0): fix(ci): update coverage workflow ([@​aymanbagabas](https://github.com/aymanbagabas)) - [`08c564c`](charmbracelet/glow@08c564c): fix: --all bypass .gitignore rules ([#​285](charmbracelet/glow#285)) ([#​504](charmbracelet/glow#504)) ([@​aitva](https://github.com/aitva)) - [`8e51396`](charmbracelet/glow@8e51396): fix: check other possible readme paths/branches ([#​450](charmbracelet/glow#450)) ([@​caarlos0](https://github.com/caarlos0)) - [`1133e50`](charmbracelet/glow@1133e50): fix: config failing in tests ([#​625](charmbracelet/glow#625)) ([@​caarlos0](https://github.com/caarlos0)) - [`2288311`](charmbracelet/glow@2288311): fix: do not hard fail if no config ([@​caarlos0](https://github.com/caarlos0)) - [`821d51d`](charmbracelet/glow@821d51d): fix: do not show absolute path as note ([@​caarlos0](https://github.com/caarlos0)) - [`247c707`](charmbracelet/glow@247c707): fix: glow URL ([@​caarlos0](https://github.com/caarlos0)) - [`a1a8563`](charmbracelet/glow@a1a8563): fix: handle not being able to create log file ([@​caarlos0](https://github.com/caarlos0)) - [`b80e831`](charmbracelet/glow@b80e831): fix: handle permission denied ([@​caarlos0](https://github.com/caarlos0)) - [`54dd62a`](charmbracelet/glow@54dd62a): fix: handle running inside a snap ([#​527](charmbracelet/glow#527)) ([@​caarlos0](https://github.com/caarlos0)) - [`ad01f38`](charmbracelet/glow@ad01f38): fix: improve line no ([@​caarlos0](https://github.com/caarlos0)) - [`f44e5b5`](charmbracelet/glow@f44e5b5): fix: improve message ([@​caarlos0](https://github.com/caarlos0)) - [`7e471f1`](charmbracelet/glow@7e471f1): fix: lint issue ([@​caarlos0](https://github.com/caarlos0)) - [`e4cacf7`](charmbracelet/glow@e4cacf7): fix: mkdir cache dir ([@​caarlos0](https://github.com/caarlos0)) - [`1407793`](charmbracelet/glow@1407793): fix: pass color profile down to glamour ([#​626](charmbracelet/glow#626)) ([@​caarlos0](https://github.com/caarlos0)) - [`9a3f7a1`](charmbracelet/glow@9a3f7a1): fix: replace string concatenation in loop with string builder ([#​505](charmbracelet/glow#505)) ([@​appgurueu](https://github.com/appgurueu)) - [`cd99146`](charmbracelet/glow@cd99146): fix: update codeowners ([#​637](charmbracelet/glow#637)) ([@​caarlos0](https://github.com/caarlos0)) - [`3f9102d`](charmbracelet/glow@3f9102d): fix: yet another log handling fix ([@​caarlos0](https://github.com/caarlos0)) ##### Deps - [`c89c8bd`](charmbracelet/glow@c89c8bd): feat: update glamour ([#​634](charmbracelet/glow#634)) ([@​caarlos0](https://github.com/caarlos0)) - [`4578bc1`](charmbracelet/glow@4578bc1): feat: updating glamour ([#​631](charmbracelet/glow#631)) ([@​caarlos0](https://github.com/caarlos0)) ##### Other Stuff - [`d2e7742`](charmbracelet/glow@d2e7742): chore(ci): enable gofumpt ([@​aymanbagabas](https://github.com/aymanbagabas)) - [`736e77d`](charmbracelet/glow@736e77d): feat!: rename module to /v2 ([#​640](charmbracelet/glow#640)) ([@​caarlos0](https://github.com/caarlos0)) *** <details> <summary>Verifying the artifacts</summary> First, download the [`checksums.txt` file](https://github.com/charmbracelet/glow/releases/download/2.0.0/checksums.txt), for example, with `wget`: ```bash wget 'https://github.com/charmbracelet/glow/releases/download/v2.0.0/checksums.txt' ``` Then, verify it using [`cosign`](https://github.com/sigstore/cosign): ```bash cosign verify-blob \ --certificate-identity 'https://github.com/charmbracelet/meta/.github/workflows/goreleaser.yml@refs/heads/main' \ --certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \ --cert 'https://github.com/charmbracelet/glow/releases/download/v2.0.0/checksums.txt.pem' \ --signature 'https://github.com/charmbracelet/glow/releases/download/v2.0.0/checksums.txt.sig' \ ./checksums.txt ``` If the output is `Verified OK`, you can safely use it to verify the checksums of other artifacts you downloaded from the release using `sha256sum`: ```bash sha256sum --ignore-missing -c checksums.txt ``` Done! You artifacts are now verified! </details> <a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a> Thoughts? Questions? We love hearing from you. Feel free to reach out on [Twitter](https://twitter.com/charmcli), [The Fediverse](https://mastodon.technology/@​charm), or on [Discord](https://charm.sh/chat). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For large input files, the string concatenation in a hot loop done to trim lines is a bottleneck, running in quadratic time since it has to copy the current string every time. Using a string builder, this can be optimized in linear time.
For Minetest's large
lua_api.md
, this brings the time down from 45s to 3s, a 15x speedup, on my laptop.