question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

optimisations for prefetching chunks

See original GitHub issue

Currently dynamic imports include things like routes, error components, and any global components (so if using with @nuxt/content). I am very concerned to decrease HTML and number of prefetched resources but if we simply disable prefetching, sites will seem much slower.

From my point of view, before removing current prefetch behaviour, we need the ability to make some finer-grained decisions.

A set of suggestions:

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:10
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
jshimkoskicommented, Dec 2, 2022

I believe this to be related: https://github.com/nuxt/framework/discussions/9463

As you can see in that discussion, simply removing prefetch tags from my app increases its Lighthouse score by 20%. And I can tell you the app feels and loads faster as well in use.

If developers could gain access to shouldPrefetch and shouldPreload, that would really help in ginormous applications like mine where prefetch actually leads to performance loss instead of gain.

1reaction
pi0commented, Aug 15, 2022

Thanks for explaining your use case @kosmeln. Prefetching is not causing any issue but simply reveals a side-effect issue of not using scoped styles in layouts. Using style prefixes is not a workaround but a proper way to write global styles that ensure they don’t conflict.

I would be more than happy to continue this conversation to investigate different solutions we might provide for this. If you would, please open a discussion and elaborate more about site builder use-case that ends up with dozens of layouts.

BTW in Nuxt 3, we have a much better solution for theming and shared code for multi sites depending on same code base but slight changes. It is called extends.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prefetch - Patterns.dev
Prefetch ( <link rel="prefetch"> ) is a browser optimization which allows us to fetch resources that may be needed for subsequent routes or...
Read more >
Improving Index Performance through Prefetching
This paper proposes and evaluates Prefetching B+-Trees pB+-Trees , which use prefetching to accelerate two im- portant operations on B+-Tree indices: searches ...
Read more >
Front-End Performance 2021: Build Optimizations
Are you using predictive prefetching for JavaScript chunks? We could use heuristics to decide when to preload JavaScript chunks. Guess.js is a ...
Read more >
The Performance Optimization of Threaded Prefetching for ...
Helper threaded prefetching based on Chip Multiprocessor is a well known approach to reducing memory latency and has been explored in linked ...
Read more >
Optimizing Computer Runtime Using Data Prefetching and ...
Most high-level language compilers offer options as to what type of code to generate at compile time. A few options are optimization for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found