Go back to the update browser

Website: Optimization marathon (in 5 easy steps)

24-08-2025

At last, this update is actually out! Man, this has been a nightmare. Five times in a row.

We have been hard at work preventing the "fatal error" messages appearing in the middle of pages. To do this, we rewrote the formatting, translation, and error handling systems to make them work better and faster than before! Also, your browser will now cache more of the website, which will result in less downloading and faster browsing.

Learn more about the specifics of this update in the changelog! And if you care about what made this update take so long and make us suffer so much, unfold the section below.

What happened during development
So... this has been a wild ride. It all began when we rewrote the translation system. The way we did it was supposed to be faster, more reliable, and also easier for us to handle. In the middle of it, I said... why don't we also rewrite the formatting system the same way? It sounded like a good idea, so we did that too. Then Kean the creature also decided to rewrite the error handler (it was named kean_error_handler after all), and it came out looking pretty heckin' good compared to what it was before. It felt like such a massive upgrade in so many places at once, so we were really proud of it.

... But then the release day arrived. We upload the code, stop the maintenance, and immediately... 100% CPU usage, nonstop. This was so weird, we assumed we were getting DDOS'd. But no, to our horror, it was not DDOS. It was the new code. What seemed totally harmless during testing was a nuclear bomb in production.

So we took it down and went back to the drawing board. We tried to analyze the new code and find what could be the cause of this. For the three rewrites, we switched from functional programming to object-oriented programming. In short, we grouped their functions into classes for better organization and, in the case of the translator, to store data in them too. It turns out objects take a bit more memory than non-objects, so we changed everything again to functional while keeping the improvements we had made.

And the result was... the exact same. CPU in flames from second 1. So we looked into the database queries, just in case something we did was using too many resources. One of the improvements we did to the translation system is that, instead of loading translation groups one by one (each page has its own set of translations), we now loaded them in batches to do less queries in total. We found out that this can make the server struggle more even if it went a lot faster than before, so we turned that off.

Now we just had to test it, and we weren't looking forward to it looking at how the previous tests went. So we just did it silently. We uploaded the new code and only applied it to the part that builds the website layout and the menu, but nowhere else. CPU usage went up by a little bit, but nothing alarming. It looked like we did it, at last! But I kept testing, just in case. And then, thanks to the Undertale text box generator API being an absolute monster (something that we will change soon, by the way), I was able to find one last flaw that was catastrophic. Long story short, one bit of the formatting functions were checking for every single emoji every time we formatted a bit of text due to a tiny oversight. This alone was most likely the cause 90% of the CPU issues. So we fixed it, and the CPU usage actually went DOWN.

So... the moral of the story? I would say it's to not update too many critical systems at once. Don't get greedy and do it one by one, so if something goes wrong you will know it's the last one you changed.



Changelog

Optimization



  • Rewrote the emoji parser.


    • Emojis have descriptions in their hover title again.

    • Badge emoji will also display their names in their titles.

    • Non-existent emoji will no longer show as :undefined_character:, they will stay as text.

    • Emoji will no longer fail to load randomly.

    • Emoji images are cached again (you won't download them every time).

    • Way quicker than it used to be, even more than the cut-down version we had before this update.


  • Rewrote the translation system internally.


    • Quicker, more robust, and makes the website struggle way less.

    • The translation editors have not been affected by these changes.


  • Removed translation data from JavaScript files.


    • This greatly reduces their size.

    • Allows JavaScript files to be stored in cache (you will only download them once).

    • Also greatly reduces the amount of connections to the database (way fewer chances of fatal errors).


  • Optimized database connections and solved some issues.
    Kean the creature

  • Remade the entirety of the error management system.
    Kean the creature


    • All kinds of errors will be properly handled (no more "uncaught exception" walls of text).

    • Error reporting will be more consistent.

    • Added more text for internal errors.



Other changes



  • Issue 229: The alignment of some items in the settings page that don't respect the alignment setting of the current language.

  • Issue 231: Text inputs in the translation editor do not respect the current language alignment.

  • The updates page will no longer display its contents inside a box if you are viewing a single update.

  • Bugfix: uploading an Undertale sprite that is too big with the resize method to "pixelated" and the number of divisions to one that would still exceed the size limits will cause the sprite to be uploaded at that size, ignoring said limits.

  • Bugfix: sometimes, text inside [hide] tags gets line breaks removed.