Skip to content

Load the user.js with @require to improve performance on certain android browsers #169

@Ryah

Description

@Ryah

Is your feature request related to a problem? Please describe.
I don't use Firefox on Android as it performs significantly worse on my phone (Pixel 6) than any of the Chrome derivatives. Because of this, I use Via which has userscript support built in.

While it sometimes CAN load this userscript, it very often errors out due to the sheer size of it and refuses to load any of my other userscripts altogether. The only way I could get it to load somewhat reliably was to re-install the script every single time I clicked on a reddit link, or to have it load at document-end (which comes with its own set of issues and even then wasn't 100% consistent). Ive also tried other browsers like xBrowser and they either also error out or have a 2mb file size limit.

I decided to try making a new script with your heading and no other code except instead of all of your js code, I simply took the link to the latest user.js release file and put it in a @require tag. This has yet to fail to load on me with document-start, and even loads quicker overall. Most likely is because the script is now cached instead of fully reloading/compiling every time you click on a reddit link.

It also may be placebo, but I've also noticed my phone being considerably cooler than before (although the Pixel 6 runs pretty hot in general so ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯)

Describe the solution you'd like
Make a user.js that loads Oldlander through a @require tag instead of one massive user.js file.

Here's the script I'm currently using:

// ==UserScript==
// @name         OldLander Remote Test
// @namespace    https://github.com/OctoNezd/oldlander
// @homepageURL  https://github.com/OctoNezd/oldlander
// @downloadURL  https://github.com/OctoNezd/oldlander/releases/latest/download/oldlander.user.js
// @version      1.1.0.514
// @description  Makes old reddit more usable on mobile devices.
// @author       OctoNezd
// @match        https://reddit.com/*
// @match        https://old.reddit.com/*
// @match        https://*.reddit.com/*
// @icon         https://raw.githubusercontent.com/OctoNezd/oldlander/main/icons/icon.png
// @grant        GM.setValue
// @grant        GM.getValue
// @grant        GM_getValue
// @grant        GM_setValue
// @require      https://github.com/OctoNezd/oldlander/releases/latest/download/oldlander.user.js
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';
})();

Additional context
This has its own pretty big disadvantages in terms of security, as the author could update the script without the end user knowing of the changes. But even offloading some of this script to an external js file or separate modules would increase overall performance dramatically with the downside of having a tiny bit of overhead on the first time you load the script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions