-
Notifications
You must be signed in to change notification settings - Fork 60
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
remove append from crypto library #653
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please address the json-related comment 👍
@@ -334,6 +334,7 @@ func GetAuditInfoForIssues(issues [][]byte, metadata []driver.IssueMetadata) ([] | |||
if len(ia.OutputTokens) != len(md.ReceiversAuditInfos) || len(ia.OutputTokens) != len(md.OutputsMetadata) { | |||
return nil, errors.Errorf("number of output does not match number of provided metadata") | |||
} | |||
outputs[k] = make([]*AuditableToken, len(md.ReceiversAuditInfos)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you allocate the array as
outputs[k] = make([]*AuditableToken, 0, len(md.ReceiversAuditInfos))
Then you can keep append
. The above call creates an array of size len(md.ReceiversAuditInfos) and 0 length.
} | ||
return raw, nil | ||
return json.Marshal(raw) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to avoid json here given that it is slow.
What you could do is to obtain the 3 slices you need and then aggregate them by allocating a new slice of size the sum of the 3 slices. Then you can use append.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @adecaro, I will use bytes.Join(raw, separator)
instead. It seems to be fit for purpose.
Signed-off-by: Kaoutar <[email protected]>
Signed-off-by: Kaoutar <[email protected]>
Signed-off-by: Kaoutar <[email protected]>
Signed-off-by: Kaoutar <[email protected]>
Signed-off-by: Kaoutar <[email protected]>
Signed-off-by: Kaoutar <[email protected]>
No description provided.