Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Refactor timeAgo to make it more performant #850

Merged
merged 1 commit into from
Oct 17, 2023
Merged

Refactor timeAgo to make it more performant #850

merged 1 commit into from
Oct 17, 2023

Conversation

mxdvl
Copy link
Contributor

@mxdvl mxdvl commented Oct 12, 2023

What are you changing?

Why?

  • internal changes that result in a ~25× speed up for dates under a week, which brings the execution from 1-2µs to 60-70ns.
benchmark screenshot

@changeset-bot
Copy link

changeset-bot bot commented Oct 12, 2023

🦋 Changeset detected

Latest commit: cff734b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@guardian/libs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added 📦 npm Affects a @guardian package on NPM @guardian/libs labels Oct 12, 2023
@mxdvl mxdvl force-pushed the mxdvl/timeAgo branch 2 times, most recently from 809ba7c to 7df1e47 Compare October 12, 2023 11:53
@mxdvl mxdvl marked this pull request as ready for review October 12, 2023 12:05
@mxdvl mxdvl requested a review from a team as a code owner October 12, 2023 12:05
@mxdvl mxdvl requested a review from a team October 12, 2023 12:05
@mxdvl mxdvl requested review from a team as code owners October 12, 2023 12:05
@mxdvl mxdvl added the run_chromatic Runs chromatic when label is applied label Oct 13, 2023
Copy link
Contributor

@jamesgorrie jamesgorrie left a comment

Choose a reason for hiding this comment

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

Consider that yak shaved!
🐑 ✂️

internal changes that result in a 20× speed up,
which brings the execution from 1-2µs to 60-70ns
@mxdvl mxdvl enabled auto-merge (squash) October 17, 2023 08:40
@mxdvl mxdvl disabled auto-merge October 17, 2023 08:40
@mxdvl mxdvl enabled auto-merge October 17, 2023 08:41
@mxdvl mxdvl merged commit 410dde7 into main Oct 17, 2023
20 checks passed
@mxdvl mxdvl deleted the mxdvl/timeAgo branch October 17, 2023 08:49
@jamesgorrie
Copy link
Contributor

To clarify yak shaving, I meant in a good way:

"An activity that allows one to overcome intermediate difficulties, which then allows one to solve a larger problem."

As in avoiding death of a thousand papercuts on performance.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@guardian/libs 📦 npm Affects a @guardian package on NPM run_chromatic Runs chromatic when label is applied
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants