0
0
NextJSframework~8 mins

Parallel routes concept in NextJS - Performance & Optimization

Choose your learning style9 modes available
Performance: Parallel routes concept
MEDIUM IMPACT
Parallel routes affect how quickly different parts of a page load and render by allowing multiple UI segments to load simultaneously.
Loading multiple UI sections on a page without blocking each other
NextJS
// File structure:
// app/dashboard/@main/page.tsx     (MainContent)
// app/dashboard/@sidebar/page.tsx  (Sidebar)
// app/dashboard/@footer/page.tsx   (Footer)
// app/dashboard/layout.tsx (below)

import { ReactNode } from 'react';

export default function Layout({
  main,
  sidebar,
  footer
}: {
  main: ReactNode;
  sidebar: ReactNode;
  footer: ReactNode;
}) {
  return (
    <>
      {main}
      {sidebar}
      {footer}
    </>
  );
}
Loads each route segment independently and in parallel, allowing faster rendering of visible content and reducing blocking.
📈 Performance GainReduces LCP by 150-300ms by parallelizing route loading and rendering
Loading multiple UI sections on a page without blocking each other
NextJS
export default function Page() {
  return (
    <>
      <MainContent />
      <Sidebar />
      <Footer />
    </>
  )
}
All components load sequentially in the same route, causing slower overall load and blocking rendering of some parts until others finish.
📉 Performance CostBlocks rendering until all components load, increasing LCP by 200-400ms depending on content size
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
Single route loading all UISingle DOM tree with all nodesMultiple reflows as components mount sequentiallyHigher paint cost due to delayed rendering[X] Bad
Parallel routes loading UI segmentsMultiple smaller DOM trees loaded independentlyFewer reflows per route, can happen concurrentlyLower paint cost with faster visible content[OK] Good
Rendering Pipeline
Parallel routes split the UI into independent segments that the browser can fetch and render simultaneously, reducing blocking in the critical rendering path.
Network Fetch
JavaScript Execution
Layout
Paint
⚠️ BottleneckNetwork Fetch and JavaScript Execution when routes load sequentially
Core Web Vital Affected
LCP
Parallel routes affect how quickly different parts of a page load and render by allowing multiple UI segments to load simultaneously.
Optimization Tips
1Split UI into parallel routes to load multiple parts simultaneously.
2Avoid loading all UI in a single route to prevent blocking and slow LCP.
3Use parallel routes to improve perceived load speed and responsiveness.
Performance Quiz - 3 Questions
Test your performance knowledge
How do parallel routes improve page load performance in Next.js?
ABy loading multiple UI segments at the same time without waiting for others
BBy combining all UI segments into one large bundle
CBy delaying rendering until all data is fetched
DBy disabling JavaScript on the page
DevTools: Performance
How to check: Record a page load and look at the flame chart to see if multiple route segments load and render concurrently or sequentially.
What to look for: Look for overlapping network requests and JavaScript execution for route segments indicating parallel loading, which improves LCP.