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

perf: large data with tree grid #1916

Merged
merged 4 commits into from
May 23, 2023
Merged

Conversation

jajugoguma
Copy link
Contributor

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

  • Improved performance when expanding/collapsing in a tree grid of large data.
    • Improved rendering performance by preventing the rendering of child rows that are collapsed and therefore invisible.
      • Previously, it rendered more than the number of collapsed child rows * the number of columns.
    • When collapsing a tree, unobserve the tree property of child rows to avoid unnecessarily performing observable data behavior later on.
  • It gave about a 2000x performance improvement.(from about 300000ms to about 150ms)
    • Test environment
      • Large children data: 10000 rows, 50 columns
      • Make all child row to observable by scroll to bottom.
      • M1 Pro, 16GB, Mac OS 13.1, Chrome 113

Thank you for your contribution to TOAST UI product. πŸŽ‰ 😘 ✨

Copy link

@adhrinae adhrinae left a comment

Choose a reason for hiding this comment

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

κ°œμ„ μ΄ λ˜μ—ˆμœΌλ©΄ μ’‹κ² λ‹€κ³  μƒκ°ν•˜λŠ” 뢀뢄에 μ½”λ©˜νŠΈ λ‚¨κΉλ‹ˆλ‹€. μ‹œκ°„μ΄ λ„ˆλ¬΄ 많이 λ“€κ±°λ‚˜ μ–΄λ ΅λ‹€κ³  μƒκ°ν•œλ‹€λ©΄ νŒ¨μŠ€ν•΄λ„ λ©λ‹ˆλ‹€.

@@ -184,6 +184,20 @@ export function partialObservable<T extends Dictionary<any>>(obj: T, key: string
makeObservableData(obj, obj, key, storage, propObserverIdSetMap);
}

export function unobservable<T extends Dictionary<any>>(obj: T, keys: Array<keyof T> = []) {

Choose a reason for hiding this comment

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

이 ν•¨μˆ˜κ°€ ν•˜λŠ” 역할이 κΈ°μ‘΄ 객체λ₯Ό getOriginObjectλ₯Ό ν˜ΈμΆœν•΄μ„œ λ°˜ν™˜λœ 일반 객체와 μ–΄λ–»κ²Œ λ‹€λ₯΄μ£ ?

μ²˜μŒμ—λŠ” 주어진 ν‚€λ§Œ observable을 ν•΄μ œν•œλ‹€κ³  이해할 μˆ˜λŠ” μžˆκ² λŠ”λ°, obj.__storage__κΉŒμ§€ ν†΅μœΌλ‘œ 날리면 λ¬Έμ œκ°€ μ—†λ‚˜μš”?

μœ„μ˜ 의문이 λ“€λ‹€ λ³΄λ‹ˆ 이 ν•¨μˆ˜λŠ” λ™μž‘μ΄ λΆ€μ •ν™•ν•΄λ³΄μž…λ‹ˆλ‹€. ν•΄λ‹Ή 속성을 observerInfoMapμ—μ„œ μ œκ±°ν•˜λŠ” λ™μž‘μ΄ 보이지 μ•ŠκΈ° λ•Œλ¬Έμž…λ‹ˆλ‹€. 그러면 점점 λΆˆν•„μš”ν•œ λ©”λͺ¨λ¦¬ λ‚­λΉ„κ°€ λ°œμƒν•  수 μžˆμŠ΅λ‹ˆλ‹€.

λ§Œμ•½ getOriginObjectλ₯Ό ν™œμš©ν•˜λŠ” λ°©μ‹μœΌλ‘œ λŒ€μ²΄ν•  수 μžˆμ„μ§€ μ•„λ‹ˆλ©΄ observe ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•˜κ³  λ¦¬ν„΄λ˜λŠ” unobserve ν•¨μˆ˜ 등을 ν™œμš©ν•  방법은 없을지 κΆκΈˆν•˜λ„€μš”.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

getOriginObjectλ₯Ό μ‚¬μš©ν•˜λ„λ‘ λ³€κ²½ν–ˆμŠ΅λ‹ˆλ‹€.
그리고 __storage__λ₯Ό μ‚­μ œν•˜μ§€ μ•Šλ„λ‘ μˆ˜μ •ν•΄μ„œ objλ₯Ό λ‹€μ‹œ observable둜 λ³€κ²½ν•˜μ§€ μ•ŠμœΌλ―€λ‘œ observerInfoMap에 λΆˆν•„μš”ν•œ 데이터가 μΆ•μ λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 단지 obj에 주어진 μ†μ„±λ§Œ unobservable둜 λ³€κ²½ν•˜λŠ” μ •ν™•ν•œ λ™μž‘μ„ μˆ˜ν–‰ν•˜λŠ” ν•¨μˆ˜λ‘œ λŒ€μ²΄ ν–ˆμŠ΅λ‹ˆλ‹€.

}

type Props = OwnProps & StoreProps & DispatchProps;

class BodyRowsComp extends Component<Props> {
private getVisibleStateOfRows({ rawData, rows }: Pick<Props, 'rows' | 'rawData'>) {

Choose a reason for hiding this comment

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

이 λ‘œμ§μ„ λ·° λ ˆμ΄μ–΄μ—μ„œ ν™•μΈν•˜λŠ”κ²Œ μ•„λ‹ˆλΌ collapseλ₯Ό dispatchν•  λ•Œ ν•΄λ‹Ή Rowκ°€ 보여도 λ˜λŠ”μ§€ μˆ¨κ²¨μ•Ό λ˜λŠ”μ§€λ₯Ό 미리 가지고 μžˆλ„λ‘ λ§Œλ“€ 수 μ—†λ‚˜μš”?

λ·° λ ˆμ΄μ–΄μ˜ λ³΅μž‘λ„κ°€ λΆˆν•„μš”ν•˜κ²Œ μ˜¬λΌκ°€λŠ” λ™μž‘μœΌλ‘œ λ³΄μž…λ‹ˆλ‹€.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

슀크럼 λ•Œ λ§μ”€λ“œλ¦° 것과 같이, Row의 hidden 정보λ₯Ό rawData에 가지고 μžˆμ–΄μ„œ 이λ₯Ό ν™•μΈν•˜λŠ” 둜직이 μˆ˜ν–‰λ˜κ²Œ λ©λ‹ˆλ‹€. browserStack λ“±κ³Ό 같이 저사양 ν™˜κ²½μ—μ„œ 확인해본 κ²°κ³Ό, λ™μž‘ μˆ˜ν–‰μ˜ λ”œλ ˆμ΄κ°€ μ™„μ „νžˆ μ‚¬λΌμ§€μ§€λŠ” μ•Šμ•˜μ§€λ§Œ ν…ŒμŠ€νŠΈ ν™˜κ²½κ³Ό λ§ˆμ°¬κ°€μ§€λ‘œ μ•½ 2000λ°° κ°€λŸ‰μ˜ μ„±λŠ₯ ν–₯상이 μžˆλŠ” κ²ƒμœΌλ‘œ 확인 λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

이와 κ΄€λ ¨ν•΄μ„œλŠ” μš°μ„  배포 ν›„, κ΄€λ ¨ν•΄μ„œ μΆ”κ°€ κ°œμ„ μ΄ ν•„μš”ν•˜κ²Œ 되면 μΆ”ν›„ ꡬ쑰 등을 κ°œμ„ ν•˜λ„λ‘ ν•˜κ² μŠ΅λ‹ˆλ‹€.

Copy link

@sunyoungBae sunyoungBae left a comment

Choose a reason for hiding this comment

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

λ„ν˜• μ „μž„λ‹˜μ΄ 남겨주신 μ˜κ²¬μ„ μ œμ™Έν•˜κ³ λŠ” 이견 μ—†μŠ΅λ‹ˆλ‹€.

Copy link

@jwlee1108 jwlee1108 left a comment

Choose a reason for hiding this comment

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

리뷰 μ™„λ£Œν•©λ‹ˆλ‹€.

getVisibleStateOfRows 자체 λ³΅μž‘λ„κ°€ λ†’κΈ΄ν•œλ° μ €μ‚¬μ–‘ν™˜κ²½μ—μ„œ ν…ŒμŠ€νŠΈ 쑰금만 더 λŒλ €λ³΄μ‹œκ³  λ¬Έμ œκ°€ μ—†λŠ”μ§€ 확인 λ°”λžλ‹ˆλ‹€. λ§Œμ•½ μ΄μŠˆκ°€ μžˆλ‹€λ©΄ λ°˜ν™˜ν•  λ•Œ μ“°λŠ” rawData.reduceλ₯Ό 비동기 μ²˜λ¦¬ν•˜λŠ” λ“± ν•œ 번 λŠμ–΄λ‚΄μ•Όν•  μˆ˜λ„ μžˆκ² μ–΄μš”.

@jajugoguma jajugoguma merged commit 1cf852b into master May 23, 2023
3 of 4 checks passed
@jajugoguma jajugoguma deleted the perf/large_date_with_tree_grid branch May 23, 2023 07:39
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.

None yet

4 participants