Page MenuHomePhabricator

Minify XHPAST output
AbandonedPublic

Authored by joshuaspence on Aug 23 2015, 9:40 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Feb 3, 6:23 PM
Unknown Object (File)
Tue, Jan 28, 11:39 PM
Unknown Object (File)
Mon, Jan 27, 2:47 PM
Unknown Object (File)
Mon, Jan 27, 5:25 AM
Unknown Object (File)
Sun, Jan 26, 2:43 PM
Unknown Object (File)
Sun, Jan 26, 2:43 PM
Unknown Object (File)
Sun, Jan 26, 2:43 PM
Unknown Object (File)
Wed, Jan 22, 4:11 AM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

Minify the JSON output from XHPAST by removing whitespace. This is a micro-optimization which sacrifices readability for performance.

Test Plan

Ran arc lint --everything --never-apply-patches --xprofile=profile.json in rP. Compared before and after.

Diff Detail

Repository
rPHU libphutil
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 7739
Build 8511: [Placeholder Plan] Wait for 30 Seconds
Build 8510: arc lint + arc unit

Event Timeline

joshuaspence retitled this revision from to Minify XHPAST output.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

It's implausible to me that this really improves performance by 50%!!!!! unless we have another issue somewhere else. Let me poke at this...

I can't reproduce this effect locally in isolation. Here's an unmodified binary:

epriestley@orbital ~/dev/libphutil $ time ./xhpast.with-whitespace < ../phabricator/src/__phutil_library_map__.php | wc -c
  965744

real	0m0.142s
user	0m0.139s
sys	0m0.006s

Here's a modified binary:

epriestley@orbital ~/dev/libphutil $ time ./xhpast.no-whitespace < ../phabricator/src/__phutil_library_map__.php | wc -c
  912648

real	0m0.143s
user	0m0.140s
sys	0m0.007s

The runtime is identical and the output size differs by only 5%.

Can you reproduce the effect by running the binary directly?

It's quite possible that my thinking is wrong, but I figured that this might be faster because there is less data being passed through ExecFuture rather than directly improving XHPAST. I agree that the observed speed up seems unwarranted though.