You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See sample repo. This sample app has a patch on the routesConvention.js file to display run time for route generation, as well as a run.js script that generates a bunch of routes and then runs remix routes. Pass an optional number for the number of route sets to create (each set has 111 routes between index/child routes). For example, node run.js 5 will profile with 5 sets of routes (556 routes including the root route). I nested the sample routes under a couple pathless routes as that seems to also decrease the performance.
# Install and run
npm i
npx patch-package
node run.js 5 | head
Expected Behavior
Ideally, performance would decrease linearly as the number of routes increases.
Actual Behavior
Exponential increase in the time it takes to run. On a fairly powerful Mac, 1 set (112 routes) takes 0.042 seconds to compile, 5 sets (556 routes) takes 3.413 seconds, and 10 sets (1,111 routes) takes 26.797 seconds.
$ node run.js 1 | head
Creating sample routes...
defineConventionalRoutes: 0.042s for 112 routes (0.38ms per file)
<Routes>
<Route file="root.tsx">
<Route path="0/10/0/0" index file="routes/__a/__b/__c/0/10/0/0/index.js" />
<Route path="0/10/0/1" index file="routes/__a/__b/__c/0/10/0/1/index.js" />
<Route path="0/10/1/0" index file="routes/__a/__b/__c/0/10/1/0/index.js" />
<Route path="0/10/1/1" index file="routes/__a/__b/__c/0/10/1/1/index.js" />
<Route path="0/10/2/0" index file="routes/__a/__b/__c/0/10/2/0/index.js" />
<Route path="0/10/2/1" index file="routes/__a/__b/__c/0/10/2/1/index.js" />
$ node run.js 5 | head
Creating sample routes...
defineConventionalRoutes: 3.413s for 556 routes (6.14ms per file)
<Routes>
<Route file="root.tsx">
<Route path="0/10/0/0" index file="routes/__a/__b/__c/0/10/0/0/index.js" />
<Route path="0/10/0/1" index file="routes/__a/__b/__c/0/10/0/1/index.js" />
<Route path="0/10/1/0" index file="routes/__a/__b/__c/0/10/1/0/index.js" />
<Route path="0/10/1/1" index file="routes/__a/__b/__c/0/10/1/1/index.js" />
<Route path="0/10/2/0" index file="routes/__a/__b/__c/0/10/2/0/index.js" />
<Route path="0/10/2/1" index file="routes/__a/__b/__c/0/10/2/1/index.js" />
$ node run.js 10 | head
Creating sample routes...
defineConventionalRoutes: 26.797s for 1111 routes (24.12ms per file)
<Routes>
<Route file="root.tsx">
<Route path="0/10/0/0" index file="routes/__a/__b/__c/0/10/0/0/index.js" />
<Route path="0/10/0/1" index file="routes/__a/__b/__c/0/10/0/1/index.js" />
<Route path="0/10/1/0" index file="routes/__a/__b/__c/0/10/1/0/index.js" />
<Route path="0/10/1/1" index file="routes/__a/__b/__c/0/10/1/1/index.js" />
<Route path="0/10/2/0" index file="routes/__a/__b/__c/0/10/2/0/index.js" />
<Route path="0/10/2/1" index file="routes/__a/__b/__c/0/10/2/1/index.js" />
In my real world app, it's taking around 10-15 seconds to load around 700 routes (this test repo may be operating more efficiently due to short folder/route names versus the longer route paths used in my actual app). Running npm run dev has a significant delay where it seems like nothing is happening, then after 10-15 seconds the "Watching Remix app in development mode..." message finally shows up.
The text was updated successfully, but these errors were encountered:
What version of Remix are you using?
1.7.4
Steps to Reproduce
See sample repo. This sample app has a patch on the
routesConvention.js
file to display run time for route generation, as well as arun.js
script that generates a bunch of routes and then runsremix routes
. Pass an optional number for the number of route sets to create (each set has 111 routes between index/child routes). For example,node run.js 5
will profile with 5 sets of routes (556 routes including the root route). I nested the sample routes under a couple pathless routes as that seems to also decrease the performance.Expected Behavior
Ideally, performance would decrease linearly as the number of routes increases.
Actual Behavior
Exponential increase in the time it takes to run. On a fairly powerful Mac, 1 set (112 routes) takes 0.042 seconds to compile, 5 sets (556 routes) takes 3.413 seconds, and 10 sets (1,111 routes) takes 26.797 seconds.
In my real world app, it's taking around 10-15 seconds to load around 700 routes (this test repo may be operating more efficiently due to short folder/route names versus the longer route paths used in my actual app). Running
npm run dev
has a significant delay where it seems like nothing is happening, then after 10-15 seconds the "Watching Remix app in development mode..." message finally shows up.The text was updated successfully, but these errors were encountered: