The optimization of locks in BBQuery
fananchong opened this issue · comments
Can
func (space *Space) BBQuery(bb BB, filter ShapeFilter, f SpaceBBQueryFunc, data interface{}) {
context := BBQueryContext{bb, filter, f}
space.Lock()
space.staticShapes.class.Query(&context, bb, space.bbQuery, data)
space.dynamicShapes.class.Query(&context, bb, space.bbQuery, data)
space.Unlock(true)
}
be optimized to :
func (space *Space) BBQuery(bb BB, filter ShapeFilter, f SpaceBBQueryFunc, data interface{}) {
context := BBQueryContext{bb, filter, f}
space.staticShapes.class.Query(&context, bb, space.bbQuery, data)
space.Lock()
space.dynamicShapes.class.Query(&context, bb, space.bbQuery, data)
space.Unlock(true)
}
Since this is a port, I'd rather not add optimizations unless it's first accepted upstream: