From e03243b148cdea5cc09aeebc1fae407d838ef9a1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 28 Aug 2020 23:36:08 +0100 Subject: [PATCH] More benchmarks --- webinterface.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/webinterface.py b/webinterface.py index e6ca5eb6c..da2d35981 100644 --- a/webinterface.py +++ b/webinterface.py @@ -3849,9 +3849,21 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int, if not avatarUrl: avatarUrl = \ getPersonAvatarUrl(baseDir, postActor, personCache) + + # benchmark 2.1 + timeDiff = int((time.time() - postStartTime) * 1000) + if timeDiff > 100: + print('TIMING INDIV ' + boxName + ' 2.1 = ' + str(timeDiff)) + + return postHtml updateAvatarImageCache(session, baseDir, httpPrefix, postActor, avatarUrl, personCache) + # benchmark 2.2 + timeDiff = int((time.time() - postStartTime) * 1000) + if timeDiff > 100: + print('TIMING INDIV ' + boxName + ' 2.2 = ' + str(timeDiff)) + postHtml = \ loadIndividualPostAsHtmlFromCache(baseDir, nickname, domain, postJsonObject) @@ -4166,6 +4178,12 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int, likeLink = 'like' likeTitle = translate['Like this post'] likeCount = noOfLikes(postJsonObject) + + # benchmark 12.1 + timeDiff = int((time.time() - postStartTime) * 1000) + if timeDiff > 100: + print('TIMING INDIV ' + boxName + ' 12.1 = ' + str(timeDiff)) + likeCountStr = '' if likeCount > 0: if likeCount > 1: @@ -4177,6 +4195,12 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int, if likedByPerson(postJsonObject, nickname, fullDomain): likeLink = 'unlike' likeTitle = translate['Undo the like'] + + # benchmark 12.2 + timeDiff = int((time.time() - postStartTime) * 1000) + if timeDiff > 100: + print('TIMING INDIV ' + boxName + ' 12.2 = ' + str(timeDiff)) + likeStr = \ '\n' + # benchmark 12.5 + timeDiff = int((time.time() - postStartTime) * 1000) + if timeDiff > 100: + print('TIMING INDIV ' + boxName + ' 12.5 = ' + str(timeDiff)) + bookmarkStr = '' if not isModerationPost: bookmarkIcon = 'bookmark_inactive.png' @@ -4199,6 +4228,10 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int, bookmarkIcon = 'bookmark.png' bookmarkLink = 'unbookmark' bookmarkTitle = translate['Undo the bookmark'] + # benchmark 12.6 + timeDiff = int((time.time() - postStartTime) * 1000) + if timeDiff > 100: + print('TIMING INDIV ' + boxName + ' 12.6 = ' + str(timeDiff)) bookmarkStr = \ '