The Priority index rating (PRI) is used by developers to decide whether an asset should be deferred or inlined.
It’s oftentimes difficult to find the perfect balance between loading time and performance when tuning code for loading speed, and this is were the PRI can be useful.
A minimum threshold for PRI needs to be set in order not to break too many resources at once. It can be either set globally or per request based on its type. In general, 0-0.5 is a good value to aim for.
Old browsers like IE7 and 8 are notorious for causing slow-downs. Newer browsers use more modern JIT techniques that can detect what parts of a script are being used to decide which sections should be loaded into memory.
Developers who use PRI question whether an asset should be deferred, inlined or load with high priority (included inline).
Inlining is best when developers need a feature that will only be used once on a page; deferring is best if the asset might only be needed rarely but will still load fast if called; high-priority assets should always be included inline.
The PRI metric is a method of measuring the relative priority of an asset. It’s not a single algorithm or fixed value. Rather, it’s a set of heuristics which can help developers decide whether an asset should be deferred or inlined.
The developer should use runtime profiling tools to check which parts are being executed at the end of each test. The code should be optimized to prevent unnecessary DOM access and reduce the number of elements to be drawn.
The developer will then see whether the inlined scripts adversely affect the user’s experience when used in conjunction with a slow network. This could manifest itself as poor scrolling performance or unacceptably high memory usage.