Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
A script in the extension "OctoLinker" is causing Firefox to slow down #557
I consistently get this message when visiting this large file:
Admittedly this is more of an edge case, given the length of the file, but freezing the browser for a few seconds is never good.
Perhaps the operation can be done in the background and/or split up in multiple batches to avoid long blocking.
Wow this file length is insane! I think it's best to not execute OctoLinker at all if a file goes beyond a certain line limit. Refactroing the extension to support such edgaces seems to be overkill and I would rather spend my time with new features.
Defining the limit is probaly the trickest task here. My gut feeling says that everyone beyone 5000 lines should be ignored.
How does this sound to you?
That sounds alright, but it might be a good opportunity to find some bottlenecks, like these long garbage collection events
It appears to be caused by this (which contains
I'm sure that there's a more efficient way to replace dom elements, e.g. looping getTextNodes
Also from what I understand, the whole document is re-parsed for each regex
I too regularily observer the browser tab hanging when opening moderately big
If CPU-intensive work is to be done, maybe offload it to a web worker? Thought based on the comments above, the bottleneck sounds like inefficient parsing/replacing.
So this issue isn't new for both of you and existed also in the previous version, right? Anyway, sorry for this bad experience.
@bfred-it I agree, there are more efficeient ways to replace dom elements, but maintaining this extension for many years, taught me that relying on classNames and dom elements is error-prone and time consuming to keep in sync.
Maybe this helps to track down the issue. I'll look into this, but feel free to add your ideas / explorations as well.