discourse/app/models
Guo Xiang Tan 5d4221fbe1 PERF: Avoid calling expensive `PostGuardian#can_see_post?` multiple times.
Before

```
Your Results: (note for timings- percentile is first, duration is second
in millisecs)
---
topic_admin:
  50: 19
  75: 19
  90: 21
  99: 27
topic:
  50: 56
  75: 62
  90: 64
  99: 99
timings:
  load_rails: 1262
ruby-version: 2.4.1-p111
rss_kb: 198432
pss_kb: 136612
virtual: physical
architecture: amd64
operatingsystem: Ubuntu
memorysize: 15.59 GB
kernelversion: 4.10.0
physicalprocessorcount: 1
processor0: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
rss_kb_9877: 327892
pss_kb_9877: 263671
rss_kb_9946: 325468
pss_kb_9946: 261671
rss_kb_10153: 326456
pss_kb_10153: 262657
```

After

```
Your Results: (note for timings- percentile is first, duration is second
in millisecs)
---
topic_admin:
  50: 18
  75: 18
  90: 20
  99: 28
topic:
  50: 41
  75: 42
  90: 46
  99: 49
timings:
  load_rails: 1201
ruby-version: 2.4.1-p111
rss_kb: 187936
pss_kb: 123596
virtual: physical
architecture: amd64
operatingsystem: Ubuntu
memorysize: 15.59 GB
kernelversion: 4.10.0
physicalprocessorcount: 1
processor0: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
rss_kb_26478: 342360
pss_kb_26478: 276696
rss_kb_26547: 340368
pss_kb_26547: 275930
rss_kb_26747: 338964
pss_kb_26747: 274466
```
2017-09-08 14:07:24 +08:00
..
concerns FIX: when registering custom_field types, ensure we're casting them before checking for equality 2017-08-16 23:04:40 +02:00
about.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
admin_dashboard_data.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
api_key.rb Validate uniquness of `api_key`. 2017-07-24 21:46:08 +09:00
application_request.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
auto_track_duration_site_setting.rb fix the build 2015-09-14 10:48:24 +02:00
backup.rb trigger for other backup choices 2017-08-17 10:34:24 -04:00
badge.rb FEATURE: new badges when visiting the forum for 10, 100 and 365 consecutive days 2017-09-06 22:35:08 +02:00
badge_grouping.rb annotate models 2016-02-23 10:33:53 +11:00
badge_type.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
category.rb FIX: Topic timers being incorrectly `trashed!`. 2017-08-22 15:23:09 +09:00
category_and_topic_lists.rb FEATURE: new 'categories_and_latest' endpoint 2016-08-29 22:47:44 +02:00
category_custom_field.rb
category_featured_topic.rb Correct erratic spec failure 2017-08-17 15:26:31 -04:00
category_featured_user.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
category_group.rb FEATURE: Log staff actions for Category changes. 2015-09-18 10:53:08 +08:00
category_list.rb Fix the build. 2017-08-01 17:57:26 +09:00
category_page_style.rb UX: new 'category_page_style' site setting 2016-08-22 23:01:43 +02:00
category_search_data.rb annotate models 2017-08-16 10:38:11 -04:00
category_tag.rb annotate models 2017-08-16 10:38:11 -04:00
category_tag_group.rb annotate models 2017-08-16 10:38:11 -04:00
category_user.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
child_theme.rb annotate models 2017-08-16 10:38:11 -04:00
color_scheme.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
color_scheme_color.rb annotate models 2016-02-23 10:33:53 +11:00
custom_emoji.rb Update annotations. 2017-03-22 14:26:53 +08:00
developer.rb missing annotation 2016-08-15 17:59:36 +10:00
digest_email_site_setting.rb FEATURE: More digest email frequency options. Digests can be sent as often as every 30 minutes. 2016-03-02 15:43:47 -05:00
directory_item.rb FIX: user directory didn't update stats of users with no recent activity 2017-08-09 15:57:42 -04:00
discourse_single_sign_on.rb FIX: more cases of case sensitive group membership in sso 2017-08-11 18:09:29 -04:00
discourse_version_check.rb FEATURE: Installed Version link shows GitHub Compare to branch being followed 2016-08-02 06:18:44 -04:00
draft.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
draft_sequence.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
email_change_request.rb FIX: Don't allow invalid email to be saved. 2016-12-21 17:47:11 +08:00
email_log.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
email_token.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
embeddable_host.rb annotate models 2017-08-16 10:38:11 -04:00
embedding.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
emoji.rb `order` scope is ignored when using `find_each`. 2017-08-07 11:46:18 +09:00
emoji_set_site_setting.rb FIX: s/google_blob/google_classic 2017-07-06 09:05:15 +02:00
facebook_user_info.rb annotate models 2016-10-31 15:02:11 +05:30
github_user_info.rb annotate models 2016-02-23 10:33:53 +11:00
given_daily_like.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
global_setting.rb Fix Redis command errors when trying to start app with a readonly Redis. 2017-08-02 21:33:56 +09:00
google_user_info.rb annotate models 2016-02-23 10:33:53 +11:00
group.rb Split alias levels in mentionable and messageable levels. (#5065) 2017-08-28 12:32:08 -04:00
group_archived_message.rb annotate models 2017-08-16 10:38:11 -04:00
group_custom_field.rb
group_history.rb FEATURE: Group logs. 2016-12-12 17:29:54 +08:00
group_manager.rb update annotations 2015-09-18 10:41:10 +10:00
group_mention.rb annotate models 2017-08-16 10:38:11 -04:00
group_user.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
incoming_domain.rb FIX: If the host can't be extracted don't raise an error 2017-05-04 13:26:37 -04:00
incoming_email.rb FIX: show rejected emails with unrecognized errors (#5026) 2017-08-04 16:20:44 +02:00
incoming_link.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
incoming_links_report.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
incoming_referer.rb
instagram_user_info.rb annotate models 2016-03-28 15:21:45 +11:00
invite.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
invite_redeemer.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
invited_group.rb
like_notification_frequency_site_setting.rb FEATURE: like notification frequency of never 2016-03-06 09:12:59 +11:00
locale_site_setting.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
mailing_list_mode_site_setting.rb Remove daily mailing mode option as it doesn't scale. 2017-05-05 12:21:50 +08:00
muted_user.rb annotate models 2017-08-16 10:38:11 -04:00
new_topic_duration_site_setting.rb fix the build 2015-09-14 10:48:24 +02:00
notification.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
notification_level_when_replying_site_setting.rb FEATURE: Add normal as a preference for topic subscription state when replying to a topic 2017-04-20 22:33:10 -04:00
oauth2_user_info.rb annotate models 2016-02-23 10:33:53 +11:00
onceoff_log.rb annotate models 2016-05-30 10:45:32 +10:00
optimized_image.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
permalink.rb annotate models 2017-08-16 10:38:11 -04:00
plugin_store.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
plugin_store_row.rb annotate models 2016-02-23 10:33:53 +11:00
post.rb Fix: unlinked topic search model (#5044) 2017-08-15 11:46:57 -04:00
post_action.rb FIX: Ensure that post action moderation post uses the site's default locale. 2017-08-09 18:20:20 +09:00
post_action_type.rb remove rails-observers 2016-12-22 16:46:53 +11:00
post_analyzer.rb Fix calling `exists?` on Arrays. 2017-08-24 09:56:07 +09:00
post_custom_field.rb update annotations 2015-09-18 10:41:10 +10:00
post_detail.rb annotate models 2016-02-23 10:33:53 +11:00
post_mover.rb Add new 'post_moved' event 2017-08-12 04:12:09 +02:00
post_reply.rb FIX: Update post replies when we move posts. (#4324) 2016-07-13 17:34:21 +02:00
post_revision.rb remove rails-observers 2016-12-22 16:46:53 +11:00
post_search_data.rb annotate models 2017-08-16 10:38:11 -04:00
post_stat.rb annotate models 2017-08-16 10:38:11 -04:00
post_timing.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
post_upload.rb Update annotations. 2016-11-24 10:13:03 +08:00
previous_replies_site_setting.rb FEATURE: allow users to control how many previous replies they get 2016-02-19 13:57:07 +11:00
queued_post.rb annotate models 2017-08-16 10:38:11 -04:00
quoted_post.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
remote_theme.rb annotate models 2017-08-16 10:38:11 -04:00
report.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
s3_region_site_setting.rb add 'us-east-2' S3 region 2017-07-10 15:36:38 +02:00
scheduler_stat.rb purge `scheduler_stats` every 1 month instead of 3 2017-04-28 15:05:15 -07:00
screened_email.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
screened_ip_address.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
screened_url.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
search_log.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
single_sign_on_record.rb annotate models 2016-10-31 15:02:11 +05:30
site.rb Revert plugin js changes (#5139) 2017-09-07 15:15:29 +02:00
site_setting.rb Can't revert due to incompatibility of new site setting types. 2017-08-07 10:43:09 +09:00
slug_setting.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
stylesheet_cache.rb Silence CSS logging in development - it's way too noisy 2017-08-16 10:59:56 -04:00
tag.rb FEATURE: show tags in search results 2017-08-25 11:52:59 -04:00
tag_group.rb annotate models 2017-08-16 10:38:11 -04:00
tag_group_membership.rb annotate models 2017-08-16 10:38:11 -04:00
tag_search_data.rb annotate stuff 2017-08-29 10:48:22 -04:00
tag_user.rb annotate models 2017-08-16 10:38:11 -04:00
theme.rb merges after_save 2017-09-04 13:40:11 +02:00
theme_field.rb annotate models 2017-08-16 10:38:11 -04:00
top_lists.rb
top_menu_item.rb
top_topic.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic.rb PERF: Avoid calling expensive `PostGuardian#can_see_post?` multiple times. 2017-09-08 14:07:24 +08:00
topic_allowed_group.rb
topic_allowed_user.rb
topic_converter.rb FEATURE: remove the timecop gem 2017-07-24 12:11:10 -04:00
topic_custom_field.rb annotate models 2016-05-30 10:45:32 +10:00
topic_embed.rb FIX: Don't raise an error if URL timesout. 2017-08-10 12:58:56 +09:00
topic_featured_users.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_invite.rb
topic_link.rb SECURITY: do not include links from whispers in topic summary map 2017-08-31 23:44:54 +05:30
topic_link_click.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_list.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_notifier.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_participants_summary.rb FEATURE: primary group class on avatars in topic list 2017-02-20 15:55:10 -05:00
topic_poster.rb FEATURE: primary group class on avatars in topic list 2017-02-20 15:55:10 -05:00
topic_posters_summary.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_search_data.rb annotate models 2017-08-16 10:38:11 -04:00
topic_tag.rb annotate models 2017-08-16 10:38:11 -04:00
topic_timer.rb annotate models 2017-08-16 10:38:11 -04:00
topic_tracking_state.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_user.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
topic_view_item.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
translation_override.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
trust_level3_requirements.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
trust_level_setting.rb fix the build 2015-09-14 10:48:24 +02:00
twitter_user_info.rb annotate models 2016-02-23 10:33:53 +11:00
unsubscribe_key.rb annotate models 2017-08-16 10:38:11 -04:00
upload.rb Correct short url decoding for sha1s leading with zero 2017-08-23 11:08:18 -04:00
user.rb Require missing dependency. 2017-09-05 09:39:56 +08:00
user_action.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_api_key.rb annotate models 2017-08-16 10:38:11 -04:00
user_archived_message.rb annotate models 2017-08-16 10:38:11 -04:00
user_auth_token.rb annotate models 2017-08-16 10:38:11 -04:00
user_auth_token_log.rb Update annotations. 2017-03-22 14:26:53 +08:00
user_avatar.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_badge.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_badges.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_custom_field.rb
user_email.rb annotate models 2017-08-16 10:38:11 -04:00
user_export.rb annotate models 2017-08-16 10:38:11 -04:00
user_field.rb annotate models 2017-08-16 10:38:11 -04:00
user_field_option.rb annotate models 2017-08-16 10:38:11 -04:00
user_history.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_open_id.rb annotate models 2016-02-23 10:33:53 +11:00
user_option.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_profile.rb fix the regexp used to valide user's website 2017-08-02 10:19:24 +02:00
user_profile_view.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_search.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_search_data.rb annotate models 2017-08-16 10:38:11 -04:00
user_stat.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_summary.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_visit.rb Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
user_warning.rb annotate models 2017-08-16 10:38:11 -04:00
username_validator.rb FIX: Don't allow invalid email to be saved. 2016-12-21 17:47:11 +08:00
watched_word.rb annotate models 2017-08-16 10:38:11 -04:00
web_hook.rb annotate models 2017-08-16 10:38:11 -04:00
web_hook_event.rb annotate models 2017-08-16 10:38:11 -04:00
web_hook_event_type.rb FEATURE: Webhook for user creation and approval 2016-09-19 10:12:55 +08:00