The feed stays light at thousands of posts
A Perf test (tests/e2e/Perf/FeedPerfTests, Category=Perf) scrolls load0's home, thousands of posts from SocialPub's load runs, to 2000 posts. Before: 100 cards took 12 s to reach, 1000 took 437 s, 2000 took 29 minutes; the main thread was busy almost all of that time, and the page held 224 000 DOM nodes and 920 MB of .NET heap. Every card re-rendered whenever the list did. - A card re-renders only when its own events run or its render key changes (Content.RenderKey: the post, its status, notification, conversation, place and grouping, where it is shown, the persona and the connection). 2000 cards then took 122 s. - The list is a <Virtualize>: only the cards near the view are rendered. The page now holds about 3 000 DOM nodes and 145 MB however long the feed is, and each page of older posts costs the same (about 1.9 s in the test's scroll loop) at the 100th post as at the 1700th. The feed tells how many posts it holds in data-feed-count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
f9de55ffd5
commit
a5178a67b1
4 files changed
+138
-5
No files matched your search
+5
-4
@@ -23,7 +23,7 @@
|
||||
|
||||
<div class="relative flex-1 min-h-0 neo-inset neo-xs rounded-xl">
|
||||
<div id="@ScrollId" class="absolute inset-0 overflow-y-auto p-3 md:p-4">
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-4" data-feed-count="@posts.Count">
|
||||
|
||||
@if (isComposing)
|
||||
{
|
||||
@@ -74,10 +74,11 @@
|
||||
</p>
|
||||
}
|
||||
|
||||
@foreach (var post in posts)
|
||||
{
|
||||
@* only the cards near the view are rendered: a feed of thousands stays as light as one of forty
|
||||
(tests/e2e/Perf/FeedPerfTests) *@
|
||||
<Virtualize Items="posts" Context="post" ItemSize="320" OverscanCount="8">
|
||||
<Content @key="post.Key" Post="post" FilterIn="FilterIn" OnDeleted="Remove" OnReplied="Replied" OnTag="OpenTag" />
|
||||
}
|
||||
</Virtualize>
|
||||
|
||||
<div id="@SentinelId" class="flex justify-center min-h-8 text-xs opacity-60">
|
||||
@if (isLoadingMore)
|
||||
|
||||
Reference in new issue
Block a user