A minimal Go template engine focused solely on high-speed placeholder substitution without escaping.
fasttemplate is a specialized template engine for Go designed exclusively for high-speed placeholder substitution. It replaces template tags with user-defined values faster than Go's standard text/template and other string manipulation methods, focusing on performance-critical text generation tasks.
Go developers who need fast, lightweight template rendering for non-HTML contexts like configuration files, code generation, logs, or network protocols where built-in escaping isn't required.
Developers choose fasttemplate for its raw speed and minimal overhead in placeholder substitution, offering up to 10x performance gains over alternatives while maintaining a simple, focused API without the complexity of full-featured template engines.
Simple and fast template engine for Go
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmark results show it performs placeholder substitution significantly faster than text/template and other Go string methods, with up to 10x improvement in execution time.
Optimized to execute with zero memory allocations in many cases, reducing garbage collection overhead and improving performance in high-throughput scenarios.
Focuses exclusively on tag replacement, offering a minimalist interface that's easy to learn and use without the complexity of full-featured engines.
Supports function-based tag processing via ExecuteFunc, allowing for advanced customization and dynamic value generation beyond simple map substitution.
Unlike html/template, it doesn't escape values, so developers must manually escape data to avoid security vulnerabilities, adding overhead and risk.
Lacks built-in features for template logic, such as loops or conditionals, forcing users to implement such logic externally, which can complicate template design.
Using NewTemplate requires explicit error checking for parsing, adding boilerplate code compared to some alternatives that handle errors more seamlessly.