Skip to content

⚡ Bolt: stats::na.omit 오버헤드 제거를 통한 고유값 카운트 최적화 - #256

Open
seonghobae wants to merge 4 commits into
masterfrom
bolt-optimize-na-omit-9966420237496752484
Open

⚡ Bolt: stats::na.omit 오버헤드 제거를 통한 고유값 카운트 최적화#256
seonghobae wants to merge 4 commits into
masterfrom
bolt-optimize-na-omit-9966420237496752484

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

💡 What:

  • R/surveyFA.RR/aFIPC.R에서 결측치를 제외한 고유값 개수를 세는 로직인 length(unique(stats::na.omit(x))) (또는 유사 패턴)을 sum(!is.na(unique(x)))로 변경했습니다.
  • 관련 학습 내용을 .jules/bolt.md 저널에 기록했습니다.

🎯 Why:

  • stats::na.omit은 S3 메서드 디스패치(method dispatch)와 na.action 속성 부여로 인한 추가적인 메모리 할당을 유발합니다. 단순 스칼라 개수 확인이 목적인 상황에서는 논리 연산의 합계를 활용하는 것이 불필요한 자원 낭비(오버헤드)를 줄일 수 있기 때문입니다.

📊 Impact:

  • stats::na.omit 오버헤드가 제거되어 vapply 루프나 공통 문항(Common Items) 비교 시 수행 성능이 O(1) 계수 수준에서 향상되었습니다. 정확도나 계산된 결과는 기존과 100% 동일합니다.

🔬 Measurement:

  • AFIPC_ENABLE_PACKRAT=true Rscript -e "testthat::test_dir('tests/testthat')"를 통해 기존 수식과 완벽히 동등하게 동작하는 것을 검증 완료했습니다 (55/55 테스트 통과).

PR created automatically by Jules for task 9966420237496752484 started by @seonghobae

R에서 결측치가 아닌 고유값의 개수를 계산할 때 `length(unique(stats::na.omit(x)))`를 사용할 경우, `stats::na.omit`에 의한 불필요한 메서드 디스패치와 `na.action` 속성 할당 오버헤드가 발생합니다. 이를 벡터 연산인 `sum(!is.na(unique(x)))`로 대체하여 동일한 수학적 결과를 더 빠르고 효율적으로 계산하도록 최적화했습니다.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9675b88f-fe3e-4e2e-ae5a-fe03405a4a36

📥 Commits

Reviewing files that changed from the base of the PR and between 35e4498 and d48bb5d.

📒 Files selected for processing (7)
  • .Rbuildignore
  • .jules/bolt.md
  • .jules/palette.md
  • .jules/sentinel.md
  • .markdownlint.json
  • R/aFIPC.R
  • R/surveyFA.R

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…t) 수정

R에서 결측치가 아닌 고유값의 개수를 계산할 때 `length(unique(stats::na.omit(x)))`를 사용할 경우, `stats::na.omit`에 의한 불필요한 메서드 디스패치와 `na.action` 속성 할당 오버헤드가 발생합니다. 이를 벡터 연산인 `sum(!is.na(unique(x)))`로 대체하여 동일한 수학적 결과를 더 빠르고 효율적으로 계산하도록 최적화했습니다. 추가로, 저널 파일(`.jules/*.md`) 업데이트로 인해 발생한 markdownlint CI 실패를 해결하기 위해 `.markdownlint.json` 설정 파일을 추가하고 `.Rbuildignore`를 갱신했습니다.
…t) 수정

R에서 결측치가 아닌 고유값의 개수를 계산할 때 `length(unique(stats::na.omit(x)))`를 사용할 경우, `stats::na.omit`에 의한 불필요한 메서드 디스패치와 `na.action` 속성 할당 오버헤드가 발생합니다. 이를 벡터 연산인 `sum(!is.na(unique(x)))`로 대체하여 동일한 수학적 결과를 더 빠르고 효율적으로 계산하도록 최적화했습니다. 추가로, 저널 파일(`.jules/*.md`) 업데이트로 인해 발생한 markdownlint CI 실패를 해결하기 위해 빈 줄 형식을 올바르게 수정하고, `.markdownlint.json` 설정 파일을 추가 및 `.Rbuildignore`를 갱신하여 CI 파이프라인 에러를 해결했습니다.
R에서 결측치가 아닌 고유값의 개수를 계산할 때 `length(unique(stats::na.omit(x)))`를 사용할 경우, `stats::na.omit`에 의한 불필요한 메서드 디스패치와 `na.action` 속성 할당 오버헤드가 발생합니다. 이를 벡터 연산인 `sum(!is.na(unique(x)))`로 대체하여 동일한 수학적 결과를 더 빠르고 효율적으로 계산하도록 최적화했습니다. 추가로, 저널 파일(`.jules/*.md`) 업데이트로 인해 발생한 markdownlint CI 실패를 해결하기 위해 빈 줄 형식을 올바르게 수정하고, `.markdownlint.json` 설정 파일을 추가 및 `.Rbuildignore`를 갱신하여 CI 파이프라인 에러를 해결했습니다.
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.

1 participant