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

fmt, internal/fmtsort: refactor SortedMap to use slice of structs for map sorting #67256

Closed
wants to merge 1 commit into from

Conversation

aimuz
Copy link
Contributor

@aimuz aimuz commented May 8, 2024

This change refactors the SortedMap type in the fmtsort package from using
two parallel slices for keys and values to a single slice of structs. This
improves code clarity and reduces the complexity of handling map entries.
Affected files and their respective functions have been updated to work
with the new structure, including adjustments in fmt/print.go and
text/template/exec.go to iterate over the new map representation.

goos: darwin
goarch: arm64
pkg: fmt
cpu: Apple M2 Max
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
SprintfPadding-12 21.29n ± 5% 20.89n ± 8% ~ (p=0.393 n=10)
SprintfEmpty-12 2.986n ± 4% 2.997n ± 10% ~ (p=0.697 n=10)
SprintfString-12 8.327n ± 9% 8.493n ± 12% ~ (p=0.579 n=10)
SprintfTruncateString-12 15.93n ± 10% 15.56n ± 10% ~ (p=0.853 n=10)
SprintfTruncateBytes-12 14.56n ± 12% 14.13n ± 11% ~ (p=0.796 n=10)
SprintfSlowParsingPath-12 9.026n ± 15% 9.511n ± 14% ~ (p=0.646 n=10)
SprintfQuoteString-12 40.88n ± 3% 40.73n ± 1% ~ (p=0.782 n=10)
SprintfInt-12 6.279n ± 7% 6.130n ± 6% ~ (p=0.218 n=10)
SprintfIntInt-12 11.08n ± 10% 11.37n ± 10% ~ (p=0.424 n=10)
SprintfPrefixedInt-12 31.24n ± 3% 31.21n ± 2% ~ (p=0.912 n=10)
SprintfFloat-12 13.96n ± 7% 13.99n ± 15% ~ (p=0.986 n=10)
SprintfComplex-12 49.16n ± 7% 50.57n ± 6% ~ (p=0.436 n=10)
SprintfBoolean-12 7.578n ± 15% 7.267n ± 11% ~ (p=0.529 n=10)
SprintfHexString-12 36.14n ± 2% 35.74n ± 1% ~ (p=0.118 n=10)
SprintfHexBytes-12 48.74n ± 1% 48.34n ± 4% ~ (p=0.128 n=10)
SprintfBytes-12 60.16n ± 3% 61.36n ± 5% ~ (p=0.218 n=10)
SprintfStringer-12 39.02n ± 10% 39.31n ± 9% ~ (p=0.739 n=10)
SprintfStructure-12 161.2n ± 1% 133.9n ± 4% -16.90% (p=0.000 n=10)
ManyArgs-12 31.87n ± 17% 33.00n ± 12% ~ (p=0.165 n=10)
FprintInt-12 32.32n ± 0% 33.13n ± 1% +2.49% (p=0.000 n=10)
FprintfBytes-12 47.31n ± 0% 47.99n ± 1% +1.44% (p=0.000 n=10)
FprintIntNoAlloc-12 32.05n ± 1% 33.12n ± 0% +3.34% (p=0.000 n=10)
ScanInts-12 130.5µ ± 1% 131.3µ ± 0% +0.57% (p=0.000 n=10)
ScanRecursiveInt-12 40.83m ± 1% 40.65m ± 2% ~ (p=0.353 n=10)
ScanRecursiveIntReaderWrapper-12 40.77m ± 2% 40.83m ± 2% ~ (p=0.971 n=10)
geomean 100.6n 100.3n -0.32%

                             │    old.txt     │                new.txt                 │
                             │      B/op      │     B/op      vs base                  │

SprintfPadding-12 16.00 ± 0% 16.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfEmpty-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfString-12 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfTruncateString-12 16.00 ± 0% 16.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12 16.00 ± 0% 16.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12 5.000 ± 0% 5.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfQuoteString-12 32.00 ± 0% 32.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfInt-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfIntInt-12 3.000 ± 0% 3.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12 64.00 ± 0% 64.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfFloat-12 8.000 ± 0% 8.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfComplex-12 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfBoolean-12 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfHexString-12 80.00 ± 0% 80.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfHexBytes-12 104.0 ± 0% 104.0 ± 0% ~ (p=1.000 n=10) ¹
SprintfBytes-12 88.00 ± 0% 88.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfStringer-12 32.00 ± 0% 32.00 ± 0% ~ (p=1.000 n=10) ¹
SprintfStructure-12 216.0 ± 0% 168.0 ± 0% -22.22% (p=0.000 n=10)
ManyArgs-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
FprintInt-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
FprintfBytes-12 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
ScanInts-12 14.87Ki ± 0% 14.87Ki ± 0% ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12 16.37Ki ± 0% 16.34Ki ± 9% ~ (p=0.950 n=10)
ScanRecursiveIntReaderWrapper-12 16.43Ki ± 8% 16.35Ki ± 0% ~ (p=0.052 n=10)
geomean ² -1.03% ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                             │    old.txt    │                new.txt                │
                             │   allocs/op   │  allocs/op   vs base                  │

SprintfPadding-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfEmpty-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfString-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfTruncateString-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfQuoteString-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfInt-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfIntInt-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfFloat-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfComplex-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfBoolean-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfHexString-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfHexBytes-12 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfBytes-12 2.000 ± 0% 2.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfStringer-12 4.000 ± 0% 4.000 ± 0% ~ (p=1.000 n=10) ¹
SprintfStructure-12 8.000 ± 0% 6.000 ± 0% -25.00% (p=0.000 n=10)
ManyArgs-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
FprintInt-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
FprintfBytes-12 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=10) ¹
ScanInts-12 1.590k ± 0% 1.590k ± 0% ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12 1.592k ± 0% 1.592k ± 0% ~ (p=0.303 n=10)
ScanRecursiveIntReaderWrapper-12 1.594k ± 0% 1.594k ± 0% ~ (p=0.582 n=10)
geomean ² -1.14% ²
¹ all samples are equal
² summaries must be >0 to compute geomean

@aimuz aimuz marked this pull request as ready for review May 8, 2024 13:47
@aimuz aimuz changed the title fmt, fmtsort: refactor SortedMap to use slice of structs for map sorting fmtsort: refactor SortedMap to use slice of structs for map sorting May 8, 2024
@aimuz aimuz changed the title fmtsort: refactor SortedMap to use slice of structs for map sorting fmt, internal/fmtsort: refactor SortedMap to use slice of structs for map sorting May 8, 2024
@gopherbot
Copy link

This PR (HEAD: fbb7fa8) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584155.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link

Message from Gopher Robot:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Zhen Li:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 1:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

This PR (HEAD: b46e5d5) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584155.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link

Message from Zhen Li:

Patch Set 1:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 2: Commit-Queue+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

This change refactors the SortedMap type in the fmtsort package from using
two parallel slices for keys and values to a single slice of structs. This
improves code clarity and reduces the complexity of handling map entries.
Affected files and their respective functions have been updated to work
with the new structure, including adjustments in fmt/print.go and
text/template/exec.go to iterate over the new map representation.

goos: darwin
goarch: arm64
pkg: fmt
cpu: Apple M2 Max
                                 │   old.txt    │               new.txt                │
                                 │    sec/op    │    sec/op     vs base                │
