Performance Struggles When Handling Extremely Large Deck Sizes

 avatar
{"ops":[{"insert":"I want to start by say recognizing that I'm not really using this software for what its common intended use case is, and with that my expectations are very tempered by how ridiculous this all is. I know that this is actually "},{"attributes":{"bold":true},"insert":"so"},{"insert":" not supposed to be what its used for that competing products just won't let you (so it would be even cooler if you did *wink*). However, earlier I was trying to put together an extremely large \"deck list\" (n = 1421) for the purposes of organizing a bunch of cards I wanted to sort through and evaluate to build a new deck, and very steadily (as I imagined it probably would) there reached a point where the software was really struggling with the number of cards it was having to handle. While things were still functional, all animations and user interactions had crawled to a stand-still. Hoping it might make things just a little bit better I turned off as many preview images as I could, but that didn't make much of a difference.\n\nCurious for myself I pulled open the developer tools and starting trying to see what might be up and saw that the heap had grown to well over 1GB (1062 MB; for about 747 KB per card). I also ran the profiler while trying to add cards and saw that the evaluation of that click was taking over 6s with the bulk of it coming from a strangely large number of calls to \"getRandomValues\" and a set of two obfuscated functions that recursively called one another over 2000 times. Looking closer at the memory usage, from what I could gather it appears every card object contains multiple anonymous closures that don't seem structurally important but whose scope also ends up retaining memory proportional to all the other cards in scope. This seemed to be causing memory usage to grow exponentially.\n\nI'm making a post here not really expecting any kind of swift action or anything, but more just to say that I really love your product. It's easily the best deck builder that I've used and at this point I've completely moved over to using it for anything related to card organization that I need to do. While I certainly don't expect it to be optimized for such an extreme and niche use case, and honestly don't expect most software to behave well while also handling really large datasets like that, it would be cool if there was a world where it was capable of handling a more moderately large number of cards with greater ease. It also seemed from just briefly looking at the code that there might be some really quick ways of restructuring some of those card loops to clean up how long they're taking and the amount of excess memory they're retaining.\n\nIf you wanted a similar deck list to mess with I made an unlisted copy linked below.\n"},{"attributes":{"link":"https://archidekt.com/decks/7846835/too_many_cards"},"insert":"https://archidekt.com/decks/7846835/too_many_cards"},{"insert":"\n\nThanks for all the great work you do!\n"}]}
1
 avatar
{"ops":[{"insert":"Generally speaking, I don't really bother with any bug reports/ slowness reports dealing with decks over 300 cards since our official stance is that anything larger than that we flat out don't support. But since you seem to have put in some amount of leg work, I'll take a peek. \n\nI'm not seeing the function calls in the performance tools that you mentioned. Admitadly, while I'm pretty familiar with the chrome dev tool suite, I haven't used the performance metrics a ton beyond what I've absolutely had to. \n\nThe only thing that I can think of that would use getRandomValue is cards being assigned IDs when they first hit the client. This ID is then used to reference the card all throughout the deckbuilder, so it's kinda a neccesary. If you're seeing it in the range of 40-50 times (around how many cards are returned per page of a random search), that's probably what that is.\n\nAs for the handlers per cards, every card has 9 handers for onClick, onContextMenu, onMouseIn/Out, onDrag, etc. Which is I assume what the majority of the functions you're seeing are doing. They're likely just sitting around waiting to be fired. Testing this locally by disabling every one of the even handlers for cards results in the page running much more smoothly (albeit still more chunky than I'd like). Obviously disabling all the event handlers isn't really an option though, even if it did fix everything.\n\nI'm more than happy to dig into this more if you think there's a smoking gun here and we could eak out extra performance. As it stands, I'm not sure one exists though. If you really wanna dig into this, I'm happy to have a more in depth conversation! My suggestion would be to hop into our discord though, as having a conversation there would be much more of a dialog than on our forums.\n"}]}
0
Support us on Patreon to remove ads