Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

Core: start yielding control of the main thread

Open dgirardi opened this issue 1 year ago • 9 comments

Type of change

  • [x] Feature

Description of change

  • Make GreedyPromise optional: it can be excluded with gulp build --disable GREEDY and/or overridden with pbjs.Promise = window.Promise (before Prebid loads)
  • Refactor tests so that they can pass on both vanilla and greedy promises

Since promises are already used in many places, "vanilla" promises should have the effect of breaking up long running tasks (https://github.com/prebid/Prebid.js/issues/10062), but they are also potentially breaking - the timing of configuration taking effect, event handlers running, etc all change (relative to when their setup code runs).

The plan is to do some testing and, if necessary, find more tasks to split using promises - so that any such change only affects those that opt out of GreedyPromise.

dgirardi avatar Jul 23 '24 16:07 dgirardi

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 23 '24 16:07 github-actions[bot]

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 23 '24 17:07 github-actions[bot]

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 23 '24 17:07 github-actions[bot]

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 23 '24 17:07 github-actions[bot]

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 24 '24 18:07 github-actions[bot]

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 25 '24 13:07 github-actions[bot]

Tread carefully! This PR adds 1 linter warning (possibly disabled through directives):

  • libraries/consentManagement/cmUtils.js (+1 warning)

github-actions[bot] avatar Jul 25 '24 13:07 github-actions[bot]

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

github-actions[bot] avatar Jul 25 '24 14:07 github-actions[bot]

Hi @dgirardi, are you still committed to move this branch forward?

I just wanted to share that the scheduler.yield Yield method to allow 3Ps or 1P Script led Tasks to Yield while ensuring continuation (so without causing delay into Ad bids auction) is now widely available in Chrome.

I think that may be a good fit for this branch proposal for interested publishers to test it out if applicable.

gilbertococchi avatar Oct 18 '24 16:10 gilbertococchi

Raptive is planning some quantitative tests on this branch in November

patmmccann avatar Nov 04 '24 19:11 patmmccann

Thanks for your answer @patmmccann!

If you have feedback or questions about yield best practices on the Yield I am available to answer those questions.

gilbertococchi avatar Nov 11 '24 13:11 gilbertococchi

It would be interesting to test this improvement. Any news on the progress?

marco-prontera avatar Jan 10 '25 14:01 marco-prontera

It would be interesting to test this improvement. Any news on the progress?

Ironically, we're awaiting people like you to test the branch on live traffic before merging it

patmmccann avatar Feb 20 '25 14:02 patmmccann

This is ready to merge when the conflicts get cleaned up

patmmccann avatar Feb 26 '25 03:02 patmmccann