SprintfPadding-12                  22.90n ± 14%   22.49n ±  5%        ~ (p=0.481 n=10)
SprintfEmpty-12                    3.448n ±  8%   3.070n ± 11%  -10.98% (p=0.029 n=10)
SprintfString-12                   7.635n ± 23%   7.567n ± 22%        ~ (p=0.529 n=10)
SprintfTruncateString-12           14.81n ±  8%   15.32n ±  9%        ~ (p=0.315 n=10)
SprintfTruncateBytes-12            14.19n ± 13%   15.72n ± 11%        ~ (p=0.089 n=10)
SprintfSlowParsingPath-12          9.048n ± 14%   9.271n ± 16%        ~ (p=0.971 n=10)
SprintfQuoteString-12              42.24n ±  6%   41.38n ±  5%        ~ (p=0.143 n=10)
SprintfInt-12                      6.727n ± 16%   6.451n ± 14%        ~ (p=0.239 n=10)
SprintfIntInt-12                   10.92n ± 15%   10.37n ± 10%        ~ (p=0.063 n=10)
SprintfPrefixedInt-12              31.47n ±  4%   30.71n ±  5%        ~ (p=0.404 n=10)
SprintfFloat-12                    13.69n ± 10%   14.88n ± 11%        ~ (p=0.171 n=10)
SprintfComplex-12                  51.06n ± 11%   50.50n ±  5%        ~ (p=0.280 n=10)
SprintfBoolean-12                  7.432n ± 18%   7.566n ± 19%        ~ (p=0.436 n=10)
SprintfHexString-12                36.58n ± 14%   35.70n ±  2%        ~ (p=0.072 n=10)
SprintfHexBytes-12                 48.01n ±  3%   47.04n ±  3%        ~ (p=0.051 n=10)
SprintfBytes-12                    63.90n ±  7%   61.83n ±  3%        ~ (p=0.123 n=10)
SprintfStringer-12                 37.36n ±  9%   39.58n ± 11%        ~ (p=0.529 n=10)
SprintfStructure-12                162.6n ±  3%   135.8n ±  5%  -16.51% (p=0.000 n=10)
ManyArgs-12                        35.49n ± 18%   31.10n ± 31%        ~ (p=0.971 n=10)
FprintInt-12                       33.48n ±  3%   33.30n ±  1%   -0.54% (p=0.014 n=10)
FprintfBytes-12                    48.36n ±  1%   49.13n ±  2%   +1.59% (p=0.002 n=10)
FprintIntNoAlloc-12                33.44n ±  0%   33.24n ±  1%        ~ (p=0.280 n=10)
ScanInts-12                        130.8µ ±  1%   132.4µ ±  2%   +1.22% (p=0.000 n=10)
ScanRecursiveInt-12                40.16m ±  2%   40.52m ±  2%        ~ (p=0.052 n=10)
ScanRecursiveIntReaderWrapper-12   40.15m ±  1%   41.22m ±  1%   +2.68% (p=0.000 n=10)
geomean                            101.9n         100.7n         -1.24%

                                 │    old.txt     │                new.txt                 │
                                 │      B/op      │     B/op      vs base                  │
SprintfPadding-12                    16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfEmpty-12                      0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfString-12                     5.000 ± 0%       5.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateString-12             16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12              16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12            5.000 ± 0%       5.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfQuoteString-12                32.00 ± 0%       32.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfInt-12                        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfIntInt-12                     3.000 ± 0%       3.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12                64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfFloat-12                      8.000 ± 0%       8.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfComplex-12                    24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBoolean-12                    4.000 ± 0%       4.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexString-12                  80.00 ± 0%       80.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexBytes-12                   104.0 ± 0%       104.0 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBytes-12                      88.00 ± 0%       88.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStringer-12                   32.00 ± 0%       32.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStructure-12                  216.0 ± 0%       168.0 ± 0%  -22.22% (p=0.000 n=10)
ManyArgs-12                          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintInt-12                         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintfBytes-12                      24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12                  0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ScanInts-12                        14.87Ki ± 0%     14.87Ki ± 0%        ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12                16.32Ki ± 7%     16.94Ki ± 4%        ~ (p=0.441 n=10)
ScanRecursiveIntReaderWrapper-12   16.33Ki ± 1%     16.35Ki ± 8%        ~ (p=0.068 n=10)
geomean                                         ²                  -0.84%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │    old.txt    │                new.txt                │
                                 │   allocs/op   │  allocs/op   vs base                  │
SprintfPadding-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfEmpty-12                     0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfString-12                    1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateString-12            1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12             1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12           1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfQuoteString-12               1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfInt-12                       0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfIntInt-12                    1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12               1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfFloat-12                     1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfComplex-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBoolean-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexString-12                 1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexBytes-12                  2.000 ± 0%      2.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBytes-12                     2.000 ± 0%      2.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStringer-12                  4.000 ± 0%      4.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStructure-12                 8.000 ± 0%      6.000 ± 0%  -25.00% (p=0.000 n=10)
ManyArgs-12                         0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintInt-12                        0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintfBytes-12                     1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12                 0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
ScanInts-12                        1.590k ± 0%     1.590k ± 0%        ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12                1.592k ± 0%     1.593k ± 0%        ~ (p=0.650 n=10)
ScanRecursiveIntReaderWrapper-12   1.594k ± 0%     1.594k ± 0%        ~ (p=0.582 n=10)
geomean                                        ²                 -1.14%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean
@gopherbot
Copy link

Message from Go LUCI:

Patch Set 2:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2024-05-09T00:21:12Z","revision":"dd46fe977ca5c4ff702a990140001185f49667a1"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

This PR (HEAD: 5a4afcf) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/go/+/584155.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

@gopherbot
Copy link

Message from Zhen Li:

Patch Set 2:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 2: LUCI-TryBot-Result-1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 3: Commit-Queue+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 3:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2024-05-09T00:39:58Z","revision":"1942fc8611b62b62d420d9445effe783ed2d6695"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 3: -Commit-Queue


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 3:

This CL has passed the run


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 3: LUCI-TryBot-Result+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Rob Pike:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from qiulaidongfeng:

Patch Set 3: Code-Review+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Daniel Martí:

Patch Set 3: Code-Review+1

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Zhen Li:

Patch Set 3:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Zhen Li:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Rob Pike:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Zhen Li:

Patch Set 3:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 4: Auto-Submit+1 Code-Review+2 Commit-Queue+1

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 4:

Dry run: CV is trying the patch.

Bot data: {"action":"start","triggered_at":"2024-05-10T21:12:55Z","revision":"a5acee0cb409981eb0677511c69289e1626dc234"}


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Ian Lance Taylor:

Patch Set 4: -Commit-Queue


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 4:

This CL has passed the run


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link

Message from Go LUCI:

Patch Set 4: LUCI-TryBot-Result+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/584155.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request May 13, 2024
… map sorting

This change refactors the SortedMap type in the fmtsort package from using
two parallel slices for keys and values to a single slice of structs. This
improves code clarity and reduces the complexity of handling map entries.
Affected files and their respective functions have been updated to work
with the new structure, including adjustments in fmt/print.go and
text/template/exec.go to iterate over the new map representation.

goos: darwin
goarch: arm64
pkg: fmt
cpu: Apple M2 Max
                                 │   old.txt    │               new.txt                │
                                 │    sec/op    │    sec/op     vs base                │
SprintfPadding-12                  21.29n ±  5%   20.89n ±  8%        ~ (p=0.393 n=10)
SprintfEmpty-12                    2.986n ±  4%   2.997n ± 10%        ~ (p=0.697 n=10)
SprintfString-12                   8.327n ±  9%   8.493n ± 12%        ~ (p=0.579 n=10)
SprintfTruncateString-12           15.93n ± 10%   15.56n ± 10%        ~ (p=0.853 n=10)
SprintfTruncateBytes-12            14.56n ± 12%   14.13n ± 11%        ~ (p=0.796 n=10)
SprintfSlowParsingPath-12          9.026n ± 15%   9.511n ± 14%        ~ (p=0.646 n=10)
SprintfQuoteString-12              40.88n ±  3%   40.73n ±  1%        ~ (p=0.782 n=10)
SprintfInt-12                      6.279n ±  7%   6.130n ±  6%        ~ (p=0.218 n=10)
SprintfIntInt-12                   11.08n ± 10%   11.37n ± 10%        ~ (p=0.424 n=10)
SprintfPrefixedInt-12              31.24n ±  3%   31.21n ±  2%        ~ (p=0.912 n=10)
SprintfFloat-12                    13.96n ±  7%   13.99n ± 15%        ~ (p=0.986 n=10)
SprintfComplex-12                  49.16n ±  7%   50.57n ±  6%        ~ (p=0.436 n=10)
SprintfBoolean-12                  7.578n ± 15%   7.267n ± 11%        ~ (p=0.529 n=10)
SprintfHexString-12                36.14n ±  2%   35.74n ±  1%        ~ (p=0.118 n=10)
SprintfHexBytes-12                 48.74n ±  1%   48.34n ±  4%        ~ (p=0.128 n=10)
SprintfBytes-12                    60.16n ±  3%   61.36n ±  5%        ~ (p=0.218 n=10)
SprintfStringer-12                 39.02n ± 10%   39.31n ±  9%        ~ (p=0.739 n=10)
SprintfStructure-12                161.2n ±  1%   133.9n ±  4%  -16.90% (p=0.000 n=10)
ManyArgs-12                        31.87n ± 17%   33.00n ± 12%        ~ (p=0.165 n=10)
FprintInt-12                       32.32n ±  0%   33.13n ±  1%   +2.49% (p=0.000 n=10)
FprintfBytes-12                    47.31n ±  0%   47.99n ±  1%   +1.44% (p=0.000 n=10)
FprintIntNoAlloc-12                32.05n ±  1%   33.12n ±  0%   +3.34% (p=0.000 n=10)
ScanInts-12                        130.5µ ±  1%   131.3µ ±  0%   +0.57% (p=0.000 n=10)
ScanRecursiveInt-12                40.83m ±  1%   40.65m ±  2%        ~ (p=0.353 n=10)
ScanRecursiveIntReaderWrapper-12   40.77m ±  2%   40.83m ±  2%        ~ (p=0.971 n=10)
geomean                            100.6n         100.3n         -0.32%

                                 │    old.txt     │                new.txt                 │
                                 │      B/op      │     B/op      vs base                  │
SprintfPadding-12                    16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfEmpty-12                      0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfString-12                     5.000 ± 0%       5.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateString-12             16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12              16.00 ± 0%       16.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12            5.000 ± 0%       5.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfQuoteString-12                32.00 ± 0%       32.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfInt-12                        0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfIntInt-12                     3.000 ± 0%       3.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12                64.00 ± 0%       64.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfFloat-12                      8.000 ± 0%       8.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfComplex-12                    24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBoolean-12                    4.000 ± 0%       4.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexString-12                  80.00 ± 0%       80.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexBytes-12                   104.0 ± 0%       104.0 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBytes-12                      88.00 ± 0%       88.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStringer-12                   32.00 ± 0%       32.00 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStructure-12                  216.0 ± 0%       168.0 ± 0%  -22.22% (p=0.000 n=10)
ManyArgs-12                          0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintInt-12                         0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintfBytes-12                      24.00 ± 0%       24.00 ± 0%        ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12                  0.000 ± 0%       0.000 ± 0%        ~ (p=1.000 n=10) ¹
ScanInts-12                        14.87Ki ± 0%     14.87Ki ± 0%        ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12                16.37Ki ± 0%     16.34Ki ± 9%        ~ (p=0.950 n=10)
ScanRecursiveIntReaderWrapper-12   16.43Ki ± 8%     16.35Ki ± 0%        ~ (p=0.052 n=10)
geomean                                         ²                  -1.03%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │    old.txt    │                new.txt                │
                                 │   allocs/op   │  allocs/op   vs base                  │
SprintfPadding-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfEmpty-12                     0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfString-12                    1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateString-12            1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfTruncateBytes-12             1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfSlowParsingPath-12           1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfQuoteString-12               1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfInt-12                       0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfIntInt-12                    1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfPrefixedInt-12               1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfFloat-12                     1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfComplex-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBoolean-12                   1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexString-12                 1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfHexBytes-12                  2.000 ± 0%      2.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfBytes-12                     2.000 ± 0%      2.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStringer-12                  4.000 ± 0%      4.000 ± 0%        ~ (p=1.000 n=10) ¹
SprintfStructure-12                 8.000 ± 0%      6.000 ± 0%  -25.00% (p=0.000 n=10)
ManyArgs-12                         0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintInt-12                        0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintfBytes-12                     1.000 ± 0%      1.000 ± 0%        ~ (p=1.000 n=10) ¹
FprintIntNoAlloc-12                 0.000 ± 0%      0.000 ± 0%        ~ (p=1.000 n=10) ¹
ScanInts-12                        1.590k ± 0%     1.590k ± 0%        ~ (p=1.000 n=10) ¹
ScanRecursiveInt-12                1.592k ± 0%     1.592k ± 0%        ~ (p=0.303 n=10)
ScanRecursiveIntReaderWrapper-12   1.594k ± 0%     1.594k ± 0%        ~ (p=0.582 n=10)
geomean                                        ²                 -1.14%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

Change-Id: I2e850d827d2fd7d6618db60f7071977af5639032
GitHub-Last-Rev: 5a4afcf
GitHub-Pull-Request: #67256
Reviewed-on: https://go-review.googlesource.com/c/go/+/584155
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: qiu laidongfeng2 <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
@gopherbot
Copy link

This PR is being closed because golang.org/cl/584155 has been merged.

@gopherbot gopherbot closed this May 13, 2024
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.

None yet

2 participants