-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
refactor(list_archives): Reduce calls to date.format() #4011
Conversation
A benchmark using a hexo dummy website (with 900 posts): Measure 5 times and calculate the average for each benchmark. Benchmark conditions:
Node.js 8
Node.js 10
Node.js 12
Node.js 13
|
@@ -93,6 +93,19 @@ describe('list_archives', () => { | |||
].join('')); | |||
}); | |||
|
|||
it('show_count + style: false', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for improve test coverage (#3984)
@@ -123,6 +136,21 @@ describe('list_archives', () => { | |||
].join('')); | |||
}); | |||
|
|||
it('transform + style: false', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for improve test coverage (#3984)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I have already noticed some performance bottleneck at moment.js
during the study of the flamegraph. I am glad to see you start to do some optimizations on it.
What does it do?
Continuation of #4007.
list_archives
will calldate.locale(lang)
,date.format(format)
a lot of times, especial if set torelative_link: true
. (fragment_cache was disabled)This PR change makes
list_archives
calldate.locale(lang)
,date.format(format)
once per group.How to test
Pull request tasks