Use setters instead of public properties
Summary: Currently a bunch of properties in the AASTNode class are public instead of using explicit setter methods. This doesn't seem to have any effect on performance as far as I can tell
Test Plan:
Ran the following script with 100 iterators:
1 | <?php |
---|---|
2 | |
3 | require_once __DIR__.'/scripts/__init_script__.php'; |
4 | |
5 | $console = PhutilConsole::getConsole(); |
6 | $iterations = 10; |
7 | $source = Filesystem::readFile(__DIR__.'/../phabricator/src/__phutil_library_map__.php'); |
8 | $start = microtime(true); |
9 | |
10 | for ($ii = 0; $ii < $iterations; $ii++) { |
11 | XHPASTTree::newFromData($source); |
12 | } |
13 | |
14 | $end = microtime(true); |
15 | $duration = $end - $start; |
16 | |
17 | $console->writeOut("Average: %fs\n", $duration / $iterations); |
18 | $console->writeOut("Total: %fs\n", $duration); |
Before
Average: 2.679129s Total: 267.912916s
After
Average: 2.648229s Total: 264.822857s
Reviewers: epriestley, Blessed Reviewers
Reviewed By: epriestley, Blessed Reviewers
Subscribers: Korvin
Differential Revision: https://secure.phabricator.com/D14504