Page MenuHomePhabricator

Minify XHPAST output
AbandonedPublic

Authored by joshuaspence on Aug 23 2015, 9:40 AM.
Tags
None
Referenced Files
F13086509: D13977.diff
Thu, Apr 25, 12:33 AM
Unknown Object (File)
Wed, Apr 3, 12:39 PM
Unknown Object (File)
Thu, Mar 28, 4:55 AM
Unknown Object (File)
Tue, Mar 26, 3:48 AM
Unknown Object (File)
Feb 5 2024, 1:15 PM
Unknown Object (File)
Jan 28 2024, 5:29 PM
Unknown Object (File)
Jan 28 2024, 5:29 PM
Unknown Object (File)
Jan 28 2024, 5:29 PM
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.