Live data from Hacker News

Show HN: HN Avatars in 357 bytes

news.ycombinator.com

521–530 of 536 posts

Re: Show HN: HN Avatars in 357 bytes

#521
post #300
post #43

This is fun. One suggestion.. rather than creating a canvas for each user using a querySelectorAll and a loop, I'd use an IntersectionObserver and only create the canvases as they scroll into view. That way the user's device won't need to create hundreds of elements when the code runs. let observer = new IntersectionObserver( (entries) => { entries.forEach((entry, i) => { if (entry.isIntersecting) { const p = 2; cons…

Thanks, Interesting idea. I'm a little sceptical of the performance improvement, but I suppose that depends what we mean by performance. Your strategy essentially trades a one time computation and DOM mutation with a continuous but lighter one with some added overhead. In this case I suspect the total power performance is worse over time; _however_ latency and UX should be _better_, since it removes the relationship…

I wonder how `` would compare to `` instead

Re: Show HN: HN Avatars in 357 bytes

#523
post #521
post #300

Earlier quoted context omitted.

Thanks, Interesting idea. I'm a little sceptical of the performance improvement, but I suppose that depends what we mean by performance. Your strategy essentially trades a one time computation and DOM mutation with a continuous but lighter one with some added overhead. In this case I suspect the total power performance is worse over time; _however_ latency and UX should be _better_, since it removes the relationship…

I wonder how ` ` would compare to ` ` instead

Yes! it did cross my mind, I was just more familiar with canvas API so I cracked on with it... but I suppose encoding a simple format like bitmap would be trivial, almost like being able to access the canvas pixel buffer but with a lower overhead.

This thread is a good perf test, I might give it a quick go.

Also as others mentions the pixelation style thing is now finally fully cross browser supported, which should make it easier to achieve nearest neighbour upscaling for url encoding.

[edit]

I underestimated how involved image format headers are!

Post reply on HN