♪ ♪ So, yeah, I want to talk to you about patterns for performance, because I guess we've already seen some talks today which have been talking about performance, and as a React developer, that is a key thing that a lot of us are always, I guess, important to us, important to our users. So that's why I want to share this with you today.
As I do work for Azure Grid, there's going to be some grids featured in this talk. So, can you say which of these grids is better? We've got the top one where you're resizing and it's, you know, jumping along, or you've got the bottom one where you've got this smooth resizing. So I think it's obvious which ones our users would want to use and which you would want to work with. And so this is something we're going to dive into and say how we solved this issue.
So, as you already know, I work at Azure Grid and our mission is to create the best JavaScript or React data table in the world. So, you know, we've got a free version. We've got enterprise versions. So do come and find out more about this because we think it's a brilliant product and it's getting better and we are really heavily investing in our React component. So we hope you can try it out, but that's enough about Azure Grid. You want to know about performance.
So to, I guess, give us a story for this talk, we want to have this reconstruction where a user has started using Azure Grid, very old version, which doesn't have this issue anymore, and they said, oh, you know, when I use this custom component, the grid does this really slow resizing. So they think, oh, okay, but they also say, well, it's when they're using a custom cell renderer. So just to give you, I guess, the background you need, custom cell renderers are a way for you as a React developer to give our grid a functional component or a class component and say render this within every cell. So here we've got a weather table where instead of numbers, you've got pictograms based on how many days of sunshine. And that would be your own React component. So in the use case, we've got they're displaying a total. So they might have a renderer like this, where in the body of their renderer, they've got some really complex logic, which is really slow. And then they're just returning a value. I mean, this isn't going to be slow, but just go with me and hopefully it'll demonstrate what we're trying to show here. And then to use this cell renderer, they pass it to the grid in this way. We'll find that on their column saying, well, actually render this with my renderer and pass it to the AG grid component. So we'll come back to this stage and we think, okay, how are we going to resolve this issue? Because we haven't noticed it yet. If we want to diagnose why it's slow, we need to just take a step back and think, well, in the normal case, when it works fast, how does the grid behave in that situation? So we take a benchmark. This is the standard grid, no cell renders, and it resizes really smoothly. We're going to use the React DevTools profiler and we'll profile it and we get something like this. So while we're resizing the column, we've got 254 renders going on. So that is a lot of renders, but they're really fast renders. So that's why you're not really seeing any slowdown despite the fact that there's that many renders.
Comments