Comments (8)
I do this? https://github.com/planetscale/vitess-types/blob/main/buf.gen.yaml#L8-L22
So I'm not exactly sure what is different in your setup, but you can try to follow how it's working there.
from vtprotobuf.
I added all the:
- pool=github.com/planetscale/vitess-types/gen/vitess/query/dev.Row
- pool=github.com/planetscale/vitess-types/gen/vitess/query/dev.BoundQuery
- pool=github.com/planetscale/vitess-types/gen/vitess/binlogdata/dev.VStreamRowsResponse
- pool=github.com/planetscale/vitess-types/gen/vitess/query/v15.Row
- pool=github.com/planetscale/vitess-types/gen/vitess/query/v15.BoundQuery
- pool=github.com/planetscale/vitess-types/gen/vitess/binlogdata/v15.VStreamRowsResponse
- pool=github.com/planetscale/vitess-types/gen/vitess/query/v16.Row
- pool=github.com/planetscale/vitess-types/gen/vitess/query/v16.BoundQuery
- pool=github.com/planetscale/vitess-types/gen/vitess/binlogdata/v16.VStreamRowsResponse
But still no bueno. I can't use the out gen
part, but since it seems to be rendering everything else, in the file, I'm doubting it is that.
Is there anything I have to add to the proto file itself to enable the pooling feature?
And thanks for helping with this.
from vtprotobuf.
Oh, I see your confusion then. You need to specify in the pool
arguments the types you want to create pools for. :)
from vtprotobuf.
Oh, I see. For some reason I was thinking those were some type of includes that were required, on second look it should have been obvious to me.
Thanks for the help. Out of curiosity, is there a way to specify generating a pool for all protos?
from vtprotobuf.
I don't believe so. You typically don't want it for every possible message type since pooling isn't objectively better.
You can add the vtproto.mempool
annotation as well in your .proto files, as you suggested, which might help you out there. Both of these options should work fine. I will say though, I have never personally used that option, so I'm not sure how it works without reading through the source code. It's likely that might be worth it's own issue.
I'm going to close this issue now though unless there's something I'm missing. :)
from vtprotobuf.
I'm curious why pooling isn't objectively better, or did you mean just not better for sub-protos and not parent objects?
I saw the annotation, but that seemed to generate an error on not know what the option was. I'll look at see if I can figure out what it takes to make that work, maybe checkout the source code myself.
Feel free to close the issue, and again, thanks for your time.
from vtprotobuf.
It's hard to quantify. If it's low frequency objects, pooling is just unnecessary and doesn't add any value. Likely would result in slowdown for objects that never get reuse between GC cycles.
It's just hard to objectively say in every case if it's better or not without profiling. Arguably, if it was objectively better in every situation, we'd use a pool for every object we ever allocate, and that's not true.
Protobufs also tend to a lot of times have difficult to track down lifetimes, so it's often difficult to determine when it's safe to return to the pool after use. This may not be the case for you, but in something like grpc-go, you don't control the lifetime, so using a pool is not really possible.
from vtprotobuf.
Makes sense. As a note, I was looking for it to avoid a tooling problem. buf cli is wrapped in another layer for me (there are no actual buf.yaml files, everything is built dynamically and those files are rendered only for the lifetime of generation). So a little extra pool overhead that may or may not get used isn't a big deal, but I'd have to retool some to do the pool= opt stuff. I'm hoping the annotation might help.
And I get you with the lifetime. Was experimenting with allocating a bunch of protos with the arenas package, but I found that to be a nightmare to track. My takeaway was that an arena needs to belong to a type that never gives access to the arena data without returning a copy, and the object clears the arena on closure.
Thanks again for all the help Matt. Have yourself a good rest of the week.
from vtprotobuf.
Related Issues (20)
- Uncompilable code generated for repeated groups
- Duplicated code generated for GRPC client/server HOT 1
- Panic after WKT commit: assignment to entry in nil map HOT 2
- Extensions are not encoded
- docs/feature: Nested ReturnToVTPool() HOT 4
- bug: oneof field that includes bytes field yields invalid ResetVT method
- Supporting Embedded and Nullable features from gogo proto HOT 2
- bug: Broken ResetVT generation for optional message HOT 1
- bug: grpc client methods does not use qualified idents
- feature: poolable messages paths with wildcard HOT 2
- unmarshal_unsafe feature produced code does not compile: "Cannot use intStringLen (type int) as the type IntegerType" HOT 1
- Run vtproto multiple times on different files of the same package HOT 3
- bug: IsMap not checked on message field's ReturnToVTpool
- bug: UnmarshalUnsafe panics when map values are empty strings HOT 2
- Request for New Release that Includes Well-Known Type Support HOT 4
- gRPC codec has different semantic on Unmarshal than the default one HOT 1
- v0.6.0 is creating issues in ubuntu20 HOT 2
- Offering assistance and discussing upkeep / releases for vtprotobuf HOT 8
- wrong pool unmarshal slize HOT 3
- Add optional unsafe operations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vtprotobuf.