HomePhabricator

Use setters instead of public properties

Description

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
3require_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
10for ($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

Details

Provenance
joshuaspenceAuthored on
joshuaspencePushed on Nov 18 2015, 12:30 PM
Reviewer
Blessed Reviewers
Differential Revision
D14504: Use setters instead of public properties
Parents
rPHU23edd1b1f443: Add previous and next sibling pointers to `AASTNode`
Branches
Unknown
Tags
Unknown
Build Status
Buildable 8904
Build 10428: Run Core Tests