Comments (12)
Yep, happy to work on this. Thanks for the pointers. I can't promise anything time wise, heading out for vacations mid next week. I'll post here once I'm actively working on it and making progress.
from facebook-political-ads.
I've pushed a hotfix here: 69d8324
@jeremybmerrill pointed out that we weren't successfully cleaning up all of the observers. Still, I'd love to rework parser.js into something more sane. I'm going to keep this open as a tracking issue.
from facebook-political-ads.
Yep, this is a hard problem right now because of how the parser is written. I think it arises here:
https://github.com/propublica/facebook-political-ads/blob/master/extension/src/parser.js#L221
Which was my way of figuring out how to grab the ad endpoint from facebook's popup. I'd love it if you could take a little time to see if we can scope that selector better so as not to pick up so many changes.
I also think we need to decouple all of the promises in that file so we can test individual functions, which will help with identifying the performance issues/
As far as the chrome thing, I think it has to do with localStorage, and I try and limit the amount of ads we store there to 100, but it still seems too much:
https://github.com/propublica/facebook-political-ads/blob/master/extension/src/utils.js#L50
We could drop it to 20, because it isn't all that important to store all the ads.
Does this sound like something you could help out with?
from facebook-political-ads.
FYI, I'm currently working through a large refactor to make it easier to test the extension, so hold off for now. I'll have something to show tomorrowish.
from facebook-political-ads.
Ha, cool. I had just started looking into the slowness of the popup, but I'll hold off.
Found this, but am not sure it's our problem. https://stackoverflow.com/questions/26276815/my-chrome-extension-popup-opens-after-a-few-seconds-its-slow-compared-to-other
from facebook-political-ads.
this is worth a shot in the meantime: https://stackoverflow.com/a/30164224
from facebook-political-ads.
Yep, that's what I'm gonna try. I guess the idea is that it fools Chrome into leaving the extension running.
from facebook-political-ads.
from facebook-political-ads.
I'm gonna give it a try. Computers do dumb things sometimes.
from facebook-political-ads.
It may be worthwhile to get a lighter version of things rendered, then go get ads from teh server, etc. so something happens right away when you click (even if it's just a loading spinner). Excited to see your refactor.
from facebook-political-ads.
from facebook-political-ads.
var ls_start_time = new Date();
persistedState = deserialize(localStorage.getItem(key));
finalInitialState = merge(initialState, persistedState);
console.log("loaded state from localStorage in ", new Date() - ls_start_time);
It's consistently taking -- on a fresh start of Chrome -- less than 20ms to read from localStorage, usually 4-8ms. With 20 ads stored in there. I don't think localStorage is the problem.
It does take about 150ms to get to the point where it's requesting ads from the server. While that's kind of a lot, impressionistically, the delay is more like 5 seconds.
from facebook-political-ads.
Related Issues (20)
- You have been added to awesome-humane-tech
- Jest complaining about missing key HOT 1
- Want to bring it to Brazil! HOT 1
- Did the ad collector stop working with the new update of Chrome (v66)? HOT 2
- impressions incorrectly set to 0 sometimes
- Classifier data tracking in git leads to large git history HOT 7
- state page combining targeting and candidates HOT 2
- reverse image search via perceptual hashing HOT 8
- new column, parse out "Paid for by" string from ads HOT 2
- classify ads by whether they're persuasive, mobilization, listbuilding or fundraising HOT 3
- Collecting ads in a new country HOT 1
- Add "homepage_url" key to manifest.json? HOT 3
- How is the add-on detecting country location? HOT 1
- ProPublica 1.6.15 extension content does not fit window when in overflow menu HOT 1
- Notifications glitchy closing while browsing pull-down list HOT 2
- Don't put Facebook first in the title
- Addon says I've categorized 0 ads - I think I've done at least 60 HOT 4
- Facebook posts' context menus spontaneously open (and steal my arrow-key-focus) HOT 16
- get political ads filtered by language from ProPublica? HOT 3
- Ads I'm Seeing empty despite seeing ads HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-political-ads.