-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add pbToJson function #251
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
Conversation
| m = make(map[string]interface{}) | ||
| // This method converts the response from ToProtocolBuffer to an intermediate | ||
| // data structure that can be marshalled to JSON. | ||
| func pbToJson(gr []*graph.Node) map[string][]interface{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func pbToJson should be pbToJSON
| @@ -971,6 +980,38 @@ func BenchmarkToJSON_100_Director(b *testing.B) { benchmarkToJson("benchmark/di | |||
| func BenchmarkToJSON_1000_Actor(b *testing.B) { benchmarkToJson("benchmark/actors1000.bin", b) } | |||
| func BenchmarkToJSON_1000_Director(b *testing.B) { benchmarkToJson("benchmark/directors1000.bin", b) } | |||
|
|
|||
| func benchmarkToJson2(file string, b *testing.B) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func benchmarkToJson2 should be benchmarkToJSON2
|
|
||
| // This method converts the response from ToProtocolBuffer to an intermediate | ||
| // data structure that can be marshalled to JSON. | ||
| func pbToJson(gr []*graph.Node) map[string][]interface{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func pbToJson should be pbToJSON
| @@ -386,6 +386,43 @@ func (sg *SubGraph) ToJSON(l *Latency) ([]byte, error) { | |||
| return nil, fmt.Errorf("Runtime should never reach here.") | |||
| } | |||
|
|
|||
| func (sg *SubGraph) ToJSON2(l *Latency) ([]byte, error) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method SubGraph.ToJSON2 should have comment or be unexported
|
After this change the benchmarks for ToJSON aren't that good https://discuss.dgraph.io/t/adding-a-pbtojson-function/938. Hence decided not to go with this for now. |
Attempt to add a function which can convert the protocol buffer response to a JSON response. This would avoid maintaining both ToJSON and ToProtocolBuffer.
This change is