mirror of https://gitlab.com/bashrc2/epicyon
Individual post benchmarks
parent
fd6c36cb57
commit
c724d8960d
|
@ -3803,17 +3803,30 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
storeToCache=True) -> str:
|
storeToCache=True) -> str:
|
||||||
""" Shows a single post as html
|
""" Shows a single post as html
|
||||||
"""
|
"""
|
||||||
|
# benchmark
|
||||||
|
postStartTime = time.time()
|
||||||
|
|
||||||
postActor = postJsonObject['actor']
|
postActor = postJsonObject['actor']
|
||||||
|
|
||||||
# ZZZzzz
|
# ZZZzzz
|
||||||
if isPersonSnoozed(baseDir, nickname, domain, postActor):
|
if isPersonSnoozed(baseDir, nickname, domain, postActor):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
# benchmark 1
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 1 = ' + str(timeDiff))
|
||||||
|
|
||||||
avatarPosition = ''
|
avatarPosition = ''
|
||||||
messageId = ''
|
messageId = ''
|
||||||
if postJsonObject.get('id'):
|
if postJsonObject.get('id'):
|
||||||
messageId = removeIdEnding(postJsonObject['id'])
|
messageId = removeIdEnding(postJsonObject['id'])
|
||||||
|
|
||||||
|
# benchmark 2
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 2 = ' + str(timeDiff))
|
||||||
|
|
||||||
messageIdStr = ''
|
messageIdStr = ''
|
||||||
if messageId:
|
if messageId:
|
||||||
messageIdStr = ';' + messageId
|
messageIdStr = ';' + messageId
|
||||||
|
@ -3846,8 +3859,17 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
postHtml = preparePostFromHtmlCache(postHtml, boxName, pageNumber)
|
postHtml = preparePostFromHtmlCache(postHtml, boxName, pageNumber)
|
||||||
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
||||||
postJsonObject, postHtml)
|
postJsonObject, postHtml)
|
||||||
|
# benchmark 3
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 3 = ' + str(timeDiff))
|
||||||
return postHtml
|
return postHtml
|
||||||
|
|
||||||
|
# benchmark 4
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 4 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not avatarUrl:
|
if not avatarUrl:
|
||||||
avatarUrl = \
|
avatarUrl = \
|
||||||
getPersonAvatarUrl(baseDir, postActor, personCache)
|
getPersonAvatarUrl(baseDir, postActor, personCache)
|
||||||
|
@ -3858,6 +3880,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
updateAvatarImageCache(session, baseDir, httpPrefix,
|
updateAvatarImageCache(session, baseDir, httpPrefix,
|
||||||
postActor, avatarUrl, personCache)
|
postActor, avatarUrl, personCache)
|
||||||
|
|
||||||
|
# benchmark 5
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 5 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not avatarUrl:
|
if not avatarUrl:
|
||||||
avatarUrl = postActor + '/avatar.png'
|
avatarUrl = postActor + '/avatar.png'
|
||||||
|
|
||||||
|
@ -3869,6 +3896,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
personCache,
|
personCache,
|
||||||
projectVersion, httpPrefix,
|
projectVersion, httpPrefix,
|
||||||
nickname, domain, 'outbox')
|
nickname, domain, 'outbox')
|
||||||
|
# benchmark 6
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 6 = ' + str(timeDiff))
|
||||||
|
|
||||||
if avatarUrl2:
|
if avatarUrl2:
|
||||||
avatarUrl = avatarUrl2
|
avatarUrl = avatarUrl2
|
||||||
if displayName:
|
if displayName:
|
||||||
|
@ -3878,6 +3910,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
displayName, False)
|
displayName, False)
|
||||||
|
|
||||||
|
# benchmark 7
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 7 = ' + str(timeDiff))
|
||||||
|
|
||||||
avatarLink = ' <a class="imageAnchor" href="' + postActor + '">'
|
avatarLink = ' <a class="imageAnchor" href="' + postActor + '">'
|
||||||
avatarLink += \
|
avatarLink += \
|
||||||
' <img loading="lazy" src="' + avatarUrl + '" title="' + \
|
' <img loading="lazy" src="' + avatarUrl + '" title="' + \
|
||||||
|
@ -3931,6 +3968,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
postJsonObject = postJsonAnnounce
|
postJsonObject = postJsonAnnounce
|
||||||
isAnnounced = True
|
isAnnounced = True
|
||||||
|
|
||||||
|
# benchmark 8
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 8 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not isinstance(postJsonObject['object'], dict):
|
if not isinstance(postJsonObject['object'], dict):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -3979,6 +4021,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
';' + str(pageNumber) + ';' + avatarUrl + messageIdStr + \
|
';' + str(pageNumber) + ';' + avatarUrl + messageIdStr + \
|
||||||
'">@' + actorNickname + '@' + actorDomain + '</a>\n'
|
'">@' + actorNickname + '@' + actorDomain + '</a>\n'
|
||||||
|
|
||||||
|
# benchmark 9
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 9 = ' + str(timeDiff))
|
||||||
|
|
||||||
# Show a DM icon for DMs in the inbox timeline
|
# Show a DM icon for DMs in the inbox timeline
|
||||||
if showDMicon:
|
if showDMicon:
|
||||||
titleStr = \
|
titleStr = \
|
||||||
|
@ -4036,8 +4083,18 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
translate['Reply to this post'] + \
|
translate['Reply to this post'] + \
|
||||||
' |" src="/' + iconsDir + '/reply.png"/></a>\n'
|
' |" src="/' + iconsDir + '/reply.png"/></a>\n'
|
||||||
|
|
||||||
|
# benchmark 10
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 10 = ' + str(timeDiff))
|
||||||
|
|
||||||
isEvent = isEventPost(postJsonObject)
|
isEvent = isEventPost(postJsonObject)
|
||||||
|
|
||||||
|
# benchmark 11
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 11 = ' + str(timeDiff))
|
||||||
|
|
||||||
editStr = ''
|
editStr = ''
|
||||||
if fullDomain + '/users/' + nickname in postJsonObject['actor']:
|
if fullDomain + '/users/' + nickname in postJsonObject['actor']:
|
||||||
if '/statuses/' in postJsonObject['object']['id']:
|
if '/statuses/' in postJsonObject['object']['id']:
|
||||||
|
@ -4091,6 +4148,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
'" alt="' + translate['Repeat this post'] + \
|
'" alt="' + translate['Repeat this post'] + \
|
||||||
' |" src="/' + iconsDir + '/' + announceIcon + '"/></a>\n'
|
' |" src="/' + iconsDir + '/' + announceIcon + '"/></a>\n'
|
||||||
|
|
||||||
|
# benchmark 12
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 12 = ' + str(timeDiff))
|
||||||
|
|
||||||
# whether to show a like button
|
# whether to show a like button
|
||||||
hideLikeButtonFile = \
|
hideLikeButtonFile = \
|
||||||
baseDir + '/accounts/' + nickname + '@' + domain + '/.hideLikeButton'
|
baseDir + '/accounts/' + nickname + '@' + domain + '/.hideLikeButton'
|
||||||
|
@ -4151,6 +4213,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
|
|
||||||
isMuted = postIsMuted(baseDir, nickname, domain, postJsonObject, messageId)
|
isMuted = postIsMuted(baseDir, nickname, domain, postJsonObject, messageId)
|
||||||
|
|
||||||
|
# benchmark 13
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 13 = ' + str(timeDiff))
|
||||||
|
|
||||||
deleteStr = ''
|
deleteStr = ''
|
||||||
muteStr = ''
|
muteStr = ''
|
||||||
if (allowDeletion or
|
if (allowDeletion or
|
||||||
|
@ -4394,6 +4461,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
postJsonObject['object']['inReplyTo'] + \
|
postJsonObject['object']['inReplyTo'] + \
|
||||||
'">' + postDomain + '</a>\n'
|
'">' + postDomain + '</a>\n'
|
||||||
|
|
||||||
|
# benchmark 14
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 14 = ' + str(timeDiff))
|
||||||
|
|
||||||
attachmentStr, galleryStr = \
|
attachmentStr, galleryStr = \
|
||||||
getPostAttachmentsAsHtml(postJsonObject, boxName, translate,
|
getPostAttachmentsAsHtml(postJsonObject, boxName, translate,
|
||||||
isMuted, avatarLink.strip(),
|
isMuted, avatarLink.strip(),
|
||||||
|
@ -4417,6 +4489,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
datetimeObject = parse(publishedStr)
|
datetimeObject = parse(publishedStr)
|
||||||
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
|
publishedStr = datetimeObject.strftime("%a %b %d, %H:%M")
|
||||||
|
|
||||||
|
# benchmark 15
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 15 = ' + str(timeDiff))
|
||||||
|
|
||||||
publishedLink = messageId
|
publishedLink = messageId
|
||||||
# blog posts should have no /statuses/ in their link
|
# blog posts should have no /statuses/ in their link
|
||||||
if isBlogPost(postJsonObject):
|
if isBlogPost(postJsonObject):
|
||||||
|
@ -4474,6 +4551,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
postJsonObject['object']['summary'],
|
postJsonObject['object']['summary'],
|
||||||
postJsonObject['object']['content'])
|
postJsonObject['object']['content'])
|
||||||
|
|
||||||
|
# benchmark 16
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 16 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not isPatch:
|
if not isPatch:
|
||||||
objectContent = \
|
objectContent = \
|
||||||
removeLongWords(postJsonObject['object']['content'], 40, [])
|
removeLongWords(postJsonObject['object']['content'], 40, [])
|
||||||
|
@ -4514,6 +4596,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
else:
|
else:
|
||||||
contentStr += cwContentStr
|
contentStr += cwContentStr
|
||||||
|
|
||||||
|
# benchmark 17
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 17 = ' + str(timeDiff))
|
||||||
|
|
||||||
if postJsonObject['object'].get('tag') and not isPatch:
|
if postJsonObject['object'].get('tag') and not isPatch:
|
||||||
contentStr = \
|
contentStr = \
|
||||||
replaceEmojiFromTags(contentStr,
|
replaceEmojiFromTags(contentStr,
|
||||||
|
@ -4542,6 +4629,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
else:
|
else:
|
||||||
postHtml = galleryStr
|
postHtml = galleryStr
|
||||||
|
|
||||||
|
# benchmark 18
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 18 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not showPublicOnly and storeToCache and \
|
if not showPublicOnly and storeToCache and \
|
||||||
boxName != 'tlmedia' and boxName != 'tlbookmarks' and \
|
boxName != 'tlmedia' and boxName != 'tlbookmarks' and \
|
||||||
boxName != 'bookmarks':
|
boxName != 'bookmarks':
|
||||||
|
@ -4550,6 +4642,11 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int,
|
||||||
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
updateRecentPostsCache(recentPostsCache, maxRecentPosts,
|
||||||
postJsonObject, postHtml)
|
postJsonObject, postHtml)
|
||||||
|
|
||||||
|
# benchmark 19
|
||||||
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
if timeDiff > 100:
|
||||||
|
print('TIMELINE INDIV ' + boxName + ' 19 = ' + str(timeDiff))
|
||||||
|
|
||||||
return postHtml
|
return postHtml
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue