Page MenuHomePhabricator

Use setters instead of public properties
ClosedPublic

Authored by joshuaspence on Nov 17 2015, 9:04 PM.
Tags
None
Referenced Files
F14039736: D14504.id35089.diff
Mon, Nov 11, 6:14 AM
F14029150: D14504.id.diff
Fri, Nov 8, 7:55 PM
F14026592: D14504.diff
Fri, Nov 8, 1:43 AM
F14009016: D14504.diff
Wed, Oct 30, 8:36 AM
F13978429: D14504.diff
Fri, Oct 18, 11:08 PM
F13978421: D14504.id.diff
Fri, Oct 18, 11:05 PM
F13978415: D14504.id35089.diff
Fri, Oct 18, 11:04 PM
F13978407: D14504.id35094.diff
Fri, Oct 18, 11:02 PM
Subscribers

Details

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

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Use setters instead of public properties.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

Maybe double check with PhabricatorApplicationTransactionEditor.php? __phutil_library_map__.php has a lot of lines, but the tree isn't actaully that complex.

This revision is now accepted and ready to land.Nov 17 2015, 9:06 PM
src/parser/aast/api/AASTNode.php
92

Hmm, this seems wrong/odd... adding an assert_instances_of call here doesn't seem to impact the execution time;

Average: 2.559327s
Total:   255.932677

With PhabricatorApplicationTransactionEditor:

Before
Average: 0.545871s
Total:   54.587076s
After
Average: 0.542363s
Total:   54.236334s
This revision was automatically updated to reflect the committed changes.