Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Alternative method to get last Unread post #1227

Open
saxamaphone69 opened this issue Dec 8, 2016 · 4 comments
Open

[Question] Alternative method to get last Unread post #1227

saxamaphone69 opened this issue Dec 8, 2016 · 4 comments

Comments

@saxamaphone69
Copy link
Collaborator

saxamaphone69 commented Dec 8, 2016

Not a bug, more just something to feed my curiosity.

I'm trying to debug some horrible reflow that happens when using my userstyle, which is particularly evident in threads with ~200+ posts.

Two example GIFs here and here along with a Timeline screenshot.

One of the first ones, 206ms, is a this part of code for autohiding scrollbars (which I don't have enabled - I can't even find the option). Developer Tools tells me it affects 8875 elements. This also only happens on the extension, this does not appear when running from the userscript.

One of the next big ones is here, timing for ~350ms and affecting 11379 elements. This recalculation then causes a layout change of ~230ms for 19959 elements. Which in turns causes another 130ms recalculate style for 5368 elements, forced by this bit.

And occassionaly this part pops up too.

This is where my curiosity starts. Because turning off my userstyle, and going back to default styling, these reflows still occur with the same times.

Was just wondering if something like scrollIntoView()[1][2] could be used.

Also, I don't know if this is applicable, but I've seen mention of wrapping scroll events in requestAnimationFrame[1][2][3] too.

I don't know if this would alleviate some of the reflow issues? Was curious - or perhaps you've even tested this already.

Something like: when in a thread, keep a note of which post is at the bottom of the window and storing that somewhere (e.g. thread/101959270#p101960071) and then when a user goes back to that thread, do something with that scrollIntoView event?

Sorry for this mini-blog. I would've preferred to email something like this, but I couldn't find one. Was just curious, and am trying to find an answer for my reflow issues.

EDIT: While I found the offending CSS in my userstyle, I would like to think there is still something here.

EDIT2: The offending line is actually https://github.com/ccd0/4chan-x/blob/master/src/Monitoring/Unread.coffee#L176

@ccd0
Copy link
Owner

ccd0 commented Dec 15, 2016

Thanks. I'll investigate when I have time, but I suspect a lot of these layout calculations are things that are going to be happening anyway, whether or not 4chan X forces them to happen immediately by querying the height/position of elements.

@saxamaphone69
Copy link
Collaborator Author

No worries dude. Times like these makes me wish I understood the build process to help out. 😞 One day.

@ccd0
Copy link
Owner

ccd0 commented Dec 15, 2016

If there's something in the build instructions you don't understand, please ask about it; there are probably many other people who don't understand it. And that needs to be fixed.

@saxamaphone69
Copy link
Collaborator Author

It's more or less some of the stuff brought up in #829.

Once I start seeing npm and make and coffeescript my eyes start glazing over. The idea of a build process scares me, that's all.

It's the same issue regarding @qqueue's c4 (he even went so far to try and make it idiot(me)-friendly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants