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

chore(*): add codspeed for benchmark visualization #75

Merged
merged 3 commits into from
Jun 18, 2024
Merged

Conversation

juno7803
Copy link
Member

@juno7803 juno7803 commented Jun 17, 2024

related #57

Background

Recently, contributions to improve the performance of the es-toolkit have been ongoing. Many people have been measuring performance improvements using the experimental bench feature applied to vitest. (like this)

So I have discovered codspeed, a tool that further automates this process, and I want to install it. We can easliy install this package because we already have *.bench.ts files. Prisma is already using it, and it is available for free in public open source projects.

image

Features

CodSpeed visualizes performance metrics, allowing us to see improvements or regressions by comparing with previous benchmarks. We can view these visualizations both in PR comments and on the codSpeed dashboard. (maybe it would be https://codspeed.io/toss/es-toolkit/benchmarks)

Changes

When I tested it in the forked repository, and it was difficult to identify which function belonged to lodash and es-toolkit. So, I added delimiters like lodash/uniq and es-toolkit/uniq in the *.bench.ts file.

image

@juno7803 juno7803 self-assigned this Jun 17, 2024
@juno7803 juno7803 requested a review from raon0211 as a code owner June 17, 2024 17:38
Copy link

vercel bot commented Jun 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
es-toolkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2024 1:08am

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e3dbe50) to head (3466fb9).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #75   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           51        51           
  Lines          262       262           
  Branches        29        29           
=========================================
  Hits           262       262           

Copy link

codspeed-hq bot commented Jun 17, 2024

CodSpeed Performance Report

Congrats! CodSpeed is installed 🎉

🆕 86 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks

  • es-toolkit/chunk (28.3 µs)
  • lodash/chunk (29.3 µs)
  • es-toolkit/clamp (20.7 µs)
  • lodash/clamp (21.9 µs)
  • es-toolkit/difference (26.7 µs)
  • lodash/difference (210 µs)
  • es-toolkit/differenceBy (31.3 µs)
  • lodash/differenceBy (378.2 µs)
  • es-toolkit/differenceWith (31.7 µs)
  • lodash/differenceWith (231.9 µs)
  • es-toolkit/drop (19.6 µs)
  • lodash/drop (26.5 µs)
  • es-toolkit/dropRight (20 µs)
  • lodash/dropRight (26.6 µs)
  • es-toolkit/dropRightWhile (26.6 µs)
  • lodash/dropRightWhile (30.5 µs)
  • es-toolkit/dropWhile (23.8 µs)
  • lodash/dropWhile (29.9 µs)
  • es-toolkit/groupBy (55.9 µs)
  • lodash/groupBy (62.1 µs)
  • es-toolkit/intersection (2.8 ms)
  • lodash/intersection (18.5 ms)
  • es-toolkit/intersection (24.6 µs)
  • lodash/intersection (70.7 µs)
  • es-toolkit/intersectionBy (53.8 µs)
  • lodash/intersectionBy (307.9 µs)
  • es-toolkit/intersectionWith (54.2 µs)
  • lodash/intersectionWith (245.5 µs)
  • es-toolkit/isNil (18.1 µs)
  • lodash/isNil (190.6 µs)
  • es-toolkit/maxBy (36.8 µs)
  • lodash/maxBy (38.5 µs)
  • es-toolkit/minBy (36.7 µs)
  • lodash/minBy (38.6 µs)
  • es-toolkit/omit (37.2 µs)
  • lodash/omit (90.7 µs)
  • es-toolkit/omitBy (43.3 µs)
  • lodash/omitBy (80.1 µs)
  • es-toolkit/partition (35.7 µs)
  • lodash/partition (31.9 µs)
  • es-toolkit/pick (30.9 µs)
  • lodash/pick (86.9 µs)
  • es-toolkit/random (19.7 µs)
  • lodash/random (32.5 µs)
  • es-toolkit/round (20.4 µs)
  • lodash/round (40.8 µs)
  • es-toolkit/sample (22.4 µs)
  • lodash/sample (23.3 µs)
  • es-toolkit/shuffle (41.3 µs)
  • lodash/shuffle (319.7 µs)
  • es-toolkit/sum (21.9 µs)
  • lodash/sum (23.1 µs)
  • es-toolkit/take (19.7 µs)
  • lodash/take (26.2 µs)
  • es-toolkit/takeRight (20.1 µs)
  • lodash/takeRight (26.3 µs)
  • es-toolkit/takeRightWhile (22.8 µs)
  • lodash/takeRightWhile (29.9 µs)
  • es-toolkit/takeWhile (22.7 µs)
  • lodash/takeWhile (27.1 µs)
  • es-toolkit/union (32.6 µs)
  • lodash/union (231.7 µs)
  • es-toolkit/unionBy (47.2 µs)
  • lodash/unionBy (356.5 µs)
  • es-toolkit/unionWith (61.1 µs)
  • lodash/unionWith (244.4 µs)
  • es-toolkit/uniq (23.3 µs)
  • lodash/uniq (28.8 µs)
  • es-toolkit/uniqBy (6.9 ms)
  • lodash/uniqBy (17.2 ms)
  • es-toolkit/uniqBy (33.5 µs)
  • lodash/uniqBy (38.2 µs)
  • es-toolkit/uniqWith (7.4 s)
  • lodash/uniqWith (7.1 s)
  • es-toolkit/uniqWith (38.4 µs)
  • lodash/uniqWith (36.6 µs)
  • es-toolkit/xor (57.3 µs)
  • lodash/xor (376.6 µs)
  • es-toolkit/xorBy (61.4 µs)
  • lodash/xorBy (404.3 µs)
  • es-toolkit/xorWith (72.3 µs)
  • lodash/xorWith (260.2 µs)
  • es-toolkit/zip (40.9 µs)
  • lodash/zip (236.5 µs)
  • es-toolkit/zipWith (58.7 µs)
  • lodash/zipWith (254.4 µs)

manudeli
manudeli previously approved these changes Jun 17, 2024
Copy link
Member

@manudeli manudeli left a comment

Choose a reason for hiding this comment

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

Way better DX. This motivate contributors intuitively with numbers

@@ -3,11 +3,11 @@ import { partition as partitionToolkit } from 'es-toolkit';
import { partition as partitionLodash } from 'lodash';

describe('partition', () => {
bench('es-toolkit', () => {
bench('es-toolkit/', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

es-toolkit/partition ?

Copy link
Member Author

Choose a reason for hiding this comment

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

🦅👀 I fixed it. Thanks! 3020b5d

Copy link
Collaborator

@raon0211 raon0211 left a comment

Choose a reason for hiding this comment

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

Thanks!

@raon0211 raon0211 merged commit 3cc1a03 into main Jun 18, 2024
10 checks passed
@juno7803 juno7803 deleted the feat/add-codspeed branch June 18, 2024 01:50
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.

4 participants