testhtml

package
v0.2.232 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 4 Imported by: 0

README

templ benchmark

Used to test code generation strategies for improvements to render time.

Tasks

run
go test -bench .

Results

Currently getting the following results which show that using an internal bytes.Buffer within a template could save 25% of time.

To put this in perspective, the React benchmark is hitting 156,735 operations per second.

There are 1,000,000,000 nanoseconds in a second, so this is 6,380 ns per operation, which is 6 times slower than templ.

go test -bench .
goos: darwin
goarch: arm64
pkg: github.com/a-h/templ/benchmarks/templ
BenchmarkCurrent-10              1029445              1153 ns/op            1088 B/op         21 allocs/op
BenchmarkCandidate-10            1419076               845.7 ns/op          1464 B/op         20 allocs/op
BenchmarkIOWriteString-10       14667363                82.41 ns/op          352 B/op          2 allocs/op
PASS
ok      github.com/a-h/templ/benchmarks/templ   5.448s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(p Person) templ.Component

Types

type Person

type Person struct {
	Name  string
	Email string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL