-
Notifications
You must be signed in to change notification settings - Fork 624
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
suggestion for Unmarshal version 2 #1720
Comments
Hello! Indeed the reflection in gocql.Unmarshal is slow. At kiwi.com, we use https://github.com/scylladb/gocqlx and https://github.com/kiwicom/easycql in production for faster unmarshaling. A better interface directly in gocql would be nice indeed. It is not clear to me how the interface you are proposing looks like. Please provide code samples. Some of the points from my experience: Currently it is not possible to customize the unmarshal behavior without implementing gocql.Unmarshaler on a particular type and customize the mapping between types and unmarshaling function. So the new interface should not have a global type Unmarshaler2 interface {
Unmarshal2(info TypeInfo, data []byte, next Unmarshaler2)
} And we might need to also pass the target value to unmarshal to if the unmarshaling function so that the unmarshaling implementation and type are not coupled. |
Hello! |
After much investigation and remakes i makes this one #1730. |
In #1720 (comment) you suggested:
I have tested various techniques for transferring unmarshal functions. |
To optimize the code, I would suggest considering the process of transferring and preparing data and removing unnecessary actions from there. And to do it so that they can choose how to make row unmarshal.
|
Another point that slows down the current implementation very much - a lot of unnecessary length checks.
Cause 3 can be determined via functional testing. |
For the above reasons, I propose make an interface for rows writers, like io.Writer with specific addons for rows unmarshal.
|
About cql types unmarshal...
|
I was doing another project and i had to look into gocql Unmarshal . And i saw that can do gocql Unmarshal more fast and clear, here description:
Since I considered this from the user's side, I can say that users can be divided into two types:
Currently gocql Unmarshal realizes it through the same path in the code.
That's why, there are a lot of "if", "switch", "reflect" in the code.
Too much uncertainty in what has come and what needs to be given, it`s causes fast clear work to suffer.
Solution - separate paths in code for different user groups needs and shifting the choice point of the Unmarshals path to the stage of define column types or earlier stage.
Approximate solution description:
The amount of changes will not be small, so, i can take to make gocql Unmarshal version 2, if you agree with this described current Unmarshal situation and with solutions concept.
The text was updated successfully, but these errors were encountered: