Page MenuHomePhabricator

Speed up loading of diffs with a lot of unit test failures
ClosedPublic

Authored by beales on Nov 13 2013, 7:54 PM.
Tags
None
Referenced Files
F13297653: D7581.diff
Fri, Jun 7, 5:48 AM
F13264786: D7581.id17172.diff
Mon, May 27, 9:54 PM
F13230610: D7581.diff
Mon, May 20, 11:06 PM
F13192405: D7581.id17165.diff
Sun, May 12, 7:06 AM
F13185389: D7581.diff
Sat, May 11, 2:51 AM
Unknown Object (File)
May 7 2024, 5:11 AM
Unknown Object (File)
May 3 2024, 2:35 AM
Unknown Object (File)
Apr 29 2024, 2:04 PM

Details

Summary

We've been having trouble with viewing diffs timing out when there's a lot of unit test failures. It was caused by formatting userdata for every single failure. The expensive part of this was actually creating the engine for every result, so moved the construction outside of the loop.

Diffs that timed out (2 min) loading before load in around 6 seconds now.

Test Plan

Loaded diffs that used to time out. Verified that details still looked right when Show Full Unit Test Results Is Clicked.

Diff Detail

Branch
a
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/applications/auth/controller/PhabricatorEmailTokenController.php:54PHL1Unknown Symbol
Errorsrc/applications/auth/provider/PhabricatorAuthProviderPersona.php:19PHL1Unknown Symbol
Errorsrc/applications/calendar/view/AphrontCalendarMonthView.php:90PHL1Unknown Symbol
Errorsrc/applications/conpherence/controller/ConpherenceNotificationPanelController.php:75PHL1Unknown Symbol
Errorsrc/applications/differential/render/DifferentialChangesetHTMLRenderer.php:253PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialAddCommentView.php:189PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialInlineCommentView.php:233PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialLocalCommitsView.php:131PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialRevisionCommentView.php:90PHL1Unknown Symbol
Errorsrc/applications/differential/view/DifferentialRevisionUpdateHistoryView.php:205PHL1Unknown Symbol
Errorsrc/applications/diffusion/controller/DiffusionCommitController.php:747PHL1Unknown Symbol
Errorsrc/applications/diffusion/controller/DiffusionCommitController.php:1071PHL1Unknown Symbol
Errorsrc/applications/diffusion/view/DiffusionCommentView.php:142PHL1Unknown Symbol
Errorsrc/applications/feed/builder/PhabricatorFeedBuilder.php:51PHL1Unknown Symbol
Errorsrc/applications/feed/controller/PhabricatorFeedDetailController.php:30PHL1Unknown Symbol
Errorsrc/applications/feed/controller/PhabricatorFeedListController.php:35PHL1Unknown Symbol
Errorsrc/applications/feed/controller/PhabricatorFeedPublicStreamController.php:28PHL1Unknown Symbol
Errorsrc/applications/herald/controller/HeraldTranscriptController.php:371PHL1Unknown Symbol
Errorsrc/applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php:21PHL1Unknown Symbol
Errorsrc/applications/maniphest/controller/ManiphestTaskDetailController.php:351PHL1Unknown Symbol
Errorsrc/applications/notification/controller/PhabricatorNotificationListController.php:48PHL1Unknown Symbol
Errorsrc/applications/notification/controller/PhabricatorNotificationPanelController.php:23PHL1Unknown Symbol
Errorsrc/applications/people/controller/PhabricatorPeopleProfileController.php:130PHL1Unknown Symbol
Errorsrc/applications/phame/controller/post/PhamePostEditController.php:146PHL1Unknown Symbol
Errorsrc/applications/phame/controller/post/PhamePostPreviewController.php:26PHL1Unknown Symbol
Unit
Test Failures

Event Timeline

  • Update libphutil to clear the lint.
  • See comments on the identical change in D7383.

+ @andrewjcg

Particularly, differential.custom-remarkup-rules and differential.custom-remarkup-block-rules are gone in HEAD, so this should move away from newDifferentialMarkupEngine at a bare minimum.

We could also consider cutting this off at, say, 100 results, as the data is already sorted and it seems unlikely that seeing more than 100 failures will ever be useful.

This data is probably all going to move to Harbormaster at some point, but that won't be ready in the upstream for a while and probably won't be practical for Facebook for far longer.

beales updated this revision to Unknown Object (????).Nov 13 2013, 11:51 PM

I'm pretty sure I've done as suggested in the other diff, but in my tests this is just as slow as no fix at all.

Any idea if I'm doing something wrong?

I'm working off of da6cdc6bd0f456d35333e73499301bc5d147aed7 because we aren't up to date on schema changes, just in case that could have something to do with this.

I'm working off of da6cdc6bd0f456d35333e73499301bc5d147aed7 because we aren't up to date on schema changes, just in case that could have something to do with this.

Oh, my suggestion above may not make much sense. I'm surprised this doesn't show a significant improvement against da6cdc6b (I didn't break the thing D7583 fixes until recently). Let me take a look.

oops i diffed the wrong code here,

"differential.diff" is actually "default", but makes no difference either way.

Updated version of D7583 should fix the performance of MarkupOneOff. Rendering a page with 100 synthetic test failures dropped from 3.8s to 450ms for me locally with that plus this.

If the test data contains expensive blocks (like dot {{{ ... }}} or codeblocks) hitting the rendering cache should have a big impact, but it won't impact things as much for mostly-text-with-some-links.

Cool that sped stuff up. Thanks for the quick response. I'll clean this up and resubmit.

Those are both in HEAD now. The rest of this looks good -- give me an updated version when you can and I think we're good to go. Thanks!

Hey, I ran a little problem in testing.

Some of our i18n tests are outputting special characters. Everything works okay on the first try (which populates the cache). However, on the second load, when the cache is hit, $blocks[$key]->getCacheData() is false, instead of a string,

so we get "Argument 1 passed to PhutilRemarkupEngine::postprocessText() must be an instance of array, bool given"

I've traced this down to the database layer (something below LiskDao). We try to insert a the string, but we only get the first part of it back. Then the unserialize call returns false which comes up all the way to where we throw the exception.

Is this something you've seen before? Should I be handling i18n strings differently?

I can fix this pretty easily by just skipping the cache for the entry when the cache brings back false (in PhabricatorMarkupEngine), but it seems like a pretty cheesy fix.

Skipping the cache entry sounds good to me; we could also change cache_markupcache.cacheData to use a binary collation instead of utf8_bin. There's no risk of data in that column being truncated in the middle of a character, which is what we're generally protecting against by using the UTF8 collation.

Yeah, looks exactly like that, except we end up with an exception instead of the truncated comment.

I'll make it skip the entry. Thanks.

beales updated this revision to Unknown Object (????).Nov 19 2013, 8:34 PM

Added the false check. Turned on preserve line breaks. Cleaned up the code. Should be solid now.

Looks good to me, thanks!