pieroxy / lz-string

LZ-based compression algorithm for JavaScript
MIT License
4.08k stars 567 forks source link

Please investigate the slow (irresponsible) LZString issue in Edge #266

Open cyfung1031 opened 3 months ago

cyfung1031 commented 3 months ago

I wonder why this would become an Edge specific issue.

See https://github.com/cvzi/Spotify-Genius-Lyrics-userscript/issues/34 See https://github.com/cvzi/Youtube-Music-Genius-Lyrics-userscript/issues/18

Here is the userscripts zip file for your reproduction.

Userscripts.zip

Note: I cannot reproduce the issue from my side as I am using MacOS

wkrick commented 3 months ago

Is the code slow in LZString or is it slow in Greasemonkey? (reference code below)

Maybe when compressed data is passed to GM.setValue() it's triggering an anti-malware security check in Edge (assuming that's actually a thing). Someone will have to strip the code down to a much simpler test case to isolate the actual issue because there's a lot of moving parts.

async function setJV (key, text) {
    if (typeof text === 'object') text = JSON.stringify(text)
    if (typeof text !== 'string') return null
    const z = LZString.compressToUTF16(text) // eslint-disable-line no-undef
    return await custom.GM.setValue(key, z)
 }