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

🚀 find #153

Closed
wants to merge 3 commits into from
Closed

🚀 find #153

wants to merge 3 commits into from

Conversation

yceffort-naver
Copy link
Contributor

This resolves #63

@yceffort-naver yceffort-naver self-assigned this Dec 4, 2024
Copy link
Contributor

github-actions bot commented Dec 4, 2024

✅ All utility modules are properly registered

@npayfebot
Copy link
Collaborator

npayfebot commented Dec 4, 2024

✅ Changeset detected

Latest commit: 9983a95

@naverpay/hidash package have detected changes.

If no version change is needed, please add skip-detect-change to the label.

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

powered by: naverpay changeset detect-add actions

Copy link
Contributor

github-actions bot commented Dec 4, 2024

Benchmark Results

Method Test Performance Comparison hidash ops/sec lodash@4.17.21 ops/sec
find src/find.bench.ts > find performance hidash is 4.15x faster 1547.40 🏆 373.08

Note: Higher operations per second (ops/sec) numbers are better. Each test compares hidash vs lodash implementation.

⚠️ indicates where hidash is slower than lodash.

🏆 indicates the faster implementation.

View Full Benchmark Data
{
  "files": [
    {
      "filepath": "/home/runner/work/hidash/hidash/src/find.bench.ts",
      "groups": [
        {
          "fullName": "src/find.bench.ts > find performance",
          "benchmarks": [
            {
              "id": "-2037859673_0_0",
              "name": "hidash",
              "rank": 1,
              "rme": 2.477793741108984,
              "samples": [],
              "totalTime": 500.1922619999998,
              "min": 0.5371119999999792,
              "max": 1.422384999999963,
              "hz": 1547.4049856453003,
              "period": 0.6462432325581393,
              "mean": 0.6462432325581393,
              "variance": 0.051659611709686803,
              "sd": 0.22728750891698118,
              "sem": 0.008169680800339772,
              "df": 773,
              "critical": 1.96,
              "moe": 0.016012574368665954,
              "p75": 0.6007720000000063,
              "p99": 1.3861080000000356,
              "p995": 1.4023689999999647,
              "p999": 1.422384999999963,
              "sampleCount": 774,
              "median": 0.5528104999999641
            },
            {
              "id": "-2037859673_0_1",
              "name": "lodash",
              "rank": 2,
              "rme": 1.9315795605281465,
              "samples": [],
              "totalTime": 501.2380760000026,
              "min": 2.4452880000001187,
              "max": 4.033638999999994,
              "hz": 373.07620660486106,
              "period": 2.6804175187165913,
              "mean": 2.6804175187165913,
              "variance": 0.13048469105423569,
              "sd": 0.36122664776319546,
              "sem": 0.02641550863691091,
              "df": 186,
              "critical": 1.96,
              "moe": 0.05177439692834538,
              "p75": 2.677381000000196,
              "p99": 4.007618999999977,
              "p995": 4.033638999999994,
              "p999": 4.033638999999994,
              "sampleCount": 187,
              "median": 2.5369779999998627
            }
          ]
        }
      ]
    }
  ]
}

Last updated by GitHub Actions

return isPartialMatch(item, predicate as DeepPartial<T>)
}

export function find<T>(collection: T[] | Record<string, T>, predicate?: Predicate<T> | Shorthand<T>): T | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

https://deno.land/x/lodash@4.17.13-amd/_createFind.js?source

구현상 baseIteratee타입이 적용되어야 하는것 같아서 predicate: predicate?: ListIterateeCustom<T, unknown> 아닐까요 혹시~?

const iteratee = baseIteratee(predicate)

혹시 추가 성능 개선 필요하다면 baseIteratee 쪽에 통일되는 편이 앞으로 collection 처리할 때 유용할거 같습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네네 최초에 그렇게 했는데... 초큼 많이 느려가지고 잠깐 손좀 보고 말씀드리겠습니다!

}

export function find<T>(collection: T[] | Record<string, T>, predicate?: Predicate<T> | Shorthand<T>): T | undefined {
const array = isArray(collection) ? collection : Object.values(collection)
Copy link
Contributor

Choose a reason for hiding this comment

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

요거 보니까 collection이 꼭 T[]일 필요 없을거 같습니다~

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.

find
3 participants