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

Performance Issue with DnD and onSelectEvent #1103

Closed
dbuchet opened this issue Nov 12, 2018 · 11 comments
Closed

Performance Issue with DnD and onSelectEvent #1103

dbuchet opened this issue Nov 12, 2018 · 11 comments
Labels

Comments

@dbuchet
Copy link
Contributor

dbuchet commented Nov 12, 2018

Do you want to request a feature or report a bug?

Performance issue

What's the current behavior?

Hi there.
I've just updated from 0.19.2 to 0.20.2 and I have a performance issue when using onSelectEvent with DnD activated
prtscr_capture

No problem with 0.19.2 (i'm using the same code) or if set event draggable to false.
So I assume there is a leak when detecting click event vs startDrag / endDrag

I've launched DnD example and added an onSelectEvent with a console.log, and I have 1.5s delay before the console.log is triggered, so I assume it's not from my code :)

Thanks !

@jquense
Copy link
Owner

jquense commented Nov 12, 2018

We may have addressed this partly in a recent PR, can you try and use the current master and see if it still occurs? If so there could definately be some performance low hanging fruit to be picked, we switched from react-dnd which is pretty tuned and optimized (but not a great solution for us) to something more custom so we haven't had a chance to stress test it in lots of different places. More than happy to take PR's on this front as well if you're up for it

@dbuchet
Copy link
Contributor Author

dbuchet commented Nov 12, 2018

Hello jquense,
Yes I've tried with current master branch, and even if it's a bit faster, I still have 1s~1.5s delay when I select an event.

I'll look if I found something!

@RusinovAnton
Copy link
Contributor

I have problems with performance using dnd and onSelectEvent too
Here is results of React Profiler

image

@RusinovAnton
Copy link
Contributor

Commenting these two lines from addons/dragAndDrop/EventWrapper.js makes it work much faster but breaks the drag n drop obviously.

https://github.com/intljusticemission/react-big-calendar/blob/master/src/addons/dragAndDrop/EventWrapper.js#L125-L126

@bs85
Copy link
Collaborator

bs85 commented Nov 19, 2018

Might be fixed by #1118

@dbuchet
Copy link
Contributor Author

dbuchet commented Nov 19, 2018

Thanks, i'll check when your PR is merged

@RusinovAnton
Copy link
Contributor

It is a bit better but still there is a visible lag on drag start:
image

@bs85
Copy link
Collaborator

bs85 commented Nov 19, 2018

There are still a bunch of setState calls in there, can you see where they are originating from?

@amazingmarvin
Copy link
Contributor

Possibly this is the same issue I was having. componentDidUpdate calls TimeGrid.measureGutter which calls setState and it repeats forever. See this commit for fix. After that it felt much snappier. I suspect some of my custom styling is giving the gutter a different width than state.gutterWidth.

@RusinovAnton
Copy link
Contributor

RusinovAnton commented Dec 27, 2018

There are still a bunch of setState calls in there, can you see where they are originating from?

Actually, I do not have performance issues with DnD now.
Maybe that was a cache or something. I don't use onSelectEvent tho, just plain on click within event component.

Thanks for great fix, bs85!

@stale
Copy link

stale bot commented May 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 23, 2019
@stale stale bot closed this as completed May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants