Page MenuHomePhabricator

Separate interfaces in library maps
AbandonedPublic

Authored by joshuaspence on Jun 21 2015, 3:10 AM.

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

Currently, interfaces as stored in the library maps as a "class". Instead, store them as an "interface". In most cases, we don't care whether a symbol is a class or an interface, but there is basically no extra complexity in doing so.

Test Plan

Ran arc liberate src in rPHU and inspected the resulting changes.

Diff Detail

Repository
rPHU libphutil
Branch
master
Lint
Lint Passed
SeverityLocationCodeMessage
Advicesrc/symbols/PhutilSymbolLoader.php:42PHLXHP6Class Not Extending Phobject
Unit
Tests Passed
Build Status
Buildable 6929
Build 6951: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

joshuaspence retitled this revision from to Separate interfaces in library maps.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

Is there any larger goal in doing this? Particularly, I'd anticipate this might impose a small performance cost on loading objects, which we do super frequently.

I started writing a unit test whi h involved loading all classes, excluding interfaces. I ended up abandoning it.

Let me clarify whether or not this suffers from a performance penalty.

joshuaspence edited edge metadata.

Minor improvement

Running the following code in rP:

<?php

require_once __DIR__.'/scripts/__init_script__.php';

$start_time = microtime(true);

for ($i = 0; $i < 10000; $i++) {
  id(new PhutilSymbolLoader())
    ->setAncestorClass('LiskDAO')
    ->loadObjects();
}

$end_time = microtime(true);

echo pht('Completed in %f seconds.', $end_time - $start_time)."\n";

The results are as follows:

Time #1Time #2Time #3Time #4Time #5Time #6Time #7Time #8Time #9Time #10Time (average)
Before38.54630232.09991843.85413435.68702535.21300841.33684137.99804837.70007827.13909933.30387536.2878328
After24.66951340.79453927.92036123.17744143.99909440.49961445.38157335.18199741.85114444.09451336.7569789

So, on average, this method is 1.2% slower.

Move interfaces from xmap to imap

Not actively working on this.