Homec4science

Provide a highlighter cache for Paste

Authored by epriestley <git@epriestley.com> on Dec 17 2012, 01:33.

Description

Provide a highlighter cache for Paste

Summary:
D4188 adds a preview of Paste contents to the list, but gets slow for large lists if you have Pygments installed since it has to spend ~200ms/item highlighting them. Instead, cache the highlighted output.

  • Adds a Paste highlighting cache. This uses RemarkupCache because it has automatic GC and we don't have a more generalized cache for the moment.
  • Uses the Paste cache on paste list and paste detail.
  • Adds a little padding to the summary.
  • Adds "..." if there's more content.
  • Adds line count and language, if available. These are hidden on Mobile.
  • Nothing actually uses needRawContent() but I left it there since it doesn't hurt anything and is used internally (I thought the detail view did, but it uses the file content directly, and must for security reasons).

Test Plan:
{F27710}

  • Profiled paste list, saw good performance and few service calls.
  • Viewed paste.
  • Viewed raw paste content.

Reviewers: codeblock, btrahan, chad

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D4204

Details

Committed
epriestley <git@epriestley.com>Dec 17 2012, 01:33
Pushed
aubortJan 31 2017, 17:16
Parents
rPHc65468371ffb: Modernize file detail view
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH7e37eb48273e: Provide a highlighter cache for Paste (authored by epriestley <git@epriestley.com>).Dec 17 2012, 01:33