Een bericht markeren in een groot onderwerp zorgt voor absurde laadtijden

I created an account on the Roblox forum to look at What are you working on currently? (2020) - #5043 by FLYSLENDY04 - Creations Feedback - Developer Forum | Roblox, and I can reproduce the issue there. Without a bookmark the topic loads in ~1.3s, with a bookmark it takes ~8s. I even encountered the 502 bad gateway:

However, I made a topic with 5000 posts locally and made a bookmark, and it loads in the same time whether I have a bookmark in the topic or not :man_shrugging:. I will have to keep looking…the code that loads the bookmarks for a user in a topic is here:

And the code that finds a bookmark for each post is here:

To me this does not look crazy and performance intensive. user_post_bookmarks will only query the database once because it is memoized, so no N1 issue here. Also here is the topic view code to see if there is a bookmark at the topic level:

Nothing suspicious there either…

2 likes