Skip to content

⚡ Bolt: 고유 값 카운트 시 stats::na.omit 오버헤드 최적화 - #307

Open
seonghobae wants to merge 2 commits into
masterfrom
bolt/optimize-na-omit-1824799397000706099
Open

⚡ Bolt: 고유 값 카운트 시 stats::na.omit 오버헤드 최적화#307
seonghobae wants to merge 2 commits into
masterfrom
bolt/optimize-na-omit-1824799397000706099

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

💡 What: R/aFIPC.RR/surveyFA.R에서 사용되던 length(stats::na.omit(unique(x))) 또는 length(unique(stats::na.omit(x))) 구문을 모두 sum(!is.na(unique(x)))로 교체했습니다.
🎯 Why: R의 stats::na.omit 함수는 S3 메서드 디스패치를 수행하고 na.action 속성을 할당하는 과정에서 불필요한 성능 오버헤드를 발생시킵니다. 내부적으로 C 레벨에서 처리되는 논리 연산자(!is.na)와 합계(sum)를 사용하면 이러한 오버헤드 없이 동일한 로직(NA가 아닌 고유 값의 개수 측정)을 훨씬 빠르게 수행할 수 있습니다.
📊 Impact: 반복적으로 호출되는 surveyFA 및 공통 문항 매칭 부분의 성능이 개선되었습니다. 동일한 결과를 반환하므로 하위 호환성 문제가 없습니다.
🔬 Measurement: testthat 테스트 스위트가 기존과 동일하게 모든 테스트를 통과(PASS)하며, 속도 향상을 기대할 수 있습니다. 관련된 내용은 .jules/bolt.md 저널에 기록했습니다.


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


Devin Review

R에서 `length(stats::na.omit(unique(x)))` 대신 `sum(!is.na(unique(x)))`를 사용하도록 수정하여, `stats::na.omit` 호출 시 발생하는 메서드 디스패치(method dispatch)와 속성 할당(attribute allocation) 오버헤드를 제거했습니다.
@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 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 51 minutes.

View limit details

Limit details: You’ve used the included review currently available.

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4167b29f-39fb-40f2-99d8-95ebaf782232

📥 Commits

Reviewing files that changed from the base of the PR and between f87c232 and ab4c63b.

📒 Files selected for processing (3)
  • .jules/bolt.md
  • 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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment thread R/aFIPC.R
Comment on lines +774 to +775
(sum(!is.na(unique(newFormModel@Data$data[, newFormItemName]))) ==
sum(!is.na(unique(oldFormModel@Data$data[, oldFormItemName]))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Regression guard misses new formula

The formula-integrity test still evaluates the previous expression. Add the optimized expression and edge cases so this calibration change has direct regression coverage.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

R에서 `length(stats::na.omit(unique(x)))` 및 `length(unique(stats::na.omit(x)))` 대신 `sum(!is.na(unique(x)))`를 사용하도록 수정하여, `stats::na.omit` 호출 시 발생하는 메서드 디스패치(method dispatch)와 속성 할당(attribute allocation) 오버헤드를 제거했습니다.
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