Debian Codegraph @

benchmark/bson_struct.go

raw symbols SCIP
1 // Copyright (C) MongoDB, Inc. 2017-present.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may
4 // not use this file except in compliance with the License. You may obtain
5 // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
7 package benchmarkscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/
8
9 import (
10 "contextscip-go gomod github.com/golang/go/src go1.18 context/"
11 "errorsscip-go gomod github.com/golang/go/src go1.18 errors/"
12
13 "go.mongodb.org/mongo-driver/bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/"
14 )
15
16 func BSONFlatStructDecodingscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/BSONFlatStructDecoding().(_ contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, tm TimerManagerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#, iters int) error {
17 r, err := loadSourceRawscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/loadSourceRaw().(getProjectRootscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/getProjectRoot().(), perfDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/perfDataDir., bsonDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/bsonDataDir., flatBSONDatascip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSONData.)
18 if err != nil {
19 return err
20 }
21
22 tm.ResetTimerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#ResetTimer.()
23
24 for i := 0; i < iters; i++ {
25 out := flatBSONscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSON#{}
26 err := bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/.Unmarshalscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/Unmarshal().(r, &out)
27 if err != nil {
28 return err
29 }
30 }
31 return nil
32 }
33
34 func BSONFlatStructEncodingscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/BSONFlatStructEncoding().(_ contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, tm TimerManagerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#, iters int) error {
35 r, err := loadSourceRawscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/loadSourceRaw().(getProjectRootscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/getProjectRoot().(), perfDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/perfDataDir., bsonDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/bsonDataDir., flatBSONDatascip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSONData.)
36 if err != nil {
37 return err
38 }
39
40 doc := flatBSONscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSON#{}
41 err = bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/.Unmarshalscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/Unmarshal().(r, &doc)
42 if err != nil {
43 return err
44 }
45
46 var buf []byte
47
48 tm.ResetTimerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#ResetTimer.()
49 for i := 0; i < iters; i++ {
50 buf, err = bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/.Marshalscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/Marshal().(doc)
51 if err != nil {
52 return err
53 }
54 if len(buf) == 0 {
55 return errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("encoding failed")
56 }
57 }
58 return nil
59 }
60
61 func BSONFlatStructTagsEncodingscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/BSONFlatStructTagsEncoding().(_ contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, tm TimerManagerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#, iters int) error {
62 r, err := loadSourceRawscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/loadSourceRaw().(getProjectRootscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/getProjectRoot().(), perfDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/perfDataDir., bsonDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/bsonDataDir., flatBSONDatascip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSONData.)
63 if err != nil {
64 return err
65 }
66
67 doc := flatBSONTagsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSONTags#{}
68 err = bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/.Unmarshalscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/Unmarshal().(r, &doc)
69 if err != nil {
70 return err
71 }
72
73 var buf []byte
74
75 tm.ResetTimerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#ResetTimer.()
76 for i := 0; i < iters; i++ {
77 buf, err = bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/.MarshalAppendscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/MarshalAppend().(buf[:0], doc)
78 if err != nil {
79 return err
80 }
81 if len(buf) == 0 {
82 return errorsscip-go gomod github.com/golang/go/src go1.18 errors/.Newscip-go gomod github.com/golang/go/src go1.18 errors/New().("encoding failed")
83 }
84 }
85 return nil
86 }
87
88 func BSONFlatStructTagsDecodingscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/BSONFlatStructTagsDecoding().(_ contextscip-go gomod github.com/golang/go/src go1.18 context/.Contextscip-go gomod github.com/golang/go/src go1.18 context/Context#, tm TimerManagerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#, iters int) error {
89 r, err := loadSourceRawscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/loadSourceRaw().(getProjectRootscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/getProjectRoot().(), perfDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/perfDataDir., bsonDataDirscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/bsonDataDir., flatBSONDatascip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSONData.)
90 if err != nil {
91 return err
92 }
93
94 tm.ResetTimerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/TimerManager#ResetTimer.()
95 for i := 0; i < iters; i++ {
96 out := flatBSONTagsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/benchmark`/flatBSONTags#{}
97 err := bsonscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/.Unmarshalscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/bson`/Unmarshal().(r, &out)
98 if err != nil {
99 return err
100 }
101 }
102 return nil
103 }