Only benchmark timeline when being displayed

main
Bob Mottram 2020-08-29 10:56:30 +01:00
parent 9fab236f04
commit 74046a9c3d
1 changed files with 155 additions and 114 deletions

View File

@ -233,6 +233,7 @@ def updateAvatarImageCache(session, baseDir: str, httpPrefix: str,
avatarImageFilename = avatarImagePath + '.webp' avatarImageFilename = avatarImagePath + '.webp'
else: else:
return None return None
if (not os.path.isfile(avatarImageFilename) or force) and allowDownloads: if (not os.path.isfile(avatarImageFilename) or force) and allowDownloads:
try: try:
print('avatar image url: ' + avatarUrl) print('avatar image url: ' + avatarUrl)
@ -3858,18 +3859,22 @@ def individualPostAsHtml(allowDownloads: bool,
allowDownloads) allowDownloads)
# benchmark 2.1 # benchmark 2.1
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 2.1 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName +
' 2.1 = ' + str(timeDiff))
updateAvatarImageCache(session, baseDir, httpPrefix, updateAvatarImageCache(session, baseDir, httpPrefix,
postActor, avatarUrl, personCache, postActor, avatarUrl, personCache,
allowDownloads) allowDownloads)
# benchmark 2.2 # benchmark 2.2
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 2.2 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName +
' 2.2 = ' + str(timeDiff))
postHtml = \ postHtml = \
loadIndividualPostAsHtmlFromCache(baseDir, nickname, domain, loadIndividualPostAsHtmlFromCache(baseDir, nickname, domain,
@ -3879,12 +3884,15 @@ def individualPostAsHtml(allowDownloads: bool,
updateRecentPostsCache(recentPostsCache, maxRecentPosts, updateRecentPostsCache(recentPostsCache, maxRecentPosts,
postJsonObject, postHtml) postJsonObject, postHtml)
# benchmark 3 # benchmark 3
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 3 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName +
' 3 = ' + str(timeDiff))
return postHtml return postHtml
# benchmark 4 # benchmark 4
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 4 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 4 = ' + str(timeDiff))
@ -3903,6 +3911,7 @@ def individualPostAsHtml(allowDownloads: bool,
allowDownloads) allowDownloads)
# benchmark 5 # benchmark 5
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 5 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 5 = ' + str(timeDiff))
@ -3919,6 +3928,7 @@ def individualPostAsHtml(allowDownloads: bool,
projectVersion, httpPrefix, projectVersion, httpPrefix,
nickname, domain, 'outbox') nickname, domain, 'outbox')
# benchmark 6 # benchmark 6
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 6 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 6 = ' + str(timeDiff))
@ -3933,6 +3943,7 @@ def individualPostAsHtml(allowDownloads: bool,
displayName, False) displayName, False)
# benchmark 7 # benchmark 7
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 7 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 7 = ' + str(timeDiff))
@ -3991,6 +4002,7 @@ def individualPostAsHtml(allowDownloads: bool,
isAnnounced = True isAnnounced = True
# benchmark 8 # benchmark 8
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 8 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 8 = ' + str(timeDiff))
@ -4044,6 +4056,7 @@ def individualPostAsHtml(allowDownloads: bool,
'">@' + actorNickname + '@' + actorDomain + '</a>\n' '">@' + actorNickname + '@' + actorDomain + '</a>\n'
# benchmark 9 # benchmark 9
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 9 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 9 = ' + str(timeDiff))
@ -4106,6 +4119,7 @@ def individualPostAsHtml(allowDownloads: bool,
' |" src="/' + iconsDir + '/reply.png"/></a>\n' ' |" src="/' + iconsDir + '/reply.png"/></a>\n'
# benchmark 10 # benchmark 10
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 10 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 10 = ' + str(timeDiff))
@ -4113,6 +4127,7 @@ def individualPostAsHtml(allowDownloads: bool,
isEvent = isEventPost(postJsonObject) isEvent = isEventPost(postJsonObject)
# benchmark 11 # benchmark 11
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 11 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 11 = ' + str(timeDiff))
@ -4171,6 +4186,7 @@ def individualPostAsHtml(allowDownloads: bool,
' |" src="/' + iconsDir + '/' + announceIcon + '"/></a>\n' ' |" src="/' + iconsDir + '/' + announceIcon + '"/></a>\n'
# benchmark 12 # benchmark 12
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12 = ' + str(timeDiff))
@ -4190,6 +4206,7 @@ def individualPostAsHtml(allowDownloads: bool,
likeCount = noOfLikes(postJsonObject) likeCount = noOfLikes(postJsonObject)
# benchmark 12.1 # benchmark 12.1
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12.1 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12.1 = ' + str(timeDiff))
@ -4207,6 +4224,7 @@ def individualPostAsHtml(allowDownloads: bool,
likeTitle = translate['Undo the like'] likeTitle = translate['Undo the like']
# benchmark 12.2 # benchmark 12.2
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12.2 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12.2 = ' + str(timeDiff))
@ -4225,6 +4243,7 @@ def individualPostAsHtml(allowDownloads: bool,
' |" src="/' + iconsDir + '/' + likeIcon + '"/></a>\n' ' |" src="/' + iconsDir + '/' + likeIcon + '"/></a>\n'
# benchmark 12.5 # benchmark 12.5
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12.5 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12.5 = ' + str(timeDiff))
@ -4239,6 +4258,7 @@ def individualPostAsHtml(allowDownloads: bool,
bookmarkLink = 'unbookmark' bookmarkLink = 'unbookmark'
bookmarkTitle = translate['Undo the bookmark'] bookmarkTitle = translate['Undo the bookmark']
# benchmark 12.6 # benchmark 12.6
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12.6 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12.6 = ' + str(timeDiff))
@ -4255,6 +4275,7 @@ def individualPostAsHtml(allowDownloads: bool,
'/' + bookmarkIcon + '"/></a>\n' '/' + bookmarkIcon + '"/></a>\n'
# benchmark 12.9 # benchmark 12.9
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 12.9 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 12.9 = ' + str(timeDiff))
@ -4262,6 +4283,7 @@ def individualPostAsHtml(allowDownloads: bool,
isMuted = postIsMuted(baseDir, nickname, domain, postJsonObject, messageId) isMuted = postIsMuted(baseDir, nickname, domain, postJsonObject, messageId)
# benchmark 13 # benchmark 13
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 13 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 13 = ' + str(timeDiff))
@ -4305,6 +4327,7 @@ def individualPostAsHtml(allowDownloads: bool,
'" src="/' + iconsDir+'/unmute.png"/></a>\n' '" src="/' + iconsDir+'/unmute.png"/></a>\n'
# benchmark 13.1 # benchmark 13.1
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 13.1 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 13.1 = ' + str(timeDiff))
@ -4325,6 +4348,7 @@ def individualPostAsHtml(allowDownloads: bool,
'/repeat_inactive.png" class="announceOrReply"/>\n' '/repeat_inactive.png" class="announceOrReply"/>\n'
else: else:
# benchmark 13.2 # benchmark 13.2
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + print('TIMING INDIV ' + boxName +
@ -4340,6 +4364,7 @@ def individualPostAsHtml(allowDownloads: bool,
getDisplayName(baseDir, attributedTo, personCache) getDisplayName(baseDir, attributedTo, personCache)
if announceDisplayName: if announceDisplayName:
# benchmark 13.3 # benchmark 13.3
if not allowDownloads:
timeDiff = \ timeDiff = \
int((time.time() - postStartTime) * 1000) int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
@ -4353,6 +4378,7 @@ def individualPostAsHtml(allowDownloads: bool,
announceDisplayName, announceDisplayName,
False) False)
# benchmark 13.3.1 # benchmark 13.3.1
if not allowDownloads:
timeDiff = \ timeDiff = \
int((time.time() - postStartTime) * 1000) int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
@ -4375,6 +4401,7 @@ def individualPostAsHtml(allowDownloads: bool,
personCache, allowDownloads) personCache, allowDownloads)
# benchmark 13.4 # benchmark 13.4
if not allowDownloads:
timeDiff = \ timeDiff = \
int((time.time() - postStartTime) * 1000) int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
@ -4452,11 +4479,14 @@ def individualPostAsHtml(allowDownloads: bool,
if replyDisplayName: if replyDisplayName:
if ':' in replyDisplayName: if ':' in replyDisplayName:
# benchmark 13.5 # benchmark 13.5
timeDiff = int((time.time() - if not allowDownloads:
timeDiff = \
int((time.time() -
postStartTime) * 1000) postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + print('TIMING INDIV ' +
' 13.5 = ' + str(timeDiff)) boxName + ' 13.5 = ' +
str(timeDiff))
repDisp = replyDisplayName repDisp = replyDisplayName
replyDisplayName = \ replyDisplayName = \
addEmojiToDisplayName(baseDir, addEmojiToDisplayName(baseDir,
@ -4466,11 +4496,14 @@ def individualPostAsHtml(allowDownloads: bool,
repDisp, repDisp,
False) False)
# benchmark 13.6 # benchmark 13.6
timeDiff = int((time.time() - if not allowDownloads:
timeDiff = \
int((time.time() -
postStartTime) * 1000) postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + print('TIMING INDIV ' +
' 13.6 = ' + str(timeDiff)) boxName + ' 13.6 = ' +
str(timeDiff))
titleStr += \ titleStr += \
' <img loading="lazy" title="' + \ ' <img loading="lazy" title="' + \
translate['replying to'] + \ translate['replying to'] + \
@ -4483,6 +4516,7 @@ def individualPostAsHtml(allowDownloads: bool,
'">' + replyDisplayName + '</a>\n' '">' + replyDisplayName + '</a>\n'
# benchmark 13.7 # benchmark 13.7
if not allowDownloads:
timeDiff = int((time.time() - timeDiff = int((time.time() -
postStartTime) * 1000) postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
@ -4497,6 +4531,7 @@ def individualPostAsHtml(allowDownloads: bool,
allowDownloads) allowDownloads)
# benchmark 13.8 # benchmark 13.8
if not allowDownloads:
timeDiff = int((time.time() - timeDiff = int((time.time() -
postStartTime) * 1000) postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
@ -4570,6 +4605,7 @@ def individualPostAsHtml(allowDownloads: bool,
'">' + postDomain + '</a>\n' '">' + postDomain + '</a>\n'
# benchmark 14 # benchmark 14
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 14 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 14 = ' + str(timeDiff))
@ -4598,6 +4634,7 @@ def individualPostAsHtml(allowDownloads: bool,
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M") publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
# benchmark 15 # benchmark 15
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 15 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 15 = ' + str(timeDiff))
@ -4660,6 +4697,7 @@ def individualPostAsHtml(allowDownloads: bool,
postJsonObject['object']['content']) postJsonObject['object']['content'])
# benchmark 16 # benchmark 16
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 16 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 16 = ' + str(timeDiff))
@ -4705,6 +4743,7 @@ def individualPostAsHtml(allowDownloads: bool,
contentStr += cwContentStr contentStr += cwContentStr
# benchmark 17 # benchmark 17
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 17 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 17 = ' + str(timeDiff))
@ -4738,6 +4777,7 @@ def individualPostAsHtml(allowDownloads: bool,
postHtml = galleryStr postHtml = galleryStr
# benchmark 18 # benchmark 18
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 18 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 18 = ' + str(timeDiff))
@ -4751,6 +4791,7 @@ def individualPostAsHtml(allowDownloads: bool,
postJsonObject, postHtml) postJsonObject, postHtml)
# benchmark 19 # benchmark 19
if not allowDownloads:
timeDiff = int((time.time() - postStartTime) * 1000) timeDiff = int((time.time() - postStartTime) * 1000)
if timeDiff > 100: if timeDiff > 100:
print('TIMING INDIV ' + boxName + ' 19 = ' + str(timeDiff)) print('TIMING INDIV ' + boxName + ' 19 = ' + str(timeDiff))