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

scrollable Table lags #4522

Closed
DerekHQ opened this issue Jan 9, 2017 · 20 comments
Closed

scrollable Table lags #4522

DerekHQ opened this issue Jan 9, 2017 · 20 comments
Assignees

Comments

@DerekHQ
Copy link

DerekHQ commented Jan 9, 2017

Environment(required)

  • antd version: 2.6.1
  • OS and its version: Windows10
  • Browser and its version: Chrome \ IE11

Antd的 table组件,分页(每页二十条)显示列表数据时,

  1. 在chrome浏览器内性能正常,但在IE11浏览器内,滚动条以及行高亮事件,CPU(i7)占用相当严重(40%-90%),以至卡顿无法正常使用;
  2. 测试使用原生的rc-table组件,列表每页显示几百条,chrome\ie11,均表现良好
@benjycui
Copy link
Contributor

benjycui commented Jan 9, 2017

具体 demo ?

性能优化是个很细节的问题,务必提供相关场景的 demo,谢谢。

@benjycui benjycui closed this as completed Jan 9, 2017
@benjycui benjycui reopened this Jan 9, 2017
@DerekHQ
Copy link
Author

DerekHQ commented Jan 9, 2017

不算优化,就是普通简单表格DEMO,静态数据,装进antd-table, IE11 就非常卡顿(滚动滚动条或者鼠标来回在表上来回的mouseover,CPU占用就很高); 装进rc-table就没有什么问题!
尤其是表格带fixed列的情况下,尤为严重!

@DerekHQ
Copy link
Author

DerekHQ commented Jan 9, 2017

最简单的就是你们用 IE11 访问你们的antd官网组件下的table页面,看看是否卡死,谢谢!

@yesmeck yesmeck self-assigned this Jan 9, 2017
@yesmeck
Copy link
Member

yesmeck commented Jan 9, 2017

@DerekHQ 试了 1000 条数据每页 20 条分页并不卡,可以的话还是帮我们提供个 demo 吧,官网上例子太多很难定位问题。

@DerekHQ
Copy link
Author

DerekHQ commented Jan 9, 2017

@yesmeck 谢谢,这么晚了还在处理问题!明天我准备个DEMO!^_^

@DerekHQ
Copy link
Author

DerekHQ commented Jan 9, 2017

@yesmeck 在IE11下测试

"babel-preset-es2015": "^6.0.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.0.0",

"babel-polyfill": "^6.20.0"

table.txt

@benjycui
Copy link
Contributor

@DerekHQ Please provide a re-producible demo: http://codepen.io/benjycui/pen/KgPZrE?editors=001

@DerekHQ
Copy link
Author

DerekHQ commented Jan 10, 2017

@benjycui 'Codepen' is not support IE11.

@benjycui
Copy link
Contributor

@DerekHQ it works fine while I test it in IE11..

@DerekHQ
Copy link
Author

DerekHQ commented Jan 10, 2017

@benjycui demo 放到了你的codepen上了,但是IE11下无法看到运行效果,Edge能看; 实际效果是:chrome极为流畅,Edge有些卡顿,IE11极为卡顿; 我们多台笔记本测试效果都是一样!

@afc163
Copy link
Member

afc163 commented Jan 10, 2017

@DerekHQ 你需要 fork 一份,否则我们看不到。

@DerekHQ
Copy link
Author

DerekHQ commented Jan 10, 2017

@afc163 afc163 changed the title Antd Table组件,性能问题! Table lags when scrollable Jan 18, 2017
@afc163 afc163 changed the title Table lags when scrollable scrollable Table lags Jan 18, 2017
@yesmeck
Copy link
Member

yesmeck commented Feb 4, 2017

发现跟 css 有关系,用 antd 的 Table 但是配合 rc-table 的 css 就不会卡。

@yesmeck
Copy link
Member

yesmeck commented Feb 4, 2017

&-tbody > tr > td {
border-bottom: @border-width-base @border-style-base @border-color-split;
position: relative;
}

&-tbody > tr > td {
  border-bottom: @border-width-base @border-style-base @border-color-split;
  position: relative;
}

这几句删掉就不卡了。

@yesmeck
Copy link
Member

yesmeck commented Feb 4, 2017

有上面的 CSS 滚动时发生的 paint:

before

去掉上面的 CSS 后:

after

@yesmeck
Copy link
Member

yesmeck commented Feb 4, 2017

去掉 position: relative 就可以了。

@afc163 这句有没有特别的作用。

@yesmeck
Copy link
Member

yesmeck commented Feb 4, 2017

commit 01f5b61

@afc163
Copy link
Member

afc163 commented Feb 4, 2017

有用,稍等我找下场景。

IE 真是见鬼,这居然会卡。

@afc163
Copy link
Member

afc163 commented Feb 4, 2017

之前有需求希望把单元格设置成其他色彩的需求。当时使用了类似下面的 hack 去做:

render: () => {
  return <div className="blue">xxx</div>
}
.ant-table td {
  position: relative;
}
.blue:after {
  position: abolute;
  background: blue;
}

然后后来干脆默认在 td 直接加上 position: relative;,方便这样的定制。


现在如果有性能问题,先删掉,反正没有作为正式场景放出来。

@afc163 afc163 closed this as completed in 8775e7d Feb 4, 2017
@lock
Copy link

lock bot commented May 2, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants