Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Feature request: Allow for site generated minified version

I would like to offer a minified version of the full script, (preferably automatically generated by greasyfork), besides the full script so that people can choose what version they want to use.

Would something like that be possible?

Thanks,

Comments

  • I second the request.
    Browsers parse, compile, and execute a minified script noticeably faster.

  • It doesn't matter on downloading time for user script because it's only once for downloading to local.
    Parsing and compiling performance may be faster, but is it valuable on 10ms to 5ms ?
    If the executing performance differs, it's worth minifying. But I can't find any comparison. Once it compiled by js engine, I suppose there are no difference on minifying or not.

  • I'm -1 on this. It may marginally faster to download and parse, but it's at the expense of readability.

  • edited February 14 [?]

    The performance difference depends on the script complexity, the amount of scripts, and the computer performance. For example in Chrome userscript managers such as Tampermonkey don't have any other choice but to send a huge JSON with all the scripts and their data into each tab and iframe so the time to stringify and parse such a JSON could be easily 100ms depending on the machine. Even if only 5 - 10ms of which is shaved by using minification it'd be a nice small boost. Add to that similar small boosts from compiling and parsing as well as reduced memory usage for the source code and you would see quite a noticeable boost.

    As for compiled code performance, I've seen the difference as much as 500ms on a very fast 4GHz machine, which was due to a minifier that could shorten the object property names in a script that used those a lot (LZString compressor) so the runtime performance improved as JavaScript uses hashing to access objects in dictionary mode (aka hash tables).

    That said, I think this feature request should be implemented by the userscript manager locally as an option.

  • I suggested to have both, so readability of the script remains as it was.
    I felt the option to also have a minified version could be interesting for some.
    It could possibly also show me who is interested in the source, and who just want the functionality.

  • Yeah, it would make most sense to me for the script manager to do this if it's indeed such a performance boost.

  • Yes, I would not want you to allow anyone to add their own minified files on your site of course, but rather that the script manager generates the minified one, when the readable script is updated.
    This should keep it all safe.

Sign In or Register to comment.