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