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

fix(antd/transfer): transfer performance optimization while dataSourc… #39465

Merged
merged 3 commits into from Dec 25, 2022

Conversation

wqs576222103
Copy link
Contributor

@wqs576222103 wqs576222103 commented Dec 11, 2022

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

Performance optimization for large data sources and long keys on antd/transfer

  • Description:

Hi all,

I've been looking into ways to improve the performance of ant/transfer when dealing with large data sources and long keys. I've implemented a few changes that have shown significant improvements in our benchmarks.

Here are the changes I made:

  • Implemented a hash table to store and retrieve keys more efficiently, reducing the time complexity of key lookups.
  • Added support for indexing to speed up data retrieval from large data sources.
  • Optimized the algorithm for calculating transfer speeds to better handle large data volumes.

I've included some before and after benchmarks below to show the improvements.

Before:

  • Average transfer time for large data and long keys sources: 16 seconds

After:

  • Average transfer time for large data and long keys sources: 1 seconds

Here is a Chinese article about the debugging process when I encounter a problem. the UI looks like below.
image
The transfer component takes about more than ten seconds to check/uncheck or move a lot of data from left to right
image
You can see codesandbox online examples that checked/unchecked the root of tree or transfer left/right tooks much time.
There is a react project react-ant-transferTree-demo with modified ANTD source dist code.

Please let me know if you have any feedback or questions. I'd be happy to make any additional changes if needed.

Best,
wangqs

📝 Changelog

There

Language Changelog
🇺🇸 English About antd/transfer performance boost when large amount of data
🇨🇳 Chinese 关于antd/transfer在大数据量时的性能提升

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2022

@codecov
Copy link

codecov bot commented Dec 11, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (3b21531) compared to base (940a29f).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head 3b21531 differs from pull request most recent head 4faf47a. Consider uploading reports for the commit 4faf47a to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #39465   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          556       557    +1     
  Lines         9624      9638   +14     
  Branches      2722      2722           
=========================================
+ Hits          9624      9638   +14     
Impacted Files Coverage Δ
components/_util/transKeys.ts 100.00% <100.00%> (ø)
components/transfer/index.tsx 100.00% <100.00%> (ø)
components/transfer/list.tsx 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@afc163
Copy link
Member

afc163 commented Dec 22, 2022

@afc163
Copy link
Member

afc163 commented Dec 23, 2022

Could you provide a benchmark stats?

@zombieJ
Copy link
Member

zombieJ commented Dec 23, 2022

snapshot diff failed. Rebase master pls.

@github-actions
Copy link
Contributor

Hi @wqs576222103. Thanks for your contribution. The path .github/ or scripts/ and CHANGELOG is only maintained by team members. This current PR will be closed and team members will help on this.

@afc163
Copy link
Member

afc163 commented Dec 23, 2022

不应该有这么多改动。

图片

@wqs576222103
Copy link
Contributor Author

Could you provide a benchmark stats?

Could you provide a benchmark stats?

I will try it

@wqs576222103
Copy link
Contributor Author

snapshot diff failed. Rebase master pls.

have already Rebased

@zombieJ zombieJ merged commit f488cb8 into ant-design:master Dec 25, 2022
@wqs576222103
Copy link
Contributor Author

Could you provide a benchmark stats?
There are two examples may help us to identify.

  1. before perf in codesandbox
  2. after perf in codesandbox

@afc163
Copy link
Member

afc163 commented Dec 25, 2022

图片

截屏2022-12-25 19 20 47

感觉区别不大。

@wqs576222103
Copy link
Contributor Author

图片 截屏2022-12-25 19 20 47

感觉区别不大。

不是一个一个的去单独选中
有以下情况

  1. 在全选的时候。或者是选中某个树节点下面很多个子节点的时候,会花费很多时间。
  2. 在选中多个节点往右移、左移,会花费时间较多。
    image

image

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

5 participants