mirror of https://github.com/gophish/gophish
546da4ee7d
As mentioned in #1702, the query in `insertTargetIntoGroup` isn't needed, since both instances where it's used we already know that the target isn't in the group. This means it's safe to remove that query, improving performance dramatically. Before: ``` BenchmarkPostGroup100-4 81 12629754 ns/op 2989993 B/op 52918 allocs/op BenchmarkPostGroup1000-4 6 189527792 ns/op 29891818 B/op 528082 allocs/op BenchmarkPostGroup10000-4 1 6203645806 ns/op 299253648 B/op 5282859 allocs/op BenchmarkPutGroup100-4 100 10221833 ns/op 2589165 B/op 46078 allocs/op BenchmarkPutGroup1000-4 7 162692432 ns/op 25812440 B/op 458425 allocs/op BenchmarkPutGroup10000-4 1 7596445084 ns/op 260385808 B/op 4581569 allocs/op ``` After: ``` BenchmarkPostGroup100-4 133 8848973 ns/op 2354605 B/op 42322 allocs/op BenchmarkPostGroup1000-4 9 112557410 ns/op 23549206 B/op 422184 allocs/op BenchmarkPostGroup10000-4 1 3414209403 ns/op 235635952 B/op 4222090 allocs/op BenchmarkPutGroup100-4 147 8094333 ns/op 2271297 B/op 40777 allocs/op BenchmarkPutGroup1000-4 9 125092124 ns/op 22635067 B/op 405421 allocs/op BenchmarkPutGroup10000-4 1 5712591900 ns/op 228592920 B/op 4051316 allocs/op ``` |
||
---|---|---|
.. | ||
attachment.go | ||
campaign.go | ||
campaign_test.go | ||
doc.go | ||
email_request.go | ||
email_request_test.go | ||
group.go | ||
group_test.go | ||
maillog.go | ||
maillog_test.go | ||
models.go | ||
models_test.go | ||
page.go | ||
page_test.go | ||
rbac.go | ||
rbac_test.go | ||
result.go | ||
result_test.go | ||
smtp.go | ||
smtp_test.go | ||
template.go | ||
template_context.go | ||
template_context_test.go | ||
user.go | ||
user_test.go | ||
webhook.go |