From 77cb188be18688c904deeddc7ca7a94ccf7beb72 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 28 Aug 2020 21:59:54 +0100 Subject: [PATCH] Timeline benchmarking --- webinterface.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/webinterface.py b/webinterface.py index 225afa29a..50c0b6372 100644 --- a/webinterface.py +++ b/webinterface.py @@ -4596,6 +4596,8 @@ def htmlTimeline(defaultTimeline: str, YTReplacementDomain: str) -> str: """Show the timeline as html """ + timelineStartTime = time.time() + accountDir = baseDir + '/accounts/' + nickname + '@' + domain # should the calendar icon be highlighted? @@ -4666,6 +4668,11 @@ def htmlTimeline(defaultTimeline: str, if not os.path.isfile(bannerFilename): bannerFile = 'banner.webp' + # benchmark 1 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 1 = ' + str(timeDiff)) + with open(cssFilename, 'r') as cssFile: # load css profileStyle = \ @@ -4680,6 +4687,11 @@ def htmlTimeline(defaultTimeline: str, # is the user a moderator? moderator = isModerator(baseDir, nickname) + # benchmark 2 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 2 = ' + str(timeDiff)) + # the appearance of buttons - highlighted or not inboxButton = 'button' blogsButton = 'button' @@ -4759,6 +4771,11 @@ def htmlTimeline(defaultTimeline: str, '" src="/' + iconsDir + '/person.png"/>\n' break + # benchmark 3 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 3 = ' + str(timeDiff)) + # moderation / reports button moderationButtonStr = '' if moderator and not minimal: @@ -4792,6 +4809,11 @@ def htmlTimeline(defaultTimeline: str, tlStr = htmlHeader(cssFilename, profileStyle) + # benchmark 4 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 4 = ' + str(timeDiff)) + # what screen to go to when a new post is created if boxName == 'dm': newPostButtonStr = \ @@ -4934,6 +4956,11 @@ def htmlTimeline(defaultTimeline: str, translate['Search and follow'] + '" alt="| ' + \ translate['Search and follow'] + '" class="timelineicon"/>\n' + # benchmark 5 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 5 = ' + str(timeDiff)) + # the calendar button calendarAltText = translate['Calendar'] if newCalendarEvent: @@ -4994,6 +5021,11 @@ def htmlTimeline(defaultTimeline: str, '" name="submitInfo" value="' + translate['Info'] + '">\n' tlStr += '\n\n' + # benchmark 6 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 6 = ' + str(timeDiff)) + if boxName == 'tlshares': maxSharesPerAccount = itemsPerPage return (tlStr + @@ -5002,6 +5034,11 @@ def htmlTimeline(defaultTimeline: str, maxSharesPerAccount, httpPrefix) + htmlFooter()) + # benchmark 7 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 7 = ' + str(timeDiff)) + # show todays events buttons on the first inbox page if boxName == 'inbox' and pageNumber == 1: if todaysEventsCheck(baseDir, nickname, domain): @@ -5030,6 +5067,11 @@ def htmlTimeline(defaultTimeline: str, translate['Happening This Week'] + '\n' + \ '\n' + # benchmark 8 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 8 = ' + str(timeDiff)) + # page up arrow if pageNumber > 1: tlStr += \ @@ -5096,6 +5138,11 @@ def htmlTimeline(defaultTimeline: str, if boxName == 'tlmedia': tlStr += '\n' + # benchmark 9 + timeDiff = int(time.time() - timelineStartTime) + if timeDiff > 100: + print('TIMELINE TIMING ' + boxName + ' 9 = ' + str(timeDiff)) + # page down arrow if itemCtr > 2: tlStr += \