Replies: 7 comments
-
Some profiling suggests a major cause is large files in dependencies taking up a lot of time in a vite function called There's a few other fat time sinks like svelte file compilation (~1.7s) - 170 files are compiled when the dev server is started, so we should figure out if there's a way to avoid that. |
Beta Was this translation helpful? Give feedback.
-
Can't actually see these images, |
Beta Was this translation helpful? Give feedback.
-
Whoops, updated |
Beta Was this translation helpful? Give feedback.
-
I'm looking through vite config for something else and stumbled upon this warmup option - sharing in case it's useful here: |
Beta Was this translation helpful? Give feedback.
-
Yeah seems like that helps move the heavy bits to the start of the dev server instead of later in, but the end result is the same |
Beta Was this translation helpful? Give feedback.
-
@csjh what was your rough profiling setup to get these measurements? |
Beta Was this translation helpful? Give feedback.
-
@archiewood I've been modifying Basically just go in that file and replace session.post('Profiler.enable', () => {
session.post('Profiler.start', start)
}) (located near the bottom) with session.post('Profiler.enable', () => {
session.post('Profiler.start', start)
setTimeout(() => {
session.post('Profiler.stop', async (err, { profile }) => {
if (err) {
console.error(err)
process.exit(1)
}
const fs = await import('node:fs')
const path = await import('node:path')
const filename = path.resolve(process.cwd(), 'v8-profile.cpuprofile')
fs.writeFileSync(filename, JSON.stringify(profile))
console.log(`Profile written to ${filename}`)
process.exit(0)
})
}, 20000);
}) and run vite with the |
Beta Was this translation helpful? Give feedback.
-
npm run dev takes a lot longer to get to a live app than a bare sveltekit app does. In addition to #922, improving this would do a lot for the initial experience of trying out evidence, and for my own day to day experience of using it.
Beta Was this translation helpful? Give feedback.
All reactions