HomePhorge

Provide a highlighter cache for Paste

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

Provenance
epriestleyAuthored on Dec 16 2012, 4:33 PM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rPc65468371ffb: Modernize file detail view
Branches
Loading...
Tags
Loading...

Event Timeline