DMOJ/online-judge

The existence of comments increases page load time by ~200ms

Xyene opened this issue · 1 comments

Xyene commented
Executed SQL
    SELECT `judge_comment`.`id`,
           `judge_comment`.`author_id`,
           `judge_comment`.`time`,
           `judge_comment`.`page`,
           `judge_comment`.`score`,
           `judge_comment`.`body`,
           `judge_comment`.`hidden`,
           `judge_comment`.`parent_id`,
           `judge_comment`.`lft`,
           `judge_comment`.`rght`,
           `judge_comment`.`tree_id`,
           `judge_comment`.`level`,
           COUNT(`reversion_version`.`id`) AS `revisions`,
           COALESCE(my_vote.`score`, 0) AS `vote_score`,
           `judge_profile`.`id`,
           `judge_profile`.`user_id`,
           `judge_profile`.`timezone`,
           `judge_profile`.`language_id`,
           `judge_profile`.`points`,
           `judge_profile`.`performance_points`,
           `judge_profile`.`problem_count`,
           `judge_profile`.`ace_theme`,
           `judge_profile`.`site_theme`,
           `judge_profile`.`last_access`,
           `judge_profile`.`ip`,
           `judge_profile`.`display_rank`,
           `judge_profile`.`mute`,
           `judge_profile`.`is_unlisted`,
           `judge_profile`.`is_banned_from_problem_voting`,
           `judge_profile`.`rating`,
           `judge_profile`.`user_script`,
           `judge_profile`.`current_contest_id`,
           `judge_profile`.`math_engine`,
           `judge_profile`.`is_totp_enabled`,
           `judge_profile`.`is_webauthn_enabled`,
           `judge_profile`.`totp_key`,
           `judge_profile`.`scratch_codes`,
           `judge_profile`.`last_totp_timecode`,
           `judge_profile`.`api_token`,
           `judge_profile`.`notes`,
           `judge_profile`.`data_last_downloaded`,
           `judge_profile`.`username_display_override`,
           `auth_user`.`id`,
           `auth_user`.`password`,
           `auth_user`.`last_login`,
           `auth_user`.`is_superuser`,
           `auth_user`.`username`,
           `auth_user`.`first_name`,
           `auth_user`.`last_name`,
           `auth_user`.`email`,
           `auth_user`.`is_staff`,
           `auth_user`.`is_active`,
           `auth_user`.`date_joined`
      FROM `judge_comment`
      LEFT OUTER JOIN `reversion_version`
        ON (`judge_comment`.`id` = `reversion_version`.`object_id` AND ((`reversion_version`.`content_type_id` = 10 AND `reversion_version`.`db` = 'default')))
      LEFT OUTER JOIN `judge_commentvote` my_vote
        ON (`judge_comment`.`id` = my_vote.`comment_id` AND (my_vote.`voter_id` = 2))
     INNER JOIN `judge_profile`
        ON (`judge_comment`.`author_id` = `judge_profile`.`id`)
     INNER JOIN `auth_user`
        ON (`judge_profile`.`user_id` = `auth_user`.`id`)
     WHERE (NOT `judge_comment`.`hidden` AND `judge_comment`.`page` = 'p:16bitswonly')
     GROUP BY `judge_comment`.`id`
     ORDER BY `judge_comment`.`tree_id` ASC, `judge_comment`.`lft` ASC

Time
    191.47896766662598 ms
Xyene commented

This has been fixed by @quantum5.