⚡ Bolt: 고유 값 카운트 시 stats::na.omit 오버헤드 최적화 - #307
Conversation
R에서 `length(stats::na.omit(unique(x)))` 대신 `sum(!is.na(unique(x)))`를 사용하도록 수정하여, `stats::na.omit` 호출 시 발생하는 메서드 디스패치(method dispatch)와 속성 할당(attribute allocation) 오버헤드를 제거했습니다.
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit 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. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
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. Comment |
| (sum(!is.na(unique(newFormModel@Data$data[, newFormItemName]))) == | ||
| sum(!is.na(unique(oldFormModel@Data$data[, oldFormItemName])))) |
There was a problem hiding this comment.
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) 오버헤드를 제거했습니다.
💡 What:
R/aFIPC.R와R/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