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.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers
Ran arc liberate src in rPHU and inspected the resulting changes.
Diff Detail
Diff Detail
- Repository
- rPHU libphutil
- Branch
- master
- Lint
Lint Passed Severity Location Code Message Advice src/symbols/PhutilSymbolLoader.php:42 PHLXHP6 Class Not Extending Phobject - Unit
Tests Passed - Build Status
Buildable 6928 Build 6950: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
Comment Actions
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.
Comment Actions
I started writing a unit test whi h involved loading all classes, excluding interfaces. I ended up abandoning it.
Comment Actions
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 #1 | Time #2 | Time #3 | Time #4 | Time #5 | Time #6 | Time #7 | Time #8 | Time #9 | Time #10 | Time (average) | |
---|---|---|---|---|---|---|---|---|---|---|---|
Before | 38.546302 | 32.099918 | 43.854134 | 35.687025 | 35.213008 | 41.336841 | 37.998048 | 37.700078 | 27.139099 | 33.303875 | 36.2878328 |
After | 24.669513 | 40.794539 | 27.920361 | 23.177441 | 43.999094 | 40.499614 | 45.381573 | 35.181997 | 41.851144 | 44.094513 | 36.7569789 |
So, on average, this method is 1.2% slower.