Firefox is very laggy with many (discarded) tabs and huge sessionstore.jsonlz4
Problem: Firefox glitches a lot if the total number of all tabs exceeds 4129, and the sessionstore.jsonlz4 file in the profile has a large size.
Details: Some interface elements stop displaying normally after some time after opening 4130 tab, 4131 tab or more - popup menus, extension menus, Firefox menus, contextual menus, hovering popup windows, etc. They're either not displayed at all or partially displayed. The problem is purely visual - these elements are present and can be clicked on with the mouse, they just aren't displayed correctly. The more tabs open after 4129, the faster and harder the Firefox lags. When I quickly open more than 50 tabs after 4129, the browser usually stops displaying anything and completely freezes. The problem also appears some time after restarting the browser. Closing all tabs above the limit of 4129 completely solves the problem.
What have I done to solve the problem and what isn't working:
- tried running the browser in "safe-mode" (without extensions and hardware acceleration);
- tried running my firefox-profile in a new clean firefox client of the same version (87);
- tried running my firefox-profile in a new clean firefox client of the latest version (94);
- tried running my firefox-profile on another computer with significantly more RAM (32GB);
- tried running my firefox-profile with sessionstore.jsonlz4 saved earlier (a week earlier)
- tried running my sessionstore.jsonlz4 in a brand new profile;
- combinations of all steps above.
Partial solution: The problem is definitely related to the sessionstore.jsonlz4 file from the profile. But since this file is critically important to me, I can't just create a new blank one. I tried creating a brand new one based on the old one, but smaller in size (I used [this](https://addons.mozilla.org/en-US/firefox/addon/sidebery/) extension). The old sessionstore.jsonlz4 (A) is 10.2MB, the new one (B) is 631KB. This difference in size is due to the fact that the new file doesn't contain data in the "image" attribute of tabs. In old (A) sessionstore.jsonlz4 67% of the space was taken up by the "image" attribute (it seems to be responsible for displaying the icons on the tabs), 16% by attribute "csp" (no idea what it is), all other attributes take less than 2% each. There're no "csp" attribute in my new (B) sessionstore.jsonlz4 and "image" attributes are "null". The first and second place are the "url" (23%) and "title" (19%) attributes respectively. I moved the new (B) sessionstore.jsonlz4 to the old profile and the problem was solved (the 4129 tabs limit disappeared). However, since the new (B) sessionstore.jsonlz4 has no "image" attribute data, all tabs are displayed without icons. I wrote a simple python-script that decompresses sessionstore files into json format, then copy "images" attributes of the old (A) sessionstore.json into the new one (C), and then compresses this into the new (C) sessionstore.jsonlz4. The size of such a compiled file is 6.82MB. When using such a sessionstore (С), the tab-icons are displayed, but the problem with the limit of 4129 tabs appears again. So it's obvious that the large size of the sessionstore.jsonlz4 file is the root of the problem.
My questions: 1) How do I fix it? Obviously, the "do not use more than 4129 tabs" option is not suitable for me. I know that most users will find this number of tabs excessive and suggest using bookmarks, but it doesn't work for me either. Spread tabs across multiple profiles or even browsers? I'm afraid that's what I'll end up having to do. 2) Why is this happening? I read people online who had sessionstore.jsonlz4 over 50MB and had no problems. 3) 67% of the space in my sessionstore-(A) is taken up by images, and many of them are repeated 100-300 times - a colossal waste. In total, I counted 792 unique images. Question - is there any way to modify sessionstore.jsonlz4 to significantly reduce its size, but still leave the data about these images? I tried to create 792 files with these images on my disk and replace the "image" attributes data with the path to these files. I tried the following options:
"image": "D:/some_dir/123.ico" "image": "D:\\some_dir\\123.ico" "image": "file:///D:/some_dir/123.ico" "image": "file:///D:\\some_dir\\123.ico"
But it all doesn't work - the browser just replaces all these values with "null" after loading. In the original, such an attribute usually looks something like this:
"image": "data:image/png;base64,iVBORw0KGAAAf8...(many bytes)...5ErkJggg==" or "image": "data:image/ico;base64,...
Any other ideas on how to replace those long data:image-strings?
I'm sorry for such a vague, long question, but I really need help from the experts.
由 CarthagoDelendaEst 於 修改