Closed machineko closed 3 months ago
Hey @machineko, thanks for the feedback. If you could debug this somehow, that would be great. I see minimal slowdown on my end. The app uses under 10 MB of RAM and Safari stays snappy.
To that end, though, I haven't really worked on optimization yet, as it is a pre-alpha build. These kinks will be ironed out over time.
EDIT: Sometimes, an app directly built from Xcode is a lot slower due to debugging processes. Can you try to make an archive of the app and open that?
I’ve been trying to figure out why my app isn’t working as expected. I used the archive option to test it, and I also turned on debug options in run mode. I’m not sure if it’s because of the filter list I’m using, or if it’s because I’m on the 15.1 beta version. If you have any ideas on how to debug this, I’d be more than happy to help!
Successfully wrote blockerList.json
Successfully wrote advancedBlocking.json
Attempting to reload content blocker with 112115 rules
Content blocker reloaded successfully with 112115 rules
Successfully wrote AdGuard Base filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Base filter.json
Successfully wrote AdGuard Base filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Base filter_advanced.json
Successfully updated AdGuard Base filter
Successfully wrote AdGuard Tracking Protection filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Tracking Protection filter.json
Successfully wrote AdGuard Tracking Protection filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Tracking Protection filter_advanced.json
Successfully updated AdGuard Tracking Protection filter
Successfully wrote AdGuard Annoyances filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Annoyances filter.json
Successfully wrote AdGuard Annoyances filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Annoyances filter_advanced.json
Successfully updated AdGuard Annoyances filter
Successfully wrote AdGuard Annoyances filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Annoyances filter.json
Successfully wrote AdGuard Annoyances filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Annoyances filter_advanced.json
Successfully updated AdGuard Annoyances filter
Successfully wrote AdGuard Social Media filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Social Media filter.json
Successfully wrote AdGuard Social Media filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Social Media filter_advanced.json
Successfully updated AdGuard Social Media filter
Successfully wrote AdGuard Social Media filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Social Media filter.json
Successfully wrote AdGuard Social Media filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Social Media filter_advanced.json
Successfully updated AdGuard Social Media filter
Successfully wrote Peter Lowe's Blocklist.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/Peter Lowe's Blocklist.json
Successfully updated Peter Lowe's Blocklist
Successfully wrote Peter Lowe's Blocklist.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/Peter Lowe's Blocklist.json
Successfully updated Peter Lowe's Blocklist
Successfully wrote Hagezi Pro mini.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/Hagezi Pro mini.json
Successfully updated Hagezi Pro mini
Successfully wrote Hagezi Pro mini.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/Hagezi Pro mini.json
Successfully updated Hagezi Pro mini
Successfully wrote AdGuard Experimental filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Experimental filter.json
Successfully wrote AdGuard Experimental filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Experimental filter_advanced.json
Successfully updated AdGuard Experimental filter
Successfully wrote blockerList.json
Successfully wrote advancedBlocking.json
Attempting to reload content blocker with 66952 rules
Successfully wrote AdGuard Experimental filter.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Experimental filter.json
Successfully wrote AdGuard Experimental filter_advanced.json to: /Users/dko/Library/Group Containers/group.app.netlify.0xcube.wBlock/AdGuard Experimental filter_advanced.json
Successfully updated AdGuard Experimental filter
Successfully wrote blockerList.json
Successfully wrote advancedBlocking.json
Attempting to reload content blocker with 66952 rules
Content blocker reloaded successfully with 66952 rules
Content blocker reloaded successfully with 66952 rules
This is full log of rules used. Score with vs without
I'm on the 15.1 beta as well on my M2 Pro MacBook Pro. First screenshot is without the extension, second is with. As you can see, it's a margin of error difference.
One thing I've noticed is that sometimes, you have to restart safari for the extension to fully load, and even run the test a few times. Safari is weird that way. Does browsing feel laggy even after doing this?
In terms of debugging, the only thing would be to check concurrency in the code and see if anything can be parallelized. Admittedly, I haven't looked into that yet.
I am at least glad that everything works -- I want to release an alpha build, but unfortunately I do not have a paid developer account, so the extension will not work for other people as it uses the app sandbox. I need to figure out a way to sign my apps; since I'm a broke student at this point, paying $99/year is not in the cards.
I’ve tried running it a few times, and it’s still around 23 in speedometer 3.0. The browser feels slower compared to not running it, but I also noticed that memory usage is increasing with each run. It started at around 44 MB after two runs, and now it’s up to 50 MB. I think there might be a memory leak somewhere?
It's possible. I'll do some analysis. If you have experience with Swift, feel free to check it out too.
Sure will check it later and maybe i find something, also i feel like leak could be in JS code as Swift is pretty good with catching memory leaks and concurrency errors 😅
The JS is all generated by SafariConverterLib, the framework AdGuard uses to convert filter lists to Safari's format. So if it works for them, I doubt there would be an issue with that for me. (though who knows -- adguard is really bad at memory management...)
Sure thing! I’ll try to find it in debug mode if I can. If I do, I’ll either create a pull request or post it here.
Thank you for the help! Ideally, I'll eventually make an alternative to SafariConverterLib that's more modern and (hopefully) lighter-weight, but as a one-man team, I need to take things one step at a time 🤣
https://github.com/user-attachments/assets/fbec1438-a16f-4aa2-a3ea-206639fd2f83
I think I found a potential memory issue, but I can’t seem to pinpoint what’s slowing down the entire browser. Even with the speedometer website’s blocker turned off, the result score is still around 23/24.
The same scripts seem to be loaded every time the website refreshes the HTML or JS (?).
And even turning off the extension in the browser (not even loading the scripts) is killing Safari’s performance. Considering that the Activity Monitor shows 0% CPU usage, it seems like some sort of JavaScript script is the culprit.
I'll check if turning on ADGuard but not running it on the speedometer website is producing same results.
Yup same problems it seems like JS code inside adguard is broken performance are the same for both versions so it is not problem with Swift 🥲
https://github.com/user-attachments/assets/6bd9ab67-ebd0-4e85-b84a-312fc497603e
thanks for this. yeah so it's an adguard problem. A lot of the adguard code is 10+ years old and there is probably a ton of inconsistency, so a leak definitely isn't out of the question. Eventually, the goal is to become independent of SafariConverterLib (the adguard filter list converter), but that would be a much more involved project.
Thanks a bunch for making this an open-source project! It’s awesome at blocking annoying YouTube ads. Are you thinking about making it even faster? I’m on the lookout for an ADGuard replacement because it’s a bit slow and kills the “snappy” feeling of my Safari browser. It seems like your project is also a bit slow, though. For example, turning it on in speedometer drops my M1 Ultra’s score from around 32 to around 23. (I built it with Xcode 16 and release mode.)