-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POC: Tag the code blocks based on features #6079
Conversation
… removeCodeConfig.json we will set some flags in a json and the codes flagged with these flags will be removed if flag is set to true using gulp-remove-code
…n pubmatic bidder
Hello @jsnellbaker , |
Hello @mike-chowla , |
Hello @jsnellbaker , |
Hello @jsnellbaker , @robertrmartinez , @snapwich , @Fawke |
Hello @jsnellbaker , @robertrmartinez , @snapwich , @Fawke , |
@pm-harshad-mane To be honest, I don't know how I feel about this. While the approach could work, I'm not sure how extensible it would be when it's spread across the whole project, especially depending on how many variants/configs we'd plan to support. What combinations/how many were planned? |
Interesting idea, but I think this one needs some discussion. @gglas, please bring up with PBJS group and @patmmccann with the publisher team? The proposal looks to me like being able to slim the size of PBJS packages by mediatype. Unclear to me how many bytes pubs could be practically expected to save or how many bid adapters we're going to get to make these changes. |
Hello @jsnellbaker , @bretg , @patmmccann , @gglas For current PR i have mentioned the Impact in description, posting it here again
I can add tags in most used bidders in incremental commits. Some more stats, I hosted PBJS basic example with only AppNexus bidder (v4.20) here https://pm-harshad-mane.github.io/PBJS/basic.html and Chrome Dev tools shows that pbjs has 62.5% unused code in pbjs.js 97793 bytes un-used out of 156537 bytes. We at PubMatic strongly believe that we need to improve PBJS on download size as it impacts publisher page performance. |
I am coming late to this discussion and I'm not sure if this is all of it, but there's a couple things I'd like to note (@jsnellbaker, @patmmccann):
|
closing this pr as I believe it is now outdated. There are a few ways to approach this though and know it is on the more immediate roadmap. |
Re-opening until there's a link to another issue. |
Opening an issue to track |
Type of change
Problem
Solution
Using https://www.npmjs.com/package/gulp-remove-code plugin, please go thru its small documentation
Introducing removeCodeConfig.json
when above flag is set to true then code like below will be removed in build process before code is minified
Please note that we will also need to tag the respective code references in the file, else code will crash at run-time.
It is bit risky to maintain our code this way but it is easier to do per file/feature basis.
In this PR i have made change for pubmaticBidAdapter.js and core code to support disableNativeRelatedCode and disableOutStreamRelatedCode flags.
disableNativeRelatedCode when set, it will remove native related code from pubmaticBidAdapter and prebid core.
disableOutStreamRelatedCode flag when set, it will remove the OutStream creative rendering related code in pubmatic adapter.
Impact
With flags set, we see 6KB of file size saving in minified final build.
Problems with the approach
Conclusion
It may not be the best solution.
But it is easier to implement considering the code size.