Homec4science

Highlight using XHPAST in parallel

Authored by vrana <jakubv@fb.com> on Feb 9 2013, 02:40.

Description

Highlight using XHPAST in parallel

Summary:
We usually try to highlight two files at once in Differential:
https://secure.phabricator.com/diffusion/P/browse/master/src/applications/differential/parser/DifferentialChangesetParser.php;3706ec4879a1250c$602-603

Test Plan:

$highlighter = new PhutilXHPASTSyntaxHighlighter();
$futures = array(
  $highlighter->getHighlightFuture(file_get_contents('../src/__phutil_library_map__.php')),
  $highlighter->getHighlightFuture(file_get_contents('../src/__phutil_library_map__.php')),
);

Futures($futures)->resolveAll();

Saw drop from 0.424 s to 0.380 s.

Also:

<?php
$highlighter = new PhutilXHPASTSyntaxHighlighter();
$futures = array(
  $highlighter->getHighlightFuture('echo "a";'),
  $highlighter->getHighlightFuture('echo "b";'),
  $highlighter->getHighlightFuture('syntax error'),
  $highlighter->getHighlightFuture('<?php'),
  $highlighter->getHighlightFuture('<?php syntax error'),
);

foreach (Futures($futures) as $future) {
  echo $future->resolve()."\n\n\n";
}

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

Details

Committed
vrana <jakubv@fb.com>Feb 10 2013, 00:18
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU88a5c627a2f8: Disable cURL protocols other than HTTP and HTTPS
Branches
Unknown
Tags
Unknown

Event Timeline

vrana <jakubv@fb.com> committed rPHUe2a0ca1fd661: Highlight using XHPAST in parallel (authored by vrana <jakubv@fb.com>).Feb 10 2013, 00:18