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