Skip to content

Instantly share code, notes, and snippets.

@seiflotfy
Last active February 16, 2016 12:56
Show Gist options
  • Save seiflotfy/41aacbf35294faa162a3 to your computer and use it in GitHub Desktop.
Save seiflotfy/41aacbf35294faa162a3 to your computer and use it in GitHub Desktop.
(pprof) list protobuf
Total: 52MB
ROUTINE ======================== datamodel/protobuf._Skizze_Add_Handler in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/src/datamodel/protobuf/skizze.pb.go
0 52MB (flat, cum) 100% of Total
. . 1052: return out, nil
. . 1053:}
. . 1054:
. . 1055:func _Skizze_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
. . 1056: in := new(AddRequest)
. 52MB 1057: if err := dec(in); err != nil {
. . 1058: return nil, err
. . 1059: }
. . 1060: out, err := srv.(SkizzeServer).Add(ctx, in)
. . 1061: if err != nil {
. . 1062: return nil, err
. . 1063: }
. . 1064: return out, nil
. . 1065:}
ROUTINE ======================== github.com/golang/protobuf/proto.(*Buffer).DecodeStringBytes in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
16.50MB 16.50MB (flat, cum) 31.73% of Total
. . 212:func (p *Buffer) DecodeStringBytes() (s string, err error) {
. . 213: buf, err := p.DecodeRawBytes(false)
. . 214: if err != nil {
. . 215: return
. . 216: }
16.50MB 16.50MB 217: return string(buf), nil
. . 218:}
. . 219:
. . 220:// Skip the next item in the buffer. Its wire type is decoded and presented as an argument.
. . 221:// If the protocol buffer has extensions, and the field matches, add it as an extension.
. . 222:// Otherwise, if the XXX_unrecognized field exists, append the skipped data there.
ROUTINE ======================== github.com/golang/protobuf/proto.(*Buffer).Unmarshal in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
0 52MB (flat, cum) 100% of Total
. . 351: typ, base, err := getbase(pb)
. . 352: if err != nil {
. . 353: return err
. . 354: }
. . 355:
. 52MB 356: err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base)
. . 357:
. . 358: if collectStats {
. . 359: stats.Decode++
. . 360: }
. . 361:
ROUTINE ======================== github.com/golang/protobuf/proto.(*Buffer).dec_slice_string in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
35.50MB 52MB (flat, cum) 100% of Total
. . 684: return nil
. . 685:}
. . 686:
. . 687:// Decode a slice of strings ([]string).
. . 688:func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error {
. 16.50MB 689: s, err := o.DecodeStringBytes()
. . 690: if err != nil {
. . 691: return err
. . 692: }
. . 693: v := structPointer_StringSlice(base, p.field)
35.50MB 35.50MB 694: *v = append(*v, s)
. . 695: return nil
. . 696:}
. . 697:
. . 698:// Decode a slice of slice of bytes ([][]byte).
. . 699:func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error {
ROUTINE ======================== github.com/golang/protobuf/proto.(*Buffer).dec_struct_message in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
0 0 (flat, cum) 0% of Total
. . 797: }
. . 798:
. . 799: bas := structPointer_GetStructPointer(base, p.field)
. . 800: if structPointer_IsNil(bas) {
. . 801: // allocate new nested message
. . 802: bas = toStructPointer(reflect.New(p.stype))
. . 803: structPointer_SetStructPointer(base, p.field, bas)
. . 804: }
. . 805:
. . 806: // If the object can unmarshal itself, let it.
. . 807: if p.isUnmarshaler {
ROUTINE ======================== github.com/golang/protobuf/proto.(*Buffer).unmarshalType in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
0 52MB (flat, cum) 100% of Total
. . 430: } else {
. . 431: err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType)
. . 432: continue
. . 433: }
. . 434: }
. 52MB 435: decErr := dec(o, p, base)
. . 436: if decErr != nil && !state.shouldContinue(decErr, p) {
. . 437: err = decErr
. . 438: }
. . 439: if err == nil && p.Required {
. . 440: // Successfully decoded a required field.
ROUTINE ======================== github.com/golang/protobuf/proto.Unmarshal in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
0 52MB (flat, cum) 100% of Total
. . 299:// Unmarshal resets pb before starting to unmarshal, so any
. . 300:// existing data in pb is always removed. Use UnmarshalMerge
. . 301:// to preserve and append to existing data.
. . 302:func Unmarshal(buf []byte, pb Message) error {
. . 303: pb.Reset()
. 52MB 304: return UnmarshalMerge(buf, pb)
. . 305:}
. . 306:
. . 307:// UnmarshalMerge parses the protocol buffer representation in buf and
. . 308:// writes the decoded result to pb. If the struct underlying pb does not match
. . 309:// the data in buf, the results can be unpredictable.
ROUTINE ======================== github.com/golang/protobuf/proto.UnmarshalMerge in /Users/seif/Projects/go/src/github.com/skizzehq/skizze/vendor/src/github.com/golang/protobuf/proto/decode.go
0 52MB (flat, cum) 100% of Total
. . 313:func UnmarshalMerge(buf []byte, pb Message) error {
. . 314: // If the object can unmarshal itself, let it.
. . 315: if u, ok := pb.(Unmarshaler); ok {
. . 316: return u.Unmarshal(buf)
. . 317: }
. 52MB 318: return NewBuffer(buf).Unmarshal(pb)
. . 319:}
. . 320:
. . 321:// DecodeMessage reads a count-delimited message from the Buffer.
. . 322:func (p *Buffer) DecodeMessage(pb Message) error {
. . 323: enc, err := p.DecodeRawBytes(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment