codewars / codewars.com

Issue tracker for Codewars
https://www.codewars.com
BSD 2-Clause "Simplified" License
2.09k stars 219 forks source link

CW-375: Excessively long solutions cause performance problems in browsers #3140

Open hobovsky opened 8 months ago

hobovsky commented 8 months ago

Discussed in https://github.com/codewars/codewars.com/discussions/3108

Originally posted by **kirillFedorov1** November 28, 2023 Consider concealing solutions that are excessively long, such as those that span thousands of lines and are often submitted as "funny" solutions. These submissions can cause significant performance issues, freezing web browsers and creating a frustrating environment when attempting to view other, more serious solutions. For instance, after completing the kata [You can't code under pressure #1](https://www.codewars.com/kata/53ee5429ba190077850011d4), I encountered an issue where my laptop was unable to load the solutions page at all.
hobovsky commented 8 months ago

Similar problem was reported on Discord. The root of the issue is most probably very CPU-intensive syntax highlighting which attempts to color tens of thousands of lines with a comment in a browser, freezing it. The user got locked out of the "Solutions" tab on their profile page because their browser froze every time they attempted to see their recent solutions.

Voileexperiments commented 1 month ago

I disagree with the connotations from your wordings that "shorter = more serious". You seem to imply that excessively long solutions are always posted out of comedic/trollish intent; but typical solutions are not long enough to cause browser hiccups, and solutions long enough to cause hiccups are almost always by putting data as code, which says more about the kata's inadequacies. If someone doesn't like solutions are hardcoding data, enforce a code size limit. Trying to discourage this by bullying/harassing solutions doing this by saying bad words about it (yes, this happens a lot) is unacceptable.

Anyways, concealing solutions entirely is just ridiculous, it categorically discriminates long solutions for being long by putting a bad light onto them ("look how long solutions is concealed by default, they're clearly Bad:tm:!"). "Clever" button is already used by lots of users to discriminate solutions they don't like, so please don't add more such inconsiderate features. Please make sure any solutions of this is universal across all solutions and doesn't cause potential discrimination, such as

error256 commented 1 month ago

It looks like there's something about highlighting that Chromium doesn't like. Firefox loads huge solutions in under a minute on an old PC where a minute seems a more or less acceptable time for that (comparable to discourse pages with a lot of comments), while Brave hangs forever.