You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default code generation generates a NewXXXLogic inside the handler, which then calls the relevant methods. Why not just generate a func to call it instead of creating a new object. In highly concurrent scenarios, the creation of such a new object without adding sync.pool is likely to result in additional memory requests and destruction, which would not occur if the func was used directly.
The text was updated successfully, but these errors were encountered:
Recommend to use sync.Pool only when you really need it.
The core of my question is not sync.Pool, but why the design should use oop instead of func, so there will be some performance loss, is not it? And here the struct is not a transaction that must exist, because the design itself has been designed for the monolithic service scenario to do the design of the sub-package, and for micro-services, the function is the service, there is no need to use the struct. I'm trying to understand what special considerations are involved in using such a complex technical solution that I hadn't considered before.
The default code generation generates a
NewXXXLogic
inside the handler, which then calls the relevant methods. Why not just generate a func to call it instead of creating a new object. In highly concurrent scenarios, the creation of such a new object without adding sync.pool is likely to result in additional memory requests and destruction, which would not occur if the func was used directly.The text was updated successfully, but these errors were encountered: