Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use new cid methods for less allocs #17

Merged
merged 2 commits into from
May 2, 2020

Conversation

whyrusleeping
Copy link
Owner

Also wrote a method to write major type headers directly to the io.Writer, I can't figure out how to avoid allocating there, but i'm allocating significantly less ([1]byte instead of [9]byte for most cases).

@@ -14,7 +14,13 @@ const ByteArrayMaxLen = 2 << 20

func doTemplate(w io.Writer, info interface{}, templ string) error {
t := template.Must(template.New("").
Funcs(template.FuncMap{}).Parse(templ))
Funcs(template.FuncMap{
"MajorType": func(wname string, tname string, val string) string {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing this will make changing these things much easier down the road

@whyrusleeping whyrusleeping merged commit 9b070e2 into master May 2, 2020
@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants