-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
normalizeNumbers panic #212
Comments
can we please do 2 changes?
|
Let me think carefully about changing (or adding) the API. Delaying the normalization could introduce undesired overhead due to increasing count of number conversions (e.x. |
Delaying the normalization could affect the package users adding custom internal functions with |
Possible to make it a |
Its not nesesary "delaying".. in some scenarios its opposite - normalisation can be done in advance (caching is done on user side). In our scenario, for example, we have smart cache, which tries to do "best effort".. initially it stores data as messagepack'ed Second good option (and basically even more preferred one) may be to expose modularity is good - why not doing that? if i need ill call. if i dont need - I wont call and save save save ticks!
typically good thing is to have both high level (for beginners/simple use) and lower level available.. we started to demand lower one, and agree to take responsibilities to make it work good.. btw, running 2 PS. @wader - we are now removing usage of |
sorry for such many info here, its actually worth multiple issues at once, all of them are arising when you re trying to make it perform fast, processing thousands and thousands of queries (of same format but with different arguments) per moment in a cloud env - you just want to reuse whatever theoretically can be reused! |
At this moment, I have no good idea to solve this issue without increasing the number of parsing or breaking the custom internal function APIs. Also, I think in the most use case of this package (like gh), only one querying is executed against one input, so I can't imagine specific application that needs to reuse the same input value. |
I actually face the same issue last year when using I just patch JQ, and manually copy However, it creates a lot of memory and increase GC pressure. |
I have pushed an experimental fix for this issue to |
Sorry for such late response. Looks like that fix is working good. We switched to use of |
@itchyny Would |
This issue is blocked by go-yaml/yaml#807. |
It looks like
normalizeNumbers
function is a problem, when unavoidably called from RunWithContextPlease, check out my reproduction example on go.dev
Is there any option to export it and let package user to decide wherever to call it, or not at all?
To rephrase - RunWithContext should be able to perform as a "pure" function - produce output, while never touching user input at all, because you cant know, if its safe to do any modification with it
Can RunWithContext behave as a "copy-on-write" executor, along whole execution path?
The text was updated successfully, but these errors were encountered: