Skip to content

Complete extraction of sorted methods used by templates #2443

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

Merged
merged 3 commits into from
Dec 2, 2020

Conversation

jcollins-g
Copy link
Contributor

@jcollins-g jcollins-g commented Dec 1, 2020

Fixes #2438.

This finishes an earlier refactor extracting out sort methods and updating the templates to use them. In particular for categories, default to sorting by name unless a categoryOrder is specified in the templates.

Breaking change for templates -- without an update, many templates will lose their sorting behavior.

The following sed scripts can be used to adjust custom templates when run in a directory containing only custom templates. Make backups first. The examples are for MacOS. On Linux, remove the '' after -i.

sed -i '' '
s/documentedCategories}/documentedCategoriesSorted}/g
s/publicLibraries}/publicLibrariesSorted}/g
s/publicClasses}/publicClassesSorted}/g
s/publicConstructors}/publicConstructorsSorted}/g
s/publicExtensions}/publicExtensionsSorted}/g
s/publicConstants}/publicConstantsSorted}/g
s/publicConstantFields}/publicConstantFieldsSorted}/g
s/publicEnums}/publicEnumsSorted}/g
s/publicExceptions}/publicExceptionsSorted}/g
s/publicFunctions}/publicFunctionsSorted}/g
s/publicImplementors}/publicImplementorsSorted}/g
s/publicMixins}/publicMixinsSorted}/g
s/publicProperties}/publicPropertiesSorted}/g
s/publicTypedefs}/publicTypedefsSorted}/g
' *

sed -i '' '
s/hasPublicMixins}/hasPublicMixedInTypes}/g
s/publicMixinsSorted}/publicMixedInTypes}/g
' class.* enum.* mixin.*

@google-cla google-cla bot added the cla: yes Google CLA check succeeded. label Dec 1, 2020
@jcollins-g jcollins-g requested a review from srawlins December 1, 2020 22:30
@jcollins-g jcollins-g marked this pull request as ready for review December 1, 2020 22:30
Copy link
Member

@srawlins srawlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wild, I love it! Did you benchmark with anything, like Flutter, to see if there was a performance change? I guess I would be surprised if there was anything beyond a tiny change...

@jcollins-g
Copy link
Contributor Author

@srawlins I did check Flutter, briefly. Without the memoization of sorted results there's a ~3-4% decline in performance. With it, it's within the margin of error on individual runs, but looks to be a very slight improvement if I squint.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 91.175% when pulling a56b728 on sort-topic-pages into a8d14b0 on master.

@jcollins-g jcollins-g merged commit 35b664c into master Dec 2, 2020
@jcollins-g jcollins-g deleted the sort-topic-pages branch December 2, 2020 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Topics are not sorted alphabetically or overridable by categoryOrder
3 participants