feed: less eager rendering #67

Merged
offbyn merged 1 commits from feed-lazy-render into master 1 year ago
offbyn commented 1 year ago
Owner

before this change every new incoming text note called a render,
that filters, sorts and iterates all known text notes and creates
missing dom elements and appends into the right place.

this change throttles and debounces (both!) the render function,
that less checks have to be performed, especially on page load
when potentially 100s of events arrive within a short time.

it is important to throttle and debounce, else either the last call
is missed or no render is called while events are being received.

this change surfaced an error in recommend server that depended on
all known text notes already being rendered and inside the dom.
this function should probably be handled by render feed itself.

before this change every new incoming text note called a render, that filters, sorts and iterates all known text notes and creates missing dom elements and appends into the right place. this change throttles and debounces (both!) the render function, that less checks have to be performed, especially on page load when potentially 100s of events arrive within a short time. it is important to throttle and debounce, else either the last call is missed or no render is called while events are being received. this change surfaced an error in recommend server that depended on all known text notes already being rendered and inside the dom. this function should probably be handled by render feed itself.
offbyn added 1 commit 1 year ago
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details
3ef066189a
feed: less eager rendering
before this change every new incoming text note called a render,
that filters, sorts and iterates all known text notes and creates
missing dom elements and appends into the right place.

this change throttles and debounces (both!) the render function,
that less checks have to be performed, especially on page load
when potentially 100s of events arrive within a short time.

it is important to throttle and debounce, else either the last call
is missed or no render is called while events are being received.

this change surfaced an error in recommend server that depended on
all known text notes already being rendered and inside the dom.
this function should probably be handled by render feed itself.
offbyn commented 1 year ago
Poster
Owner

tried to measure this change with lighthouse etc., but this depends on received data from relays and gave inconsistent results every time.

tired to create 100s of kind 1 event locally, but this was then the bulk of the bulk of the script. so the only way to measure this would be to have a dummy relay (maybe locally) that returns exactly the same data in same interval.

the only thing I managed to measure was that the renderFeed function is now called much less, i.e. if 100s of events are received on page load renderFeed excecutes below 10 times instead of 100s of times.

tried to measure this change with lighthouse etc., but this depends on received data from relays and gave inconsistent results every time. tired to create 100s of kind 1 event locally, but this was then the bulk of the bulk of the script. so the only way to measure this would be to have a dummy relay (maybe locally) that returns exactly the same data in same interval. the only thing I managed to measure was that the renderFeed function is now called much less, i.e. if 100s of events are received on page load renderFeed excecutes below 10 times instead of 100s of times.
offbyn force-pushed feed-lazy-render from 3ef066189a to f4f951469f 1 year ago
offbyn merged commit f4f951469f into master 1 year ago
offbyn deleted branch feed-lazy-render 1 year ago
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
The pull request has been merged as f4f951469f.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b feed-lazy-render master
git pull origin feed-lazy-render

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff feed-lazy-render
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nostr/nostrweb#67
Loading…
There is no content yet.