Skip to content

Recover panics, refactor proxy.go, remove {task,msg}Pool

Benjamin Johannes Lohmar requested to merge benny/defer-cleanup into main

This MR contains:

  • recovery from panics if they occur in the client / server readers (#38)
  • slight refactor of gateway/proxy.go: mostly remove some unnecessary indentation, use logging in a way that doesn't interfere with control flow
  • Remove taskPool and msgPool

Concerning the third point: I don't think sync.Pool helped with these two structures at all. They (Task and SIMDServerMessage) are both small structs wrapping Pointers to simdjson.ParsedJson. I expect them to be handled on the stack anyway. I think this change also improves readability quite a bit.

I'm not well versed with how Go's allocations work. I'm sorry if it had already been clear that this actually reduces gc pressure. Otherwise, this looked like premature optimization to me. I'm also sorry I haven't split this into 3 separate commits. I will of course do that if something should be reversed.

Btw, I'll continue with (#45) in the near future

Merge request reports

Loading