templ icon indicating copy to clipboard operation
templ copied to clipboard

proposal: would templ generate be faster if it skipped generating files that haven't changed?

Open a-h opened this issue 1 year ago • 1 comments

templ generate is pretty fast. It can generate code for 32 templates in 500ms or so.

Would it be even faster if it only parsed and generated files that have changed instead of doing them all? Or would the effort of maintaining the hash or last updated date of each templ file actually reduce the performance overall?

benchmarks/templ/template.templ complete in 1.027709ms
cmd/templ/lspcmd/httpdebug/list.templ complete in 1.050959ms
cmd/templ/visualize/sourcemapvisualisation.templ complete in 1.000875ms
examples/blog/posts.templ complete in 1.015458ms
examples/hello-world-ssr/hello.templ complete in 253.209µs
# snip...
generator/test-text/template.templ complete in 426.833µs
generator/test-templ-element/template.templ complete in 493.25µs
generator/test-void/template.templ complete in 249.834µs
generator/test-text-whitespace/template.templ complete in 996.5µs
storybook/_example/templates.templ complete in 410.458µs
turbo/stream.templ complete in 399.75µs
Generated code for 32 templates with 0 errors in 470.553625ms

a-h avatar Apr 30 '23 19:04 a-h