Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid creating new time on invalid time token
The parser attempts to parse each string token as time. In case of a non-time token, a time.Now() instance is created, which is immediately discarded. In a tight loop this unnecessary allocation can drastically slow down template parsing. This PR simply returns time's empty value, which does not cause an allocation.
- Loading branch information