Timeline benchmarking

main
Bob Mottram 2020-08-28 21:59:54 +01:00
parent f602d5ecf9
commit 77cb188be1
1 changed files with 47 additions and 0 deletions

View File

@ -4596,6 +4596,8 @@ def htmlTimeline(defaultTimeline: str,
YTReplacementDomain: str) -> str: YTReplacementDomain: str) -> str:
"""Show the timeline as html """Show the timeline as html
""" """
timelineStartTime = time.time()
accountDir = baseDir + '/accounts/' + nickname + '@' + domain accountDir = baseDir + '/accounts/' + nickname + '@' + domain
# should the calendar icon be highlighted? # should the calendar icon be highlighted?
@ -4666,6 +4668,11 @@ def htmlTimeline(defaultTimeline: str,
if not os.path.isfile(bannerFilename): if not os.path.isfile(bannerFilename):
bannerFile = 'banner.webp' 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: with open(cssFilename, 'r') as cssFile:
# load css # load css
profileStyle = \ profileStyle = \
@ -4680,6 +4687,11 @@ def htmlTimeline(defaultTimeline: str,
# is the user a moderator? # is the user a moderator?
moderator = isModerator(baseDir, nickname) 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 # the appearance of buttons - highlighted or not
inboxButton = 'button' inboxButton = 'button'
blogsButton = 'button' blogsButton = 'button'
@ -4759,6 +4771,11 @@ def htmlTimeline(defaultTimeline: str,
'" src="/' + iconsDir + '/person.png"/></a>\n' '" src="/' + iconsDir + '/person.png"/></a>\n'
break break
# benchmark 3
timeDiff = int(time.time() - timelineStartTime)
if timeDiff > 100:
print('TIMELINE TIMING ' + boxName + ' 3 = ' + str(timeDiff))
# moderation / reports button # moderation / reports button
moderationButtonStr = '' moderationButtonStr = ''
if moderator and not minimal: if moderator and not minimal:
@ -4792,6 +4809,11 @@ def htmlTimeline(defaultTimeline: str,
tlStr = htmlHeader(cssFilename, profileStyle) 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 # what screen to go to when a new post is created
if boxName == 'dm': if boxName == 'dm':
newPostButtonStr = \ newPostButtonStr = \
@ -4934,6 +4956,11 @@ def htmlTimeline(defaultTimeline: str,
translate['Search and follow'] + '" alt="| ' + \ translate['Search and follow'] + '" alt="| ' + \
translate['Search and follow'] + '" class="timelineicon"/></a>\n' translate['Search and follow'] + '" class="timelineicon"/></a>\n'
# benchmark 5
timeDiff = int(time.time() - timelineStartTime)
if timeDiff > 100:
print('TIMELINE TIMING ' + boxName + ' 5 = ' + str(timeDiff))
# the calendar button # the calendar button
calendarAltText = translate['Calendar'] calendarAltText = translate['Calendar']
if newCalendarEvent: if newCalendarEvent:
@ -4994,6 +5021,11 @@ def htmlTimeline(defaultTimeline: str,
'" name="submitInfo" value="' + translate['Info'] + '">\n' '" name="submitInfo" value="' + translate['Info'] + '">\n'
tlStr += '</div>\n</form>\n' tlStr += '</div>\n</form>\n'
# benchmark 6
timeDiff = int(time.time() - timelineStartTime)
if timeDiff > 100:
print('TIMELINE TIMING ' + boxName + ' 6 = ' + str(timeDiff))
if boxName == 'tlshares': if boxName == 'tlshares':
maxSharesPerAccount = itemsPerPage maxSharesPerAccount = itemsPerPage
return (tlStr + return (tlStr +
@ -5002,6 +5034,11 @@ def htmlTimeline(defaultTimeline: str,
maxSharesPerAccount, httpPrefix) + maxSharesPerAccount, httpPrefix) +
htmlFooter()) 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 # show todays events buttons on the first inbox page
if boxName == 'inbox' and pageNumber == 1: if boxName == 'inbox' and pageNumber == 1:
if todaysEventsCheck(baseDir, nickname, domain): if todaysEventsCheck(baseDir, nickname, domain):
@ -5030,6 +5067,11 @@ def htmlTimeline(defaultTimeline: str,
translate['Happening This Week'] + '</button></a>\n' + \ translate['Happening This Week'] + '</button></a>\n' + \
'</center>\n' '</center>\n'
# benchmark 8
timeDiff = int(time.time() - timelineStartTime)
if timeDiff > 100:
print('TIMELINE TIMING ' + boxName + ' 8 = ' + str(timeDiff))
# page up arrow # page up arrow
if pageNumber > 1: if pageNumber > 1:
tlStr += \ tlStr += \
@ -5096,6 +5138,11 @@ def htmlTimeline(defaultTimeline: str,
if boxName == 'tlmedia': if boxName == 'tlmedia':
tlStr += '</div>\n' tlStr += '</div>\n'
# benchmark 9
timeDiff = int(time.time() - timelineStartTime)
if timeDiff > 100:
print('TIMELINE TIMING ' + boxName + ' 9 = ' + str(timeDiff))
# page down arrow # page down arrow
if itemCtr > 2: if itemCtr > 2:
tlStr += \ tlStr += \