| 1 | From: Sascha Steinbiss <[email protected]> |
| 2 | Date: Tue, 14 Mar 2017 17:42:02 +0100 |
| 3 | Subject: remove benchmark code |
| 4 | |
| 5 | --- |
| 6 | benchmark/benchmark.go | 181 -- |
| 7 | benchmark/benchmark_codecgen.go | 3170 ---------------------------- |
| 8 | benchmark/benchmark_easyjson.go | 701 ------ |
| 9 | benchmark/benchmark_ffjson.go | 3141 --------------------------- |
| 10 | benchmark/benchmark_large_payload_test.go | 131 -- |
| 11 | benchmark/benchmark_medium_payload_test.go | 339 --- |
| 12 | benchmark/benchmark_small_payload_test.go | 293 --- |
| 13 | 7 files changed, 7956 deletions(-) |
| 14 | delete mode 100644 benchmark/benchmark.go |
| 15 | delete mode 100644 benchmark/benchmark_codecgen.go |
| 16 | delete mode 100644 benchmark/benchmark_easyjson.go |
| 17 | delete mode 100644 benchmark/benchmark_ffjson.go |
| 18 | delete mode 100644 benchmark/benchmark_large_payload_test.go |
| 19 | delete mode 100644 benchmark/benchmark_medium_payload_test.go |
| 20 | delete mode 100644 benchmark/benchmark_small_payload_test.go |
| 21 | |
| 22 | --- a/benchmark/benchmark.go |
| 23 | +++ /dev/null |
| 24 | @@ -1,181 +0,0 @@ |
| 25 | -package benchmark |
| 26 | - |
| 27 | -/* |
| 28 | -Small paylod, http log like structure. Size: 190 bytes |
| 29 | -*/ |
| 30 | -var smallFixture []byte = []byte(`{ |
| 31 | - "st": 1, |
| 32 | - "sid": 486, |
| 33 | - "tt": "active", |
| 34 | - "gr": 0, |
| 35 | - "uuid": "de305d54-75b4-431b-adb2-eb6b9e546014", |
| 36 | - "ip": "127.0.0.1", |
| 37 | - "ua": "user_agent", |
| 38 | - "tz": -6, |
| 39 | - "v": 1 |
| 40 | -}`) |
| 41 | - |
| 42 | -type SmallPayload struct { |
| 43 | - St int |
| 44 | - Sid int |
| 45 | - Tt string |
| 46 | - Gr int |
| 47 | - Uuid string |
| 48 | - Ip string |
| 49 | - Ua string |
| 50 | - Tz int |
| 51 | - V int |
| 52 | -} |
| 53 | - |
| 54 | -/* |
| 55 | -Medium payload (based on Clearbit API response) |
| 56 | -*/ |
| 57 | -type CBAvatar struct { |
| 58 | - Url string |
| 59 | -} |
| 60 | - |
| 61 | -type CBGravatar struct { |
| 62 | - Avatars []*CBAvatar |
| 63 | -} |
| 64 | - |
| 65 | -type CBGithub struct { |
| 66 | - Followers int |
| 67 | -} |
| 68 | - |
| 69 | -type CBName struct { |
| 70 | - FullName string |
| 71 | -} |
| 72 | - |
| 73 | -type CBPerson struct { |
| 74 | - Name *CBName |
| 75 | - Github *CBGithub |
| 76 | - Gravatar *CBGravatar |
| 77 | -} |
| 78 | - |
| 79 | -type MediumPayload struct { |
| 80 | - Person *CBPerson |
| 81 | - Company map[string]interface{} |
| 82 | -} |
| 83 | - |
| 84 | -// Reponse from Clearbit API. Size: 2.4kb |
| 85 | -var mediumFixture []byte = []byte(`{ |
| 86 | - "person": { |
| 87 | - "id": "d50887ca-a6ce-4e59-b89f-14f0b5d03b03", |
| 88 | - "name": { |
| 89 | - "fullName": "Leonid Bugaev", |
| 90 | - "givenName": "Leonid", |
| 91 | - "familyName": "Bugaev" |
| 92 | - }, |
| 93 | - "email": "[email protected]", |
| 94 | - "gender": "male", |
| 95 | - "location": "Saint Petersburg, Saint Petersburg, RU", |
| 96 | - "geo": { |
| 97 | - "city": "Saint Petersburg", |
| 98 | - "state": "Saint Petersburg", |
| 99 | - "country": "Russia", |
| 100 | - "lat": 59.9342802, |
| 101 | - "lng": 30.3350986 |
| 102 | - }, |
| 103 | - "bio": "Senior engineer at Granify.com", |
| 104 | - "site": "http://flickfaver.com", |
| 105 | - "avatar": "https://d1ts43dypk8bqh.cloudfront.net/v1/avatars/d50887ca-a6ce-4e59-b89f-14f0b5d03b03", |
| 106 | - "employment": { |
| 107 | - "name": "www.latera.ru", |
| 108 | - "title": "Software Engineer", |
| 109 | - "domain": "gmail.com" |
| 110 | - }, |
| 111 | - "facebook": { |
| 112 | - "handle": "leonid.bugaev" |
| 113 | - }, |
| 114 | - "github": { |
| 115 | - "handle": "buger", |
| 116 | - "id": 14009, |
| 117 | - "avatar": "https://avatars.githubusercontent.com/u/14009?v=3", |
| 118 | - "company": "Granify", |
| 119 | - "blog": "http://leonsbox.com", |
| 120 | - "followers": 95, |
| 121 | - "following": 10 |
| 122 | - }, |
| 123 | - "twitter": { |
| 124 | - "handle": "flickfaver", |
| 125 | - "id": 77004410, |
| 126 | - "bio": null, |
| 127 | - "followers": 2, |
| 128 | - "following": 1, |
| 129 | - "statuses": 5, |
| 130 | - "favorites": 0, |
| 131 | - "location": "", |
| 132 | - "site": "http://flickfaver.com", |
| 133 | - "avatar": null |
| 134 | - }, |
| 135 | - "linkedin": { |
| 136 | - "handle": "in/leonidbugaev" |
| 137 | - }, |
| 138 | - "googleplus": { |
| 139 | - "handle": null |
| 140 | - }, |
| 141 | - "angellist": { |
| 142 | - "handle": "leonid-bugaev", |
| 143 | - "id": 61541, |
| 144 | - "bio": "Senior engineer at Granify.com", |
| 145 | - "blog": "http://buger.github.com", |
| 146 | - "site": "http://buger.github.com", |
| 147 | - "followers": 41, |
| 148 | - "avatar": "https://d1qb2nb5cznatu.cloudfront.net/users/61541-medium_jpg?1405474390" |
| 149 | - }, |
| 150 | - "klout": { |
| 151 | - "handle": null, |
| 152 | - "score": null |
| 153 | - }, |
| 154 | - "foursquare": { |
| 155 | - "handle": null |
| 156 | - }, |
| 157 | - "aboutme": { |
| 158 | - "handle": "leonid.bugaev", |
| 159 | - "bio": null, |
| 160 | - "avatar": null |
| 161 | - }, |
| 162 | - "gravatar": { |
| 163 | - "handle": "buger", |
| 164 | - "urls": [ |
| 165 | - |
| 166 | - ], |
| 167 | - "avatar": "http://1.gravatar.com/avatar/f7c8edd577d13b8930d5522f28123510", |
| 168 | - "avatars": [ |
| 169 | - { |
| 170 | - "url": "http://1.gravatar.com/avatar/f7c8edd577d13b8930d5522f28123510", |
| 171 | - "type": "thumbnail" |
| 172 | - } |
| 173 | - ] |
| 174 | - }, |
| 175 | - "fuzzy": false |
| 176 | - }, |
| 177 | - "company": null |
| 178 | -}`) |
| 179 | - |
| 180 | -/* |
| 181 | - Large payload, based on Discourse API. Size: 28kb |
| 182 | -*/ |
| 183 | - |
| 184 | -type DSUser struct { |
| 185 | - Username string |
| 186 | -} |
| 187 | - |
| 188 | -type DSTopic struct { |
| 189 | - Id int |
| 190 | - Slug string |
| 191 | -} |
| 192 | - |
| 193 | -type DSTopicsList struct { |
| 194 | - Topics []*DSTopic |
| 195 | - MoreTopicsUrl string |
| 196 | -} |
| 197 | - |
| 198 | -type LargePayload struct { |
| 199 | - Users []*DSUser |
| 200 | - Topics *DSTopicsList |
| 201 | -} |
| 202 | - |
| 203 | -var largeFixture []byte = []byte(` |
| 204 | - {"users":[{"id":-1,"username":"system","avatar_template":"/user_avatar/discourse.metabase.com/system/{size}/6_1.png"},{"id":89,"username":"zergot","avatar_template":"https://avatars.discourse.org/v2/letter/z/0ea827/{size}.png"},{"id":1,"username":"sameer","avatar_template":"https://avatars.discourse.org/v2/letter/s/bbce88/{size}.png"},{"id":84,"username":"HenryMirror","avatar_template":"https://avatars.discourse.org/v2/letter/h/ecd19e/{size}.png"},{"id":73,"username":"fimp","avatar_template":"https://avatars.discourse.org/v2/letter/f/ee59a6/{size}.png"},{"id":14,"username":"agilliland","avatar_template":"/user_avatar/discourse.metabase.com/agilliland/{size}/26_1.png"},{"id":87,"username":"amir","avatar_template":"https://avatars.discourse.org/v2/letter/a/c37758/{size}.png"},{"id":82,"username":"waseem","avatar_template":"https://avatars.discourse.org/v2/letter/w/9dc877/{size}.png"},{"id":78,"username":"tovenaar","avatar_template":"https://avatars.discourse.org/v2/letter/t/9de0a6/{size}.png"},{"id":74,"username":"Ben","avatar_template":"https://avatars.discourse.org/v2/letter/b/df788c/{size}.png"},{"id":71,"username":"MarkLaFay","avatar_template":"https://avatars.discourse.org/v2/letter/m/3bc359/{size}.png"},{"id":72,"username":"camsaul","avatar_template":"/user_avatar/discourse.metabase.com/camsaul/{size}/70_1.png"},{"id":53,"username":"mhjb","avatar_template":"/user_avatar/discourse.metabase.com/mhjb/{size}/54_1.png"},{"id":58,"username":"jbwiv","avatar_template":"https://avatars.discourse.org/v2/letter/j/6bbea6/{size}.png"},{"id":70,"username":"Maggs","avatar_template":"https://avatars.discourse.org/v2/letter/m/bbce88/{size}.png"},{"id":69,"username":"andrefaria","avatar_template":"/user_avatar/discourse.metabase.com/andrefaria/{size}/65_1.png"},{"id":60,"username":"bencarter78","avatar_template":"/user_avatar/discourse.metabase.com/bencarter78/{size}/59_1.png"},{"id":55,"username":"vikram","avatar_template":"https://avatars.discourse.org/v2/letter/v/e47774/{size}.png"},{"id":68,"username":"edchan77","avatar_template":"/user_avatar/discourse.metabase.com/edchan77/{size}/66_1.png"},{"id":9,"username":"karthikd","avatar_template":"https://avatars.discourse.org/v2/letter/k/cab0a1/{size}.png"},{"id":23,"username":"arthurz","avatar_template":"/user_avatar/discourse.metabase.com/arthurz/{size}/32_1.png"},{"id":3,"username":"tom","avatar_template":"/user_avatar/discourse.metabase.com/tom/{size}/21_1.png"},{"id":50,"username":"LeoNogueira","avatar_template":"/user_avatar/discourse.metabase.com/leonogueira/{size}/52_1.png"},{"id":66,"username":"ss06vi","avatar_template":"https://avatars.discourse.org/v2/letter/s/3ab097/{size}.png"},{"id":34,"username":"mattcollins","avatar_template":"/user_avatar/discourse.metabase.com/mattcollins/{size}/41_1.png"},{"id":51,"username":"krmmalik","avatar_template":"/user_avatar/discourse.metabase.com/krmmalik/{size}/53_1.png"},{"id":46,"username":"odysseas","avatar_template":"https://avatars.discourse.org/v2/letter/o/5f8ce5/{size}.png"},{"id":5,"username":"jonthewayne","avatar_template":"/user_avatar/discourse.metabase.com/jonthewayne/{size}/18_1.png"},{"id":11,"username":"anandiyer","avatar_template":"/user_avatar/discourse.metabase.com/anandiyer/{size}/23_1.png"},{"id":25,"username":"alnorth","avatar_template":"/user_avatar/discourse.metabase.com/alnorth/{size}/34_1.png"},{"id":52,"username":"j_at_svg","avatar_template":"https://avatars.discourse.org/v2/letter/j/96bed5/{size}.png"},{"id":42,"username":"styts","avatar_template":"/user_avatar/discourse.metabase.com/styts/{size}/47_1.png"}],"topics":{"can_create_topic":false,"more_topics_url":"/c/uncategorized/l/latest?page=1","draft":null,"draft_key":"new_topic","draft_sequence":null,"per_page":30,"topics":[{"id":8,"title":"Welcome to Metabase's Discussion Forum","fancy_title":"Welcome to Metabase’s Discussion Forum","slug":"welcome-to-metabases-discussion-forum","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":"/images/welcome/discourse-edit-post-animated.gif","created_at":"2015-10-17T00:14:49.526Z","last_posted_at":"2015-10-17T00:14:49.557Z","bumped":true,"bumped_at":"2015-10-21T02:32:22.486Z","unseen":false,"pinned":true,"unpinned":null,"excerpt":"Welcome to Metabase's discussion forum. This is a place to get help on installation, setting up as well as sharing tips and tricks.","visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":197,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"system","category_id":1,"pinned_globally":true,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":-1}]},{"id":169,"title":"Formatting Dates","fancy_title":"Formatting Dates","slug":"formatting-dates","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2016-01-14T06:30:45.311Z","last_posted_at":"2016-01-14T06:30:45.397Z","bumped":true,"bumped_at":"2016-01-14T06:30:45.397Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":11,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"zergot","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":89}]},{"id":168,"title":"Setting for google api key","fancy_title":"Setting for google api key","slug":"setting-for-google-api-key","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2016-01-13T17:14:31.799Z","last_posted_at":"2016-01-14T06:24:03.421Z","bumped":true,"bumped_at":"2016-01-14T06:24:03.421Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":16,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"zergot","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":89}]},{"id":167,"title":"Cannot see non-US timezones on the admin","fancy_title":"Cannot see non-US timezones on the admin","slug":"cannot-see-non-us-timezones-on-the-admin","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2016-01-13T17:07:36.764Z","last_posted_at":"2016-01-13T17:07:36.831Z","bumped":true,"bumped_at":"2016-01-13T17:07:36.831Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":11,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"zergot","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":89}]},{"id":164,"title":"External (Metabase level) linkages in data schema","fancy_title":"External (Metabase level) linkages in data schema","slug":"external-metabase-level-linkages-in-data-schema","posts_count":4,"reply_count":1,"highest_post_number":4,"image_url":null,"created_at":"2016-01-11T13:51:02.286Z","last_posted_at":"2016-01-12T11:06:37.259Z","bumped":true,"bumped_at":"2016-01-12T11:06:37.259Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":32,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"zergot","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":89},{"extras":null,"description":"Frequent Poster","user_id":1}]},{"id":155,"title":"Query working on \"Questions\" but not in \"Pulses\"","fancy_title":"Query working on “Questions” but not in “Pulses”","slug":"query-working-on-questions-but-not-in-pulses","posts_count":3,"reply_count":0,"highest_post_number":3,"image_url":null,"created_at":"2016-01-01T14:06:10.083Z","last_posted_at":"2016-01-08T22:37:51.772Z","bumped":true,"bumped_at":"2016-01-08T22:37:51.772Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":72,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"agilliland","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":84},{"extras":null,"description":"Frequent Poster","user_id":73},{"extras":"latest","description":"Most Recent Poster","user_id":14}]},{"id":161,"title":"Pulses posted to Slack don't show question output","fancy_title":"Pulses posted to Slack don’t show question output","slug":"pulses-posted-to-slack-dont-show-question-output","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":"/uploads/default/original/1X/9d2806517bf3598b10be135b2c58923b47ba23e7.png","created_at":"2016-01-08T22:09:58.205Z","last_posted_at":"2016-01-08T22:28:44.685Z","bumped":true,"bumped_at":"2016-01-08T22:28:44.685Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":34,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":87},{"extras":"latest","description":"Most Recent Poster","user_id":1}]},{"id":152,"title":"Should we build Kafka connecter or Kafka plugin","fancy_title":"Should we build Kafka connecter or Kafka plugin","slug":"should-we-build-kafka-connecter-or-kafka-plugin","posts_count":4,"reply_count":1,"highest_post_number":4,"image_url":null,"created_at":"2015-12-28T20:37:23.501Z","last_posted_at":"2015-12-31T18:16:45.477Z","bumped":true,"bumped_at":"2015-12-31T18:16:45.477Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":84,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":82},{"extras":"latest","description":"Most Recent Poster, Frequent Poster","user_id":1}]},{"id":147,"title":"Change X and Y on graph","fancy_title":"Change X and Y on graph","slug":"change-x-and-y-on-graph","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2015-12-21T17:52:46.581Z","last_posted_at":"2015-12-21T17:52:46.684Z","bumped":true,"bumped_at":"2015-12-21T18:19:13.003Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":68,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"tovenaar","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":78}]},{"id":142,"title":"Issues sending mail via office365 relay","fancy_title":"Issues sending mail via office365 relay","slug":"issues-sending-mail-via-office365-relay","posts_count":5,"reply_count":2,"highest_post_number":5,"image_url":null,"created_at":"2015-12-16T10:38:47.315Z","last_posted_at":"2015-12-21T09:26:27.167Z","bumped":true,"bumped_at":"2015-12-21T09:26:27.167Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":122,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"Ben","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":74},{"extras":null,"description":"Frequent Poster","user_id":1}]},{"id":137,"title":"I see triplicates of my mongoDB collections","fancy_title":"I see triplicates of my mongoDB collections","slug":"i-see-triplicates-of-my-mongodb-collections","posts_count":3,"reply_count":0,"highest_post_number":3,"image_url":null,"created_at":"2015-12-14T13:33:03.426Z","last_posted_at":"2015-12-17T18:40:05.487Z","bumped":true,"bumped_at":"2015-12-17T18:40:05.487Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":97,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"MarkLaFay","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":71},{"extras":null,"description":"Frequent Poster","user_id":14}]},{"id":140,"title":"Google Analytics plugin","fancy_title":"Google Analytics plugin","slug":"google-analytics-plugin","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2015-12-15T13:00:55.644Z","last_posted_at":"2015-12-15T13:00:55.705Z","bumped":true,"bumped_at":"2015-12-15T13:00:55.705Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":105,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"fimp","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":73}]},{"id":138,"title":"With-mongo-connection failed: bad connection details:","fancy_title":"With-mongo-connection failed: bad connection details:","slug":"with-mongo-connection-failed-bad-connection-details","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2015-12-14T17:28:11.041Z","last_posted_at":"2015-12-14T17:28:11.111Z","bumped":true,"bumped_at":"2015-12-14T17:28:11.111Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":56,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"MarkLaFay","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":71}]},{"id":133,"title":"\"We couldn't understand your question.\" when I query mongoDB","fancy_title":"“We couldn’t understand your question.” when I query mongoDB","slug":"we-couldnt-understand-your-question-when-i-query-mongodb","posts_count":3,"reply_count":0,"highest_post_number":3,"image_url":null,"created_at":"2015-12-11T17:38:30.576Z","last_posted_at":"2015-12-14T13:31:26.395Z","bumped":true,"bumped_at":"2015-12-14T13:31:26.395Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":107,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"MarkLaFay","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":71},{"extras":null,"description":"Frequent Poster","user_id":72}]},{"id":129,"title":"My bar charts are all thin","fancy_title":"My bar charts are all thin","slug":"my-bar-charts-are-all-thin","posts_count":4,"reply_count":1,"highest_post_number":4,"image_url":"/uploads/default/original/1X/41bcf3b2a00dc7cfaff01cb3165d35d32a85bf1d.png","created_at":"2015-12-09T22:09:56.394Z","last_posted_at":"2015-12-11T19:00:45.289Z","bumped":true,"bumped_at":"2015-12-11T19:00:45.289Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":116,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"mhjb","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":53},{"extras":null,"description":"Frequent Poster","user_id":1}]},{"id":106,"title":"What is the expected return order of columns for graphing results when using raw SQL?","fancy_title":"What is the expected return order of columns for graphing results when using raw SQL?","slug":"what-is-the-expected-return-order-of-columns-for-graphing-results-when-using-raw-sql","posts_count":3,"reply_count":0,"highest_post_number":3,"image_url":null,"created_at":"2015-11-24T19:07:14.561Z","last_posted_at":"2015-12-11T17:04:14.149Z","bumped":true,"bumped_at":"2015-12-11T17:04:14.149Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":153,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"jbwiv","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":58},{"extras":null,"description":"Frequent Poster","user_id":14}]},{"id":131,"title":"Set site url from admin panel","fancy_title":"Set site url from admin panel","slug":"set-site-url-from-admin-panel","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2015-12-10T06:22:46.042Z","last_posted_at":"2015-12-10T19:12:57.449Z","bumped":true,"bumped_at":"2015-12-10T19:12:57.449Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":77,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":70},{"extras":"latest","description":"Most Recent Poster","user_id":1}]},{"id":127,"title":"Internationalization (i18n)","fancy_title":"Internationalization (i18n)","slug":"internationalization-i18n","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2015-12-08T16:55:37.397Z","last_posted_at":"2015-12-09T16:49:55.816Z","bumped":true,"bumped_at":"2015-12-09T16:49:55.816Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":85,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"agilliland","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":69},{"extras":"latest","description":"Most Recent Poster","user_id":14}]},{"id":109,"title":"Returning raw data with no filters always returns We couldn't understand your question","fancy_title":"Returning raw data with no filters always returns We couldn’t understand your question","slug":"returning-raw-data-with-no-filters-always-returns-we-couldnt-understand-your-question","posts_count":3,"reply_count":1,"highest_post_number":3,"image_url":null,"created_at":"2015-11-25T21:35:01.315Z","last_posted_at":"2015-12-09T10:26:12.255Z","bumped":true,"bumped_at":"2015-12-09T10:26:12.255Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":133,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"bencarter78","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":60},{"extras":null,"description":"Frequent Poster","user_id":14}]},{"id":103,"title":"Support for Cassandra?","fancy_title":"Support for Cassandra?","slug":"support-for-cassandra","posts_count":5,"reply_count":1,"highest_post_number":5,"image_url":null,"created_at":"2015-11-20T06:45:31.741Z","last_posted_at":"2015-12-09T03:18:51.274Z","bumped":true,"bumped_at":"2015-12-09T03:18:51.274Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":169,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"vikram","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":55},{"extras":null,"description":"Frequent Poster","user_id":1}]},{"id":128,"title":"Mongo query with Date breaks [solved: Mongo 3.0 required]","fancy_title":"Mongo query with Date breaks [solved: Mongo 3.0 required]","slug":"mongo-query-with-date-breaks-solved-mongo-3-0-required","posts_count":5,"reply_count":0,"highest_post_number":5,"image_url":null,"created_at":"2015-12-08T18:30:56.562Z","last_posted_at":"2015-12-08T21:03:02.421Z","bumped":true,"bumped_at":"2015-12-08T21:03:02.421Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":102,"like_count":1,"has_summary":false,"archetype":"regular","last_poster_username":"edchan77","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":68},{"extras":null,"description":"Frequent Poster","user_id":1}]},{"id":23,"title":"Can this connect to MS SQL Server?","fancy_title":"Can this connect to MS SQL Server?","slug":"can-this-connect-to-ms-sql-server","posts_count":7,"reply_count":1,"highest_post_number":7,"image_url":null,"created_at":"2015-10-21T18:52:37.987Z","last_posted_at":"2015-12-07T17:41:51.609Z","bumped":true,"bumped_at":"2015-12-07T17:41:51.609Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":367,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":9},{"extras":null,"description":"Frequent Poster","user_id":23},{"extras":null,"description":"Frequent Poster","user_id":3},{"extras":null,"description":"Frequent Poster","user_id":50},{"extras":"latest","description":"Most Recent Poster","user_id":1}]},{"id":121,"title":"Cannot restart metabase in docker","fancy_title":"Cannot restart metabase in docker","slug":"cannot-restart-metabase-in-docker","posts_count":5,"reply_count":1,"highest_post_number":5,"image_url":null,"created_at":"2015-12-04T21:28:58.137Z","last_posted_at":"2015-12-04T23:02:00.488Z","bumped":true,"bumped_at":"2015-12-04T23:02:00.488Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":96,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":66},{"extras":"latest","description":"Most Recent Poster, Frequent Poster","user_id":1}]},{"id":85,"title":"Edit Max Rows Count","fancy_title":"Edit Max Rows Count","slug":"edit-max-rows-count","posts_count":4,"reply_count":2,"highest_post_number":4,"image_url":null,"created_at":"2015-11-11T23:46:52.917Z","last_posted_at":"2015-11-24T01:01:14.569Z","bumped":true,"bumped_at":"2015-11-24T01:01:14.569Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":169,"like_count":1,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":34},{"extras":"latest","description":"Most Recent Poster, Frequent Poster","user_id":1}]},{"id":96,"title":"Creating charts by querying more than one table at a time","fancy_title":"Creating charts by querying more than one table at a time","slug":"creating-charts-by-querying-more-than-one-table-at-a-time","posts_count":6,"reply_count":4,"highest_post_number":6,"image_url":null,"created_at":"2015-11-17T11:20:18.442Z","last_posted_at":"2015-11-21T02:12:25.995Z","bumped":true,"bumped_at":"2015-11-21T02:12:25.995Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":217,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":51},{"extras":"latest","description":"Most Recent Poster, Frequent Poster","user_id":1}]},{"id":90,"title":"Trying to add RDS postgresql as the database fails silently","fancy_title":"Trying to add RDS postgresql as the database fails silently","slug":"trying-to-add-rds-postgresql-as-the-database-fails-silently","posts_count":4,"reply_count":2,"highest_post_number":4,"image_url":null,"created_at":"2015-11-14T23:45:02.967Z","last_posted_at":"2015-11-21T01:08:45.915Z","bumped":true,"bumped_at":"2015-11-21T01:08:45.915Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":162,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":46},{"extras":"latest","description":"Most Recent Poster, Frequent Poster","user_id":1}]},{"id":17,"title":"Deploy to Heroku isn't working","fancy_title":"Deploy to Heroku isn’t working","slug":"deploy-to-heroku-isnt-working","posts_count":9,"reply_count":3,"highest_post_number":9,"image_url":null,"created_at":"2015-10-21T16:42:03.096Z","last_posted_at":"2015-11-20T18:34:14.044Z","bumped":true,"bumped_at":"2015-11-20T18:34:14.044Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":332,"like_count":2,"has_summary":false,"archetype":"regular","last_poster_username":"agilliland","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":5},{"extras":null,"description":"Frequent Poster","user_id":3},{"extras":null,"description":"Frequent Poster","user_id":11},{"extras":null,"description":"Frequent Poster","user_id":25},{"extras":"latest","description":"Most Recent Poster","user_id":14}]},{"id":100,"title":"Can I use DATEPART() in SQL queries?","fancy_title":"Can I use DATEPART() in SQL queries?","slug":"can-i-use-datepart-in-sql-queries","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2015-11-17T23:15:58.033Z","last_posted_at":"2015-11-18T00:19:48.763Z","bumped":true,"bumped_at":"2015-11-18T00:19:48.763Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":112,"like_count":1,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":53},{"extras":"latest","description":"Most Recent Poster","user_id":1}]},{"id":98,"title":"Feature Request: LDAP Authentication","fancy_title":"Feature Request: LDAP Authentication","slug":"feature-request-ldap-authentication","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2015-11-17T17:22:44.484Z","last_posted_at":"2015-11-17T17:22:44.577Z","bumped":true,"bumped_at":"2015-11-17T17:22:44.577Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":97,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"j_at_svg","category_id":1,"pinned_globally":false,"posters":[{"extras":"latest single","description":"Original Poster, Most Recent Poster","user_id":52}]},{"id":87,"title":"Migrating from internal H2 to Postgres","fancy_title":"Migrating from internal H2 to Postgres","slug":"migrating-from-internal-h2-to-postgres","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2015-11-12T14:36:06.745Z","last_posted_at":"2015-11-12T18:05:10.796Z","bumped":true,"bumped_at":"2015-11-12T18:05:10.796Z","unseen":false,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"bookmarked":null,"liked":null,"views":111,"like_count":0,"has_summary":false,"archetype":"regular","last_poster_username":"sameer","category_id":1,"pinned_globally":false,"posters":[{"extras":null,"description":"Original Poster","user_id":42},{"extras":"latest","description":"Most Recent Poster","user_id":1}]}]}} |
| 205 | -`) |
| 206 | --- a/benchmark/benchmark_codecgen.go |
| 207 | +++ /dev/null |
| 208 | @@ -1,2913 +0,0 @@ |
| 209 | -// ************************************************************ |
| 210 | -// DO NOT EDIT. |
| 211 | -// THIS FILE IS AUTO-GENERATED BY codecgen. |
| 212 | -// ************************************************************ |
| 213 | - |
| 214 | -package benchmark |
| 215 | - |
| 216 | -import ( |
| 217 | - "errors" |
| 218 | - codec1978 "github.com/ugorji/go/codec" |
| 219 | - "runtime" |
| 220 | - "strconv" |
| 221 | -) |
| 222 | - |
| 223 | -const ( |
| 224 | - // ----- content types ---- |
| 225 | - codecSelferCcUTF86617 = 1 |
| 226 | - codecSelferCcRAW6617 = 255 |
| 227 | - // ----- value types used ---- |
| 228 | - codecSelferValueTypeArray6617 = 10 |
| 229 | - codecSelferValueTypeMap6617 = 9 |
| 230 | - codecSelferValueTypeString6617 = 6 |
| 231 | - codecSelferValueTypeInt6617 = 2 |
| 232 | - codecSelferValueTypeUint6617 = 3 |
| 233 | - codecSelferValueTypeFloat6617 = 4 |
| 234 | - codecSelferBitsize6617 = uint8(32 << (^uint(0) >> 63)) |
| 235 | -) |
| 236 | - |
| 237 | -var ( |
| 238 | - errCodecSelferOnlyMapOrArrayEncodeToStruct6617 = errors.New(`only encoded map or array can be decoded into a struct`) |
| 239 | -) |
| 240 | - |
| 241 | -type codecSelfer6617 struct{} |
| 242 | - |
| 243 | -// Benchmark harness support for STK-REQ-004. |
| 244 | -func init() { |
| 245 | - if codec1978.GenVersion != 10 { |
| 246 | - _, file, _, _ := runtime.Caller(0) |
| 247 | - panic("codecgen version mismatch: current: 10, need " + strconv.FormatInt(int64(codec1978.GenVersion), 10) + ". Re-generate file: " + file) |
| 248 | - } |
| 249 | - if false { |
| 250 | - var _ byte = 0 // reference the types, but skip this branch at build/run time |
| 251 | - } |
| 252 | -} |
| 253 | - |
| 254 | -// Benchmark harness support for STK-REQ-004. |
| 255 | -func (x *SmallPayload) CodecEncodeSelf(e *codec1978.Encoder) { |
| 256 | - var h codecSelfer6617 |
| 257 | - z, r := codec1978.GenHelperEncoder(e) |
| 258 | - _, _, _ = h, z, r |
| 259 | - if x == nil { |
| 260 | - r.EncodeNil() |
| 261 | - } else { |
| 262 | - if false { |
| 263 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 264 | - z.EncExtension(x, yyxt1) |
| 265 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 266 | - z.EncJSONMarshal(x) |
| 267 | - } else { |
| 268 | - yysep2 := !z.EncBinary() |
| 269 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 270 | - _, _ = yysep2, yy2arr2 |
| 271 | - const yyr2 bool = false // struct tag has 'toArray' |
| 272 | - if yyr2 || yy2arr2 { |
| 273 | - r.WriteArrayStart(9) |
| 274 | - } else { |
| 275 | - r.WriteMapStart(9) |
| 276 | - } |
| 277 | - if yyr2 || yy2arr2 { |
| 278 | - r.WriteArrayElem() |
| 279 | - if false { |
| 280 | - } else { |
| 281 | - r.EncodeInt(int64(x.St)) |
| 282 | - } |
| 283 | - } else { |
| 284 | - r.WriteMapElemKey() |
| 285 | - if z.IsJSONHandle() { |
| 286 | - z.WriteStr("\"St\"") |
| 287 | - } else { |
| 288 | - r.EncodeStringEnc(codecSelferCcUTF86617, `St`) |
| 289 | - } |
| 290 | - r.WriteMapElemValue() |
| 291 | - if false { |
| 292 | - } else { |
| 293 | - r.EncodeInt(int64(x.St)) |
| 294 | - } |
| 295 | - } |
| 296 | - if yyr2 || yy2arr2 { |
| 297 | - r.WriteArrayElem() |
| 298 | - if false { |
| 299 | - } else { |
| 300 | - r.EncodeInt(int64(x.Sid)) |
| 301 | - } |
| 302 | - } else { |
| 303 | - r.WriteMapElemKey() |
| 304 | - if z.IsJSONHandle() { |
| 305 | - z.WriteStr("\"Sid\"") |
| 306 | - } else { |
| 307 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Sid`) |
| 308 | - } |
| 309 | - r.WriteMapElemValue() |
| 310 | - if false { |
| 311 | - } else { |
| 312 | - r.EncodeInt(int64(x.Sid)) |
| 313 | - } |
| 314 | - } |
| 315 | - if yyr2 || yy2arr2 { |
| 316 | - r.WriteArrayElem() |
| 317 | - if false { |
| 318 | - } else { |
| 319 | - if z.EncBasicHandle().StringToRaw { |
| 320 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Tt))) |
| 321 | - } else { |
| 322 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Tt)) |
| 323 | - } |
| 324 | - } |
| 325 | - } else { |
| 326 | - r.WriteMapElemKey() |
| 327 | - if z.IsJSONHandle() { |
| 328 | - z.WriteStr("\"Tt\"") |
| 329 | - } else { |
| 330 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Tt`) |
| 331 | - } |
| 332 | - r.WriteMapElemValue() |
| 333 | - if false { |
| 334 | - } else { |
| 335 | - if z.EncBasicHandle().StringToRaw { |
| 336 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Tt))) |
| 337 | - } else { |
| 338 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Tt)) |
| 339 | - } |
| 340 | - } |
| 341 | - } |
| 342 | - if yyr2 || yy2arr2 { |
| 343 | - r.WriteArrayElem() |
| 344 | - if false { |
| 345 | - } else { |
| 346 | - r.EncodeInt(int64(x.Gr)) |
| 347 | - } |
| 348 | - } else { |
| 349 | - r.WriteMapElemKey() |
| 350 | - if z.IsJSONHandle() { |
| 351 | - z.WriteStr("\"Gr\"") |
| 352 | - } else { |
| 353 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Gr`) |
| 354 | - } |
| 355 | - r.WriteMapElemValue() |
| 356 | - if false { |
| 357 | - } else { |
| 358 | - r.EncodeInt(int64(x.Gr)) |
| 359 | - } |
| 360 | - } |
| 361 | - if yyr2 || yy2arr2 { |
| 362 | - r.WriteArrayElem() |
| 363 | - if false { |
| 364 | - } else { |
| 365 | - if z.EncBasicHandle().StringToRaw { |
| 366 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Uuid))) |
| 367 | - } else { |
| 368 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Uuid)) |
| 369 | - } |
| 370 | - } |
| 371 | - } else { |
| 372 | - r.WriteMapElemKey() |
| 373 | - if z.IsJSONHandle() { |
| 374 | - z.WriteStr("\"Uuid\"") |
| 375 | - } else { |
| 376 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Uuid`) |
| 377 | - } |
| 378 | - r.WriteMapElemValue() |
| 379 | - if false { |
| 380 | - } else { |
| 381 | - if z.EncBasicHandle().StringToRaw { |
| 382 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Uuid))) |
| 383 | - } else { |
| 384 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Uuid)) |
| 385 | - } |
| 386 | - } |
| 387 | - } |
| 388 | - if yyr2 || yy2arr2 { |
| 389 | - r.WriteArrayElem() |
| 390 | - if false { |
| 391 | - } else { |
| 392 | - if z.EncBasicHandle().StringToRaw { |
| 393 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Ip))) |
| 394 | - } else { |
| 395 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Ip)) |
| 396 | - } |
| 397 | - } |
| 398 | - } else { |
| 399 | - r.WriteMapElemKey() |
| 400 | - if z.IsJSONHandle() { |
| 401 | - z.WriteStr("\"Ip\"") |
| 402 | - } else { |
| 403 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Ip`) |
| 404 | - } |
| 405 | - r.WriteMapElemValue() |
| 406 | - if false { |
| 407 | - } else { |
| 408 | - if z.EncBasicHandle().StringToRaw { |
| 409 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Ip))) |
| 410 | - } else { |
| 411 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Ip)) |
| 412 | - } |
| 413 | - } |
| 414 | - } |
| 415 | - if yyr2 || yy2arr2 { |
| 416 | - r.WriteArrayElem() |
| 417 | - if false { |
| 418 | - } else { |
| 419 | - if z.EncBasicHandle().StringToRaw { |
| 420 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Ua))) |
| 421 | - } else { |
| 422 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Ua)) |
| 423 | - } |
| 424 | - } |
| 425 | - } else { |
| 426 | - r.WriteMapElemKey() |
| 427 | - if z.IsJSONHandle() { |
| 428 | - z.WriteStr("\"Ua\"") |
| 429 | - } else { |
| 430 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Ua`) |
| 431 | - } |
| 432 | - r.WriteMapElemValue() |
| 433 | - if false { |
| 434 | - } else { |
| 435 | - if z.EncBasicHandle().StringToRaw { |
| 436 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Ua))) |
| 437 | - } else { |
| 438 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Ua)) |
| 439 | - } |
| 440 | - } |
| 441 | - } |
| 442 | - if yyr2 || yy2arr2 { |
| 443 | - r.WriteArrayElem() |
| 444 | - if false { |
| 445 | - } else { |
| 446 | - r.EncodeInt(int64(x.Tz)) |
| 447 | - } |
| 448 | - } else { |
| 449 | - r.WriteMapElemKey() |
| 450 | - if z.IsJSONHandle() { |
| 451 | - z.WriteStr("\"Tz\"") |
| 452 | - } else { |
| 453 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Tz`) |
| 454 | - } |
| 455 | - r.WriteMapElemValue() |
| 456 | - if false { |
| 457 | - } else { |
| 458 | - r.EncodeInt(int64(x.Tz)) |
| 459 | - } |
| 460 | - } |
| 461 | - if yyr2 || yy2arr2 { |
| 462 | - r.WriteArrayElem() |
| 463 | - if false { |
| 464 | - } else { |
| 465 | - r.EncodeInt(int64(x.V)) |
| 466 | - } |
| 467 | - } else { |
| 468 | - r.WriteMapElemKey() |
| 469 | - if z.IsJSONHandle() { |
| 470 | - z.WriteStr("\"V\"") |
| 471 | - } else { |
| 472 | - r.EncodeStringEnc(codecSelferCcUTF86617, `V`) |
| 473 | - } |
| 474 | - r.WriteMapElemValue() |
| 475 | - if false { |
| 476 | - } else { |
| 477 | - r.EncodeInt(int64(x.V)) |
| 478 | - } |
| 479 | - } |
| 480 | - if yyr2 || yy2arr2 { |
| 481 | - r.WriteArrayEnd() |
| 482 | - } else { |
| 483 | - r.WriteMapEnd() |
| 484 | - } |
| 485 | - } |
| 486 | - } |
| 487 | -} |
| 488 | - |
| 489 | -// Benchmark harness support for STK-REQ-004. |
| 490 | -func (x *SmallPayload) CodecDecodeSelf(d *codec1978.Decoder) { |
| 491 | - var h codecSelfer6617 |
| 492 | - z, r := codec1978.GenHelperDecoder(d) |
| 493 | - _, _, _ = h, z, r |
| 494 | - if false { |
| 495 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 496 | - z.DecExtension(x, yyxt1) |
| 497 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 498 | - z.DecJSONUnmarshal(x) |
| 499 | - } else { |
| 500 | - yyct2 := r.ContainerType() |
| 501 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 502 | - yyl2 := r.ReadMapStart() |
| 503 | - if yyl2 == 0 { |
| 504 | - r.ReadMapEnd() |
| 505 | - } else { |
| 506 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 507 | - } |
| 508 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 509 | - yyl2 := r.ReadArrayStart() |
| 510 | - if yyl2 == 0 { |
| 511 | - r.ReadArrayEnd() |
| 512 | - } else { |
| 513 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 514 | - } |
| 515 | - } else { |
| 516 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 517 | - } |
| 518 | - } |
| 519 | -} |
| 520 | - |
| 521 | -// Benchmark harness support for STK-REQ-004. |
| 522 | -func (x *SmallPayload) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 523 | - var h codecSelfer6617 |
| 524 | - z, r := codec1978.GenHelperDecoder(d) |
| 525 | - _, _, _ = h, z, r |
| 526 | - var yyhl3 bool = l >= 0 |
| 527 | - for yyj3 := 0; ; yyj3++ { |
| 528 | - if yyhl3 { |
| 529 | - if yyj3 >= l { |
| 530 | - break |
| 531 | - } |
| 532 | - } else { |
| 533 | - if r.CheckBreak() { |
| 534 | - break |
| 535 | - } |
| 536 | - } |
| 537 | - r.ReadMapElemKey() |
| 538 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 539 | - r.ReadMapElemValue() |
| 540 | - switch yys3 { |
| 541 | - case "St": |
| 542 | - if r.TryDecodeAsNil() { |
| 543 | - x.St = 0 |
| 544 | - } else { |
| 545 | - x.St = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 546 | - } |
| 547 | - case "Sid": |
| 548 | - if r.TryDecodeAsNil() { |
| 549 | - x.Sid = 0 |
| 550 | - } else { |
| 551 | - x.Sid = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 552 | - } |
| 553 | - case "Tt": |
| 554 | - if r.TryDecodeAsNil() { |
| 555 | - x.Tt = "" |
| 556 | - } else { |
| 557 | - x.Tt = (string)(r.DecodeString()) |
| 558 | - } |
| 559 | - case "Gr": |
| 560 | - if r.TryDecodeAsNil() { |
| 561 | - x.Gr = 0 |
| 562 | - } else { |
| 563 | - x.Gr = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 564 | - } |
| 565 | - case "Uuid": |
| 566 | - if r.TryDecodeAsNil() { |
| 567 | - x.Uuid = "" |
| 568 | - } else { |
| 569 | - x.Uuid = (string)(r.DecodeString()) |
| 570 | - } |
| 571 | - case "Ip": |
| 572 | - if r.TryDecodeAsNil() { |
| 573 | - x.Ip = "" |
| 574 | - } else { |
| 575 | - x.Ip = (string)(r.DecodeString()) |
| 576 | - } |
| 577 | - case "Ua": |
| 578 | - if r.TryDecodeAsNil() { |
| 579 | - x.Ua = "" |
| 580 | - } else { |
| 581 | - x.Ua = (string)(r.DecodeString()) |
| 582 | - } |
| 583 | - case "Tz": |
| 584 | - if r.TryDecodeAsNil() { |
| 585 | - x.Tz = 0 |
| 586 | - } else { |
| 587 | - x.Tz = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 588 | - } |
| 589 | - case "V": |
| 590 | - if r.TryDecodeAsNil() { |
| 591 | - x.V = 0 |
| 592 | - } else { |
| 593 | - x.V = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 594 | - } |
| 595 | - default: |
| 596 | - z.DecStructFieldNotFound(-1, yys3) |
| 597 | - } // end switch yys3 |
| 598 | - } // end for yyj3 |
| 599 | - r.ReadMapEnd() |
| 600 | -} |
| 601 | - |
| 602 | -// Benchmark harness support for STK-REQ-004. |
| 603 | -func (x *SmallPayload) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 604 | - var h codecSelfer6617 |
| 605 | - z, r := codec1978.GenHelperDecoder(d) |
| 606 | - _, _, _ = h, z, r |
| 607 | - var yyj13 int |
| 608 | - var yyb13 bool |
| 609 | - var yyhl13 bool = l >= 0 |
| 610 | - yyj13++ |
| 611 | - if yyhl13 { |
| 612 | - yyb13 = yyj13 > l |
| 613 | - } else { |
| 614 | - yyb13 = r.CheckBreak() |
| 615 | - } |
| 616 | - if yyb13 { |
| 617 | - r.ReadArrayEnd() |
| 618 | - return |
| 619 | - } |
| 620 | - r.ReadArrayElem() |
| 621 | - if r.TryDecodeAsNil() { |
| 622 | - x.St = 0 |
| 623 | - } else { |
| 624 | - x.St = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 625 | - } |
| 626 | - yyj13++ |
| 627 | - if yyhl13 { |
| 628 | - yyb13 = yyj13 > l |
| 629 | - } else { |
| 630 | - yyb13 = r.CheckBreak() |
| 631 | - } |
| 632 | - if yyb13 { |
| 633 | - r.ReadArrayEnd() |
| 634 | - return |
| 635 | - } |
| 636 | - r.ReadArrayElem() |
| 637 | - if r.TryDecodeAsNil() { |
| 638 | - x.Sid = 0 |
| 639 | - } else { |
| 640 | - x.Sid = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 641 | - } |
| 642 | - yyj13++ |
| 643 | - if yyhl13 { |
| 644 | - yyb13 = yyj13 > l |
| 645 | - } else { |
| 646 | - yyb13 = r.CheckBreak() |
| 647 | - } |
| 648 | - if yyb13 { |
| 649 | - r.ReadArrayEnd() |
| 650 | - return |
| 651 | - } |
| 652 | - r.ReadArrayElem() |
| 653 | - if r.TryDecodeAsNil() { |
| 654 | - x.Tt = "" |
| 655 | - } else { |
| 656 | - x.Tt = (string)(r.DecodeString()) |
| 657 | - } |
| 658 | - yyj13++ |
| 659 | - if yyhl13 { |
| 660 | - yyb13 = yyj13 > l |
| 661 | - } else { |
| 662 | - yyb13 = r.CheckBreak() |
| 663 | - } |
| 664 | - if yyb13 { |
| 665 | - r.ReadArrayEnd() |
| 666 | - return |
| 667 | - } |
| 668 | - r.ReadArrayElem() |
| 669 | - if r.TryDecodeAsNil() { |
| 670 | - x.Gr = 0 |
| 671 | - } else { |
| 672 | - x.Gr = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 673 | - } |
| 674 | - yyj13++ |
| 675 | - if yyhl13 { |
| 676 | - yyb13 = yyj13 > l |
| 677 | - } else { |
| 678 | - yyb13 = r.CheckBreak() |
| 679 | - } |
| 680 | - if yyb13 { |
| 681 | - r.ReadArrayEnd() |
| 682 | - return |
| 683 | - } |
| 684 | - r.ReadArrayElem() |
| 685 | - if r.TryDecodeAsNil() { |
| 686 | - x.Uuid = "" |
| 687 | - } else { |
| 688 | - x.Uuid = (string)(r.DecodeString()) |
| 689 | - } |
| 690 | - yyj13++ |
| 691 | - if yyhl13 { |
| 692 | - yyb13 = yyj13 > l |
| 693 | - } else { |
| 694 | - yyb13 = r.CheckBreak() |
| 695 | - } |
| 696 | - if yyb13 { |
| 697 | - r.ReadArrayEnd() |
| 698 | - return |
| 699 | - } |
| 700 | - r.ReadArrayElem() |
| 701 | - if r.TryDecodeAsNil() { |
| 702 | - x.Ip = "" |
| 703 | - } else { |
| 704 | - x.Ip = (string)(r.DecodeString()) |
| 705 | - } |
| 706 | - yyj13++ |
| 707 | - if yyhl13 { |
| 708 | - yyb13 = yyj13 > l |
| 709 | - } else { |
| 710 | - yyb13 = r.CheckBreak() |
| 711 | - } |
| 712 | - if yyb13 { |
| 713 | - r.ReadArrayEnd() |
| 714 | - return |
| 715 | - } |
| 716 | - r.ReadArrayElem() |
| 717 | - if r.TryDecodeAsNil() { |
| 718 | - x.Ua = "" |
| 719 | - } else { |
| 720 | - x.Ua = (string)(r.DecodeString()) |
| 721 | - } |
| 722 | - yyj13++ |
| 723 | - if yyhl13 { |
| 724 | - yyb13 = yyj13 > l |
| 725 | - } else { |
| 726 | - yyb13 = r.CheckBreak() |
| 727 | - } |
| 728 | - if yyb13 { |
| 729 | - r.ReadArrayEnd() |
| 730 | - return |
| 731 | - } |
| 732 | - r.ReadArrayElem() |
| 733 | - if r.TryDecodeAsNil() { |
| 734 | - x.Tz = 0 |
| 735 | - } else { |
| 736 | - x.Tz = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 737 | - } |
| 738 | - yyj13++ |
| 739 | - if yyhl13 { |
| 740 | - yyb13 = yyj13 > l |
| 741 | - } else { |
| 742 | - yyb13 = r.CheckBreak() |
| 743 | - } |
| 744 | - if yyb13 { |
| 745 | - r.ReadArrayEnd() |
| 746 | - return |
| 747 | - } |
| 748 | - r.ReadArrayElem() |
| 749 | - if r.TryDecodeAsNil() { |
| 750 | - x.V = 0 |
| 751 | - } else { |
| 752 | - x.V = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 753 | - } |
| 754 | - for { |
| 755 | - yyj13++ |
| 756 | - if yyhl13 { |
| 757 | - yyb13 = yyj13 > l |
| 758 | - } else { |
| 759 | - yyb13 = r.CheckBreak() |
| 760 | - } |
| 761 | - if yyb13 { |
| 762 | - break |
| 763 | - } |
| 764 | - r.ReadArrayElem() |
| 765 | - z.DecStructFieldNotFound(yyj13-1, "") |
| 766 | - } |
| 767 | - r.ReadArrayEnd() |
| 768 | -} |
| 769 | - |
| 770 | -// Benchmark harness support for STK-REQ-004. |
| 771 | -func (x *CBAvatar) CodecEncodeSelf(e *codec1978.Encoder) { |
| 772 | - var h codecSelfer6617 |
| 773 | - z, r := codec1978.GenHelperEncoder(e) |
| 774 | - _, _, _ = h, z, r |
| 775 | - if x == nil { |
| 776 | - r.EncodeNil() |
| 777 | - } else { |
| 778 | - if false { |
| 779 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 780 | - z.EncExtension(x, yyxt1) |
| 781 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 782 | - z.EncJSONMarshal(x) |
| 783 | - } else { |
| 784 | - yysep2 := !z.EncBinary() |
| 785 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 786 | - _, _ = yysep2, yy2arr2 |
| 787 | - const yyr2 bool = false // struct tag has 'toArray' |
| 788 | - if yyr2 || yy2arr2 { |
| 789 | - r.WriteArrayStart(1) |
| 790 | - } else { |
| 791 | - r.WriteMapStart(1) |
| 792 | - } |
| 793 | - if yyr2 || yy2arr2 { |
| 794 | - r.WriteArrayElem() |
| 795 | - if false { |
| 796 | - } else { |
| 797 | - if z.EncBasicHandle().StringToRaw { |
| 798 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Url))) |
| 799 | - } else { |
| 800 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Url)) |
| 801 | - } |
| 802 | - } |
| 803 | - } else { |
| 804 | - r.WriteMapElemKey() |
| 805 | - if z.IsJSONHandle() { |
| 806 | - z.WriteStr("\"Url\"") |
| 807 | - } else { |
| 808 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Url`) |
| 809 | - } |
| 810 | - r.WriteMapElemValue() |
| 811 | - if false { |
| 812 | - } else { |
| 813 | - if z.EncBasicHandle().StringToRaw { |
| 814 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Url))) |
| 815 | - } else { |
| 816 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Url)) |
| 817 | - } |
| 818 | - } |
| 819 | - } |
| 820 | - if yyr2 || yy2arr2 { |
| 821 | - r.WriteArrayEnd() |
| 822 | - } else { |
| 823 | - r.WriteMapEnd() |
| 824 | - } |
| 825 | - } |
| 826 | - } |
| 827 | -} |
| 828 | - |
| 829 | -// Benchmark harness support for STK-REQ-004. |
| 830 | -func (x *CBAvatar) CodecDecodeSelf(d *codec1978.Decoder) { |
| 831 | - var h codecSelfer6617 |
| 832 | - z, r := codec1978.GenHelperDecoder(d) |
| 833 | - _, _, _ = h, z, r |
| 834 | - if false { |
| 835 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 836 | - z.DecExtension(x, yyxt1) |
| 837 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 838 | - z.DecJSONUnmarshal(x) |
| 839 | - } else { |
| 840 | - yyct2 := r.ContainerType() |
| 841 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 842 | - yyl2 := r.ReadMapStart() |
| 843 | - if yyl2 == 0 { |
| 844 | - r.ReadMapEnd() |
| 845 | - } else { |
| 846 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 847 | - } |
| 848 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 849 | - yyl2 := r.ReadArrayStart() |
| 850 | - if yyl2 == 0 { |
| 851 | - r.ReadArrayEnd() |
| 852 | - } else { |
| 853 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 854 | - } |
| 855 | - } else { |
| 856 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 857 | - } |
| 858 | - } |
| 859 | -} |
| 860 | - |
| 861 | -// Benchmark harness support for STK-REQ-004. |
| 862 | -func (x *CBAvatar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 863 | - var h codecSelfer6617 |
| 864 | - z, r := codec1978.GenHelperDecoder(d) |
| 865 | - _, _, _ = h, z, r |
| 866 | - var yyhl3 bool = l >= 0 |
| 867 | - for yyj3 := 0; ; yyj3++ { |
| 868 | - if yyhl3 { |
| 869 | - if yyj3 >= l { |
| 870 | - break |
| 871 | - } |
| 872 | - } else { |
| 873 | - if r.CheckBreak() { |
| 874 | - break |
| 875 | - } |
| 876 | - } |
| 877 | - r.ReadMapElemKey() |
| 878 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 879 | - r.ReadMapElemValue() |
| 880 | - switch yys3 { |
| 881 | - case "Url": |
| 882 | - if r.TryDecodeAsNil() { |
| 883 | - x.Url = "" |
| 884 | - } else { |
| 885 | - x.Url = (string)(r.DecodeString()) |
| 886 | - } |
| 887 | - default: |
| 888 | - z.DecStructFieldNotFound(-1, yys3) |
| 889 | - } // end switch yys3 |
| 890 | - } // end for yyj3 |
| 891 | - r.ReadMapEnd() |
| 892 | -} |
| 893 | - |
| 894 | -// Benchmark harness support for STK-REQ-004. |
| 895 | -func (x *CBAvatar) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 896 | - var h codecSelfer6617 |
| 897 | - z, r := codec1978.GenHelperDecoder(d) |
| 898 | - _, _, _ = h, z, r |
| 899 | - var yyj5 int |
| 900 | - var yyb5 bool |
| 901 | - var yyhl5 bool = l >= 0 |
| 902 | - yyj5++ |
| 903 | - if yyhl5 { |
| 904 | - yyb5 = yyj5 > l |
| 905 | - } else { |
| 906 | - yyb5 = r.CheckBreak() |
| 907 | - } |
| 908 | - if yyb5 { |
| 909 | - r.ReadArrayEnd() |
| 910 | - return |
| 911 | - } |
| 912 | - r.ReadArrayElem() |
| 913 | - if r.TryDecodeAsNil() { |
| 914 | - x.Url = "" |
| 915 | - } else { |
| 916 | - x.Url = (string)(r.DecodeString()) |
| 917 | - } |
| 918 | - for { |
| 919 | - yyj5++ |
| 920 | - if yyhl5 { |
| 921 | - yyb5 = yyj5 > l |
| 922 | - } else { |
| 923 | - yyb5 = r.CheckBreak() |
| 924 | - } |
| 925 | - if yyb5 { |
| 926 | - break |
| 927 | - } |
| 928 | - r.ReadArrayElem() |
| 929 | - z.DecStructFieldNotFound(yyj5-1, "") |
| 930 | - } |
| 931 | - r.ReadArrayEnd() |
| 932 | -} |
| 933 | - |
| 934 | -// Benchmark harness support for STK-REQ-004. |
| 935 | -func (x *CBGravatar) CodecEncodeSelf(e *codec1978.Encoder) { |
| 936 | - var h codecSelfer6617 |
| 937 | - z, r := codec1978.GenHelperEncoder(e) |
| 938 | - _, _, _ = h, z, r |
| 939 | - if x == nil { |
| 940 | - r.EncodeNil() |
| 941 | - } else { |
| 942 | - if false { |
| 943 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 944 | - z.EncExtension(x, yyxt1) |
| 945 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 946 | - z.EncJSONMarshal(x) |
| 947 | - } else { |
| 948 | - yysep2 := !z.EncBinary() |
| 949 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 950 | - _, _ = yysep2, yy2arr2 |
| 951 | - const yyr2 bool = false // struct tag has 'toArray' |
| 952 | - if yyr2 || yy2arr2 { |
| 953 | - r.WriteArrayStart(1) |
| 954 | - } else { |
| 955 | - r.WriteMapStart(1) |
| 956 | - } |
| 957 | - if yyr2 || yy2arr2 { |
| 958 | - r.WriteArrayElem() |
| 959 | - if x.Avatars == nil { |
| 960 | - r.EncodeNil() |
| 961 | - } else { |
| 962 | - if false { |
| 963 | - } else { |
| 964 | - h.encSlicePtrtoCBAvatar(([]*CBAvatar)(x.Avatars), e) |
| 965 | - } |
| 966 | - } |
| 967 | - } else { |
| 968 | - r.WriteMapElemKey() |
| 969 | - if z.IsJSONHandle() { |
| 970 | - z.WriteStr("\"Avatars\"") |
| 971 | - } else { |
| 972 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Avatars`) |
| 973 | - } |
| 974 | - r.WriteMapElemValue() |
| 975 | - if x.Avatars == nil { |
| 976 | - r.EncodeNil() |
| 977 | - } else { |
| 978 | - if false { |
| 979 | - } else { |
| 980 | - h.encSlicePtrtoCBAvatar(([]*CBAvatar)(x.Avatars), e) |
| 981 | - } |
| 982 | - } |
| 983 | - } |
| 984 | - if yyr2 || yy2arr2 { |
| 985 | - r.WriteArrayEnd() |
| 986 | - } else { |
| 987 | - r.WriteMapEnd() |
| 988 | - } |
| 989 | - } |
| 990 | - } |
| 991 | -} |
| 992 | - |
| 993 | -// Benchmark harness support for STK-REQ-004. |
| 994 | -func (x *CBGravatar) CodecDecodeSelf(d *codec1978.Decoder) { |
| 995 | - var h codecSelfer6617 |
| 996 | - z, r := codec1978.GenHelperDecoder(d) |
| 997 | - _, _, _ = h, z, r |
| 998 | - if false { |
| 999 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1000 | - z.DecExtension(x, yyxt1) |
| 1001 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 1002 | - z.DecJSONUnmarshal(x) |
| 1003 | - } else { |
| 1004 | - yyct2 := r.ContainerType() |
| 1005 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 1006 | - yyl2 := r.ReadMapStart() |
| 1007 | - if yyl2 == 0 { |
| 1008 | - r.ReadMapEnd() |
| 1009 | - } else { |
| 1010 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 1011 | - } |
| 1012 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 1013 | - yyl2 := r.ReadArrayStart() |
| 1014 | - if yyl2 == 0 { |
| 1015 | - r.ReadArrayEnd() |
| 1016 | - } else { |
| 1017 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 1018 | - } |
| 1019 | - } else { |
| 1020 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 1021 | - } |
| 1022 | - } |
| 1023 | -} |
| 1024 | - |
| 1025 | -// Benchmark harness support for STK-REQ-004. |
| 1026 | -func (x *CBGravatar) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 1027 | - var h codecSelfer6617 |
| 1028 | - z, r := codec1978.GenHelperDecoder(d) |
| 1029 | - _, _, _ = h, z, r |
| 1030 | - var yyhl3 bool = l >= 0 |
| 1031 | - for yyj3 := 0; ; yyj3++ { |
| 1032 | - if yyhl3 { |
| 1033 | - if yyj3 >= l { |
| 1034 | - break |
| 1035 | - } |
| 1036 | - } else { |
| 1037 | - if r.CheckBreak() { |
| 1038 | - break |
| 1039 | - } |
| 1040 | - } |
| 1041 | - r.ReadMapElemKey() |
| 1042 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 1043 | - r.ReadMapElemValue() |
| 1044 | - switch yys3 { |
| 1045 | - case "Avatars": |
| 1046 | - if r.TryDecodeAsNil() { |
| 1047 | - x.Avatars = nil |
| 1048 | - } else { |
| 1049 | - if false { |
| 1050 | - } else { |
| 1051 | - h.decSlicePtrtoCBAvatar((*[]*CBAvatar)(&x.Avatars), d) |
| 1052 | - } |
| 1053 | - } |
| 1054 | - default: |
| 1055 | - z.DecStructFieldNotFound(-1, yys3) |
| 1056 | - } // end switch yys3 |
| 1057 | - } // end for yyj3 |
| 1058 | - r.ReadMapEnd() |
| 1059 | -} |
| 1060 | - |
| 1061 | -// Benchmark harness support for STK-REQ-004. |
| 1062 | -func (x *CBGravatar) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 1063 | - var h codecSelfer6617 |
| 1064 | - z, r := codec1978.GenHelperDecoder(d) |
| 1065 | - _, _, _ = h, z, r |
| 1066 | - var yyj6 int |
| 1067 | - var yyb6 bool |
| 1068 | - var yyhl6 bool = l >= 0 |
| 1069 | - yyj6++ |
| 1070 | - if yyhl6 { |
| 1071 | - yyb6 = yyj6 > l |
| 1072 | - } else { |
| 1073 | - yyb6 = r.CheckBreak() |
| 1074 | - } |
| 1075 | - if yyb6 { |
| 1076 | - r.ReadArrayEnd() |
| 1077 | - return |
| 1078 | - } |
| 1079 | - r.ReadArrayElem() |
| 1080 | - if r.TryDecodeAsNil() { |
| 1081 | - x.Avatars = nil |
| 1082 | - } else { |
| 1083 | - if false { |
| 1084 | - } else { |
| 1085 | - h.decSlicePtrtoCBAvatar((*[]*CBAvatar)(&x.Avatars), d) |
| 1086 | - } |
| 1087 | - } |
| 1088 | - for { |
| 1089 | - yyj6++ |
| 1090 | - if yyhl6 { |
| 1091 | - yyb6 = yyj6 > l |
| 1092 | - } else { |
| 1093 | - yyb6 = r.CheckBreak() |
| 1094 | - } |
| 1095 | - if yyb6 { |
| 1096 | - break |
| 1097 | - } |
| 1098 | - r.ReadArrayElem() |
| 1099 | - z.DecStructFieldNotFound(yyj6-1, "") |
| 1100 | - } |
| 1101 | - r.ReadArrayEnd() |
| 1102 | -} |
| 1103 | - |
| 1104 | -// Benchmark harness support for STK-REQ-004. |
| 1105 | -func (x *CBGithub) CodecEncodeSelf(e *codec1978.Encoder) { |
| 1106 | - var h codecSelfer6617 |
| 1107 | - z, r := codec1978.GenHelperEncoder(e) |
| 1108 | - _, _, _ = h, z, r |
| 1109 | - if x == nil { |
| 1110 | - r.EncodeNil() |
| 1111 | - } else { |
| 1112 | - if false { |
| 1113 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1114 | - z.EncExtension(x, yyxt1) |
| 1115 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 1116 | - z.EncJSONMarshal(x) |
| 1117 | - } else { |
| 1118 | - yysep2 := !z.EncBinary() |
| 1119 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 1120 | - _, _ = yysep2, yy2arr2 |
| 1121 | - const yyr2 bool = false // struct tag has 'toArray' |
| 1122 | - if yyr2 || yy2arr2 { |
| 1123 | - r.WriteArrayStart(1) |
| 1124 | - } else { |
| 1125 | - r.WriteMapStart(1) |
| 1126 | - } |
| 1127 | - if yyr2 || yy2arr2 { |
| 1128 | - r.WriteArrayElem() |
| 1129 | - if false { |
| 1130 | - } else { |
| 1131 | - r.EncodeInt(int64(x.Followers)) |
| 1132 | - } |
| 1133 | - } else { |
| 1134 | - r.WriteMapElemKey() |
| 1135 | - if z.IsJSONHandle() { |
| 1136 | - z.WriteStr("\"Followers\"") |
| 1137 | - } else { |
| 1138 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Followers`) |
| 1139 | - } |
| 1140 | - r.WriteMapElemValue() |
| 1141 | - if false { |
| 1142 | - } else { |
| 1143 | - r.EncodeInt(int64(x.Followers)) |
| 1144 | - } |
| 1145 | - } |
| 1146 | - if yyr2 || yy2arr2 { |
| 1147 | - r.WriteArrayEnd() |
| 1148 | - } else { |
| 1149 | - r.WriteMapEnd() |
| 1150 | - } |
| 1151 | - } |
| 1152 | - } |
| 1153 | -} |
| 1154 | - |
| 1155 | -// Benchmark harness support for STK-REQ-004. |
| 1156 | -func (x *CBGithub) CodecDecodeSelf(d *codec1978.Decoder) { |
| 1157 | - var h codecSelfer6617 |
| 1158 | - z, r := codec1978.GenHelperDecoder(d) |
| 1159 | - _, _, _ = h, z, r |
| 1160 | - if false { |
| 1161 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1162 | - z.DecExtension(x, yyxt1) |
| 1163 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 1164 | - z.DecJSONUnmarshal(x) |
| 1165 | - } else { |
| 1166 | - yyct2 := r.ContainerType() |
| 1167 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 1168 | - yyl2 := r.ReadMapStart() |
| 1169 | - if yyl2 == 0 { |
| 1170 | - r.ReadMapEnd() |
| 1171 | - } else { |
| 1172 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 1173 | - } |
| 1174 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 1175 | - yyl2 := r.ReadArrayStart() |
| 1176 | - if yyl2 == 0 { |
| 1177 | - r.ReadArrayEnd() |
| 1178 | - } else { |
| 1179 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 1180 | - } |
| 1181 | - } else { |
| 1182 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 1183 | - } |
| 1184 | - } |
| 1185 | -} |
| 1186 | - |
| 1187 | -// Benchmark harness support for STK-REQ-004. |
| 1188 | -func (x *CBGithub) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 1189 | - var h codecSelfer6617 |
| 1190 | - z, r := codec1978.GenHelperDecoder(d) |
| 1191 | - _, _, _ = h, z, r |
| 1192 | - var yyhl3 bool = l >= 0 |
| 1193 | - for yyj3 := 0; ; yyj3++ { |
| 1194 | - if yyhl3 { |
| 1195 | - if yyj3 >= l { |
| 1196 | - break |
| 1197 | - } |
| 1198 | - } else { |
| 1199 | - if r.CheckBreak() { |
| 1200 | - break |
| 1201 | - } |
| 1202 | - } |
| 1203 | - r.ReadMapElemKey() |
| 1204 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 1205 | - r.ReadMapElemValue() |
| 1206 | - switch yys3 { |
| 1207 | - case "Followers": |
| 1208 | - if r.TryDecodeAsNil() { |
| 1209 | - x.Followers = 0 |
| 1210 | - } else { |
| 1211 | - x.Followers = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 1212 | - } |
| 1213 | - default: |
| 1214 | - z.DecStructFieldNotFound(-1, yys3) |
| 1215 | - } // end switch yys3 |
| 1216 | - } // end for yyj3 |
| 1217 | - r.ReadMapEnd() |
| 1218 | -} |
| 1219 | - |
| 1220 | -// Benchmark harness support for STK-REQ-004. |
| 1221 | -func (x *CBGithub) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 1222 | - var h codecSelfer6617 |
| 1223 | - z, r := codec1978.GenHelperDecoder(d) |
| 1224 | - _, _, _ = h, z, r |
| 1225 | - var yyj5 int |
| 1226 | - var yyb5 bool |
| 1227 | - var yyhl5 bool = l >= 0 |
| 1228 | - yyj5++ |
| 1229 | - if yyhl5 { |
| 1230 | - yyb5 = yyj5 > l |
| 1231 | - } else { |
| 1232 | - yyb5 = r.CheckBreak() |
| 1233 | - } |
| 1234 | - if yyb5 { |
| 1235 | - r.ReadArrayEnd() |
| 1236 | - return |
| 1237 | - } |
| 1238 | - r.ReadArrayElem() |
| 1239 | - if r.TryDecodeAsNil() { |
| 1240 | - x.Followers = 0 |
| 1241 | - } else { |
| 1242 | - x.Followers = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 1243 | - } |
| 1244 | - for { |
| 1245 | - yyj5++ |
| 1246 | - if yyhl5 { |
| 1247 | - yyb5 = yyj5 > l |
| 1248 | - } else { |
| 1249 | - yyb5 = r.CheckBreak() |
| 1250 | - } |
| 1251 | - if yyb5 { |
| 1252 | - break |
| 1253 | - } |
| 1254 | - r.ReadArrayElem() |
| 1255 | - z.DecStructFieldNotFound(yyj5-1, "") |
| 1256 | - } |
| 1257 | - r.ReadArrayEnd() |
| 1258 | -} |
| 1259 | - |
| 1260 | -// Benchmark harness support for STK-REQ-004. |
| 1261 | -func (x *CBName) CodecEncodeSelf(e *codec1978.Encoder) { |
| 1262 | - var h codecSelfer6617 |
| 1263 | - z, r := codec1978.GenHelperEncoder(e) |
| 1264 | - _, _, _ = h, z, r |
| 1265 | - if x == nil { |
| 1266 | - r.EncodeNil() |
| 1267 | - } else { |
| 1268 | - if false { |
| 1269 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1270 | - z.EncExtension(x, yyxt1) |
| 1271 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 1272 | - z.EncJSONMarshal(x) |
| 1273 | - } else { |
| 1274 | - yysep2 := !z.EncBinary() |
| 1275 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 1276 | - _, _ = yysep2, yy2arr2 |
| 1277 | - const yyr2 bool = false // struct tag has 'toArray' |
| 1278 | - if yyr2 || yy2arr2 { |
| 1279 | - r.WriteArrayStart(1) |
| 1280 | - } else { |
| 1281 | - r.WriteMapStart(1) |
| 1282 | - } |
| 1283 | - if yyr2 || yy2arr2 { |
| 1284 | - r.WriteArrayElem() |
| 1285 | - if false { |
| 1286 | - } else { |
| 1287 | - if z.EncBasicHandle().StringToRaw { |
| 1288 | - r.EncodeStringBytesRaw(z.BytesView(string(x.FullName))) |
| 1289 | - } else { |
| 1290 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.FullName)) |
| 1291 | - } |
| 1292 | - } |
| 1293 | - } else { |
| 1294 | - r.WriteMapElemKey() |
| 1295 | - if z.IsJSONHandle() { |
| 1296 | - z.WriteStr("\"FullName\"") |
| 1297 | - } else { |
| 1298 | - r.EncodeStringEnc(codecSelferCcUTF86617, `FullName`) |
| 1299 | - } |
| 1300 | - r.WriteMapElemValue() |
| 1301 | - if false { |
| 1302 | - } else { |
| 1303 | - if z.EncBasicHandle().StringToRaw { |
| 1304 | - r.EncodeStringBytesRaw(z.BytesView(string(x.FullName))) |
| 1305 | - } else { |
| 1306 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.FullName)) |
| 1307 | - } |
| 1308 | - } |
| 1309 | - } |
| 1310 | - if yyr2 || yy2arr2 { |
| 1311 | - r.WriteArrayEnd() |
| 1312 | - } else { |
| 1313 | - r.WriteMapEnd() |
| 1314 | - } |
| 1315 | - } |
| 1316 | - } |
| 1317 | -} |
| 1318 | - |
| 1319 | -// Benchmark harness support for STK-REQ-004. |
| 1320 | -func (x *CBName) CodecDecodeSelf(d *codec1978.Decoder) { |
| 1321 | - var h codecSelfer6617 |
| 1322 | - z, r := codec1978.GenHelperDecoder(d) |
| 1323 | - _, _, _ = h, z, r |
| 1324 | - if false { |
| 1325 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1326 | - z.DecExtension(x, yyxt1) |
| 1327 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 1328 | - z.DecJSONUnmarshal(x) |
| 1329 | - } else { |
| 1330 | - yyct2 := r.ContainerType() |
| 1331 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 1332 | - yyl2 := r.ReadMapStart() |
| 1333 | - if yyl2 == 0 { |
| 1334 | - r.ReadMapEnd() |
| 1335 | - } else { |
| 1336 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 1337 | - } |
| 1338 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 1339 | - yyl2 := r.ReadArrayStart() |
| 1340 | - if yyl2 == 0 { |
| 1341 | - r.ReadArrayEnd() |
| 1342 | - } else { |
| 1343 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 1344 | - } |
| 1345 | - } else { |
| 1346 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 1347 | - } |
| 1348 | - } |
| 1349 | -} |
| 1350 | - |
| 1351 | -// Benchmark harness support for STK-REQ-004. |
| 1352 | -func (x *CBName) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 1353 | - var h codecSelfer6617 |
| 1354 | - z, r := codec1978.GenHelperDecoder(d) |
| 1355 | - _, _, _ = h, z, r |
| 1356 | - var yyhl3 bool = l >= 0 |
| 1357 | - for yyj3 := 0; ; yyj3++ { |
| 1358 | - if yyhl3 { |
| 1359 | - if yyj3 >= l { |
| 1360 | - break |
| 1361 | - } |
| 1362 | - } else { |
| 1363 | - if r.CheckBreak() { |
| 1364 | - break |
| 1365 | - } |
| 1366 | - } |
| 1367 | - r.ReadMapElemKey() |
| 1368 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 1369 | - r.ReadMapElemValue() |
| 1370 | - switch yys3 { |
| 1371 | - case "FullName": |
| 1372 | - if r.TryDecodeAsNil() { |
| 1373 | - x.FullName = "" |
| 1374 | - } else { |
| 1375 | - x.FullName = (string)(r.DecodeString()) |
| 1376 | - } |
| 1377 | - default: |
| 1378 | - z.DecStructFieldNotFound(-1, yys3) |
| 1379 | - } // end switch yys3 |
| 1380 | - } // end for yyj3 |
| 1381 | - r.ReadMapEnd() |
| 1382 | -} |
| 1383 | - |
| 1384 | -// Benchmark harness support for STK-REQ-004. |
| 1385 | -func (x *CBName) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 1386 | - var h codecSelfer6617 |
| 1387 | - z, r := codec1978.GenHelperDecoder(d) |
| 1388 | - _, _, _ = h, z, r |
| 1389 | - var yyj5 int |
| 1390 | - var yyb5 bool |
| 1391 | - var yyhl5 bool = l >= 0 |
| 1392 | - yyj5++ |
| 1393 | - if yyhl5 { |
| 1394 | - yyb5 = yyj5 > l |
| 1395 | - } else { |
| 1396 | - yyb5 = r.CheckBreak() |
| 1397 | - } |
| 1398 | - if yyb5 { |
| 1399 | - r.ReadArrayEnd() |
| 1400 | - return |
| 1401 | - } |
| 1402 | - r.ReadArrayElem() |
| 1403 | - if r.TryDecodeAsNil() { |
| 1404 | - x.FullName = "" |
| 1405 | - } else { |
| 1406 | - x.FullName = (string)(r.DecodeString()) |
| 1407 | - } |
| 1408 | - for { |
| 1409 | - yyj5++ |
| 1410 | - if yyhl5 { |
| 1411 | - yyb5 = yyj5 > l |
| 1412 | - } else { |
| 1413 | - yyb5 = r.CheckBreak() |
| 1414 | - } |
| 1415 | - if yyb5 { |
| 1416 | - break |
| 1417 | - } |
| 1418 | - r.ReadArrayElem() |
| 1419 | - z.DecStructFieldNotFound(yyj5-1, "") |
| 1420 | - } |
| 1421 | - r.ReadArrayEnd() |
| 1422 | -} |
| 1423 | - |
| 1424 | -// Benchmark harness support for STK-REQ-004. |
| 1425 | -func (x *CBPerson) CodecEncodeSelf(e *codec1978.Encoder) { |
| 1426 | - var h codecSelfer6617 |
| 1427 | - z, r := codec1978.GenHelperEncoder(e) |
| 1428 | - _, _, _ = h, z, r |
| 1429 | - if x == nil { |
| 1430 | - r.EncodeNil() |
| 1431 | - } else { |
| 1432 | - if false { |
| 1433 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1434 | - z.EncExtension(x, yyxt1) |
| 1435 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 1436 | - z.EncJSONMarshal(x) |
| 1437 | - } else { |
| 1438 | - yysep2 := !z.EncBinary() |
| 1439 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 1440 | - _, _ = yysep2, yy2arr2 |
| 1441 | - const yyr2 bool = false // struct tag has 'toArray' |
| 1442 | - if yyr2 || yy2arr2 { |
| 1443 | - r.WriteArrayStart(3) |
| 1444 | - } else { |
| 1445 | - r.WriteMapStart(3) |
| 1446 | - } |
| 1447 | - var yyn3 bool |
| 1448 | - if x.Name == nil { |
| 1449 | - yyn3 = true |
| 1450 | - goto LABEL3 |
| 1451 | - } |
| 1452 | - LABEL3: |
| 1453 | - if yyr2 || yy2arr2 { |
| 1454 | - if yyn3 { |
| 1455 | - r.WriteArrayElem() |
| 1456 | - r.EncodeNil() |
| 1457 | - } else { |
| 1458 | - r.WriteArrayElem() |
| 1459 | - if x.Name == nil { |
| 1460 | - r.EncodeNil() |
| 1461 | - } else { |
| 1462 | - x.Name.CodecEncodeSelf(e) |
| 1463 | - } |
| 1464 | - } |
| 1465 | - } else { |
| 1466 | - r.WriteMapElemKey() |
| 1467 | - if z.IsJSONHandle() { |
| 1468 | - z.WriteStr("\"Name\"") |
| 1469 | - } else { |
| 1470 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Name`) |
| 1471 | - } |
| 1472 | - r.WriteMapElemValue() |
| 1473 | - if yyn3 { |
| 1474 | - r.EncodeNil() |
| 1475 | - } else { |
| 1476 | - if x.Name == nil { |
| 1477 | - r.EncodeNil() |
| 1478 | - } else { |
| 1479 | - x.Name.CodecEncodeSelf(e) |
| 1480 | - } |
| 1481 | - } |
| 1482 | - } |
| 1483 | - var yyn6 bool |
| 1484 | - if x.Github == nil { |
| 1485 | - yyn6 = true |
| 1486 | - goto LABEL6 |
| 1487 | - } |
| 1488 | - LABEL6: |
| 1489 | - if yyr2 || yy2arr2 { |
| 1490 | - if yyn6 { |
| 1491 | - r.WriteArrayElem() |
| 1492 | - r.EncodeNil() |
| 1493 | - } else { |
| 1494 | - r.WriteArrayElem() |
| 1495 | - if x.Github == nil { |
| 1496 | - r.EncodeNil() |
| 1497 | - } else { |
| 1498 | - x.Github.CodecEncodeSelf(e) |
| 1499 | - } |
| 1500 | - } |
| 1501 | - } else { |
| 1502 | - r.WriteMapElemKey() |
| 1503 | - if z.IsJSONHandle() { |
| 1504 | - z.WriteStr("\"Github\"") |
| 1505 | - } else { |
| 1506 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Github`) |
| 1507 | - } |
| 1508 | - r.WriteMapElemValue() |
| 1509 | - if yyn6 { |
| 1510 | - r.EncodeNil() |
| 1511 | - } else { |
| 1512 | - if x.Github == nil { |
| 1513 | - r.EncodeNil() |
| 1514 | - } else { |
| 1515 | - x.Github.CodecEncodeSelf(e) |
| 1516 | - } |
| 1517 | - } |
| 1518 | - } |
| 1519 | - var yyn9 bool |
| 1520 | - if x.Gravatar == nil { |
| 1521 | - yyn9 = true |
| 1522 | - goto LABEL9 |
| 1523 | - } |
| 1524 | - LABEL9: |
| 1525 | - if yyr2 || yy2arr2 { |
| 1526 | - if yyn9 { |
| 1527 | - r.WriteArrayElem() |
| 1528 | - r.EncodeNil() |
| 1529 | - } else { |
| 1530 | - r.WriteArrayElem() |
| 1531 | - if x.Gravatar == nil { |
| 1532 | - r.EncodeNil() |
| 1533 | - } else { |
| 1534 | - x.Gravatar.CodecEncodeSelf(e) |
| 1535 | - } |
| 1536 | - } |
| 1537 | - } else { |
| 1538 | - r.WriteMapElemKey() |
| 1539 | - if z.IsJSONHandle() { |
| 1540 | - z.WriteStr("\"Gravatar\"") |
| 1541 | - } else { |
| 1542 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Gravatar`) |
| 1543 | - } |
| 1544 | - r.WriteMapElemValue() |
| 1545 | - if yyn9 { |
| 1546 | - r.EncodeNil() |
| 1547 | - } else { |
| 1548 | - if x.Gravatar == nil { |
| 1549 | - r.EncodeNil() |
| 1550 | - } else { |
| 1551 | - x.Gravatar.CodecEncodeSelf(e) |
| 1552 | - } |
| 1553 | - } |
| 1554 | - } |
| 1555 | - if yyr2 || yy2arr2 { |
| 1556 | - r.WriteArrayEnd() |
| 1557 | - } else { |
| 1558 | - r.WriteMapEnd() |
| 1559 | - } |
| 1560 | - } |
| 1561 | - } |
| 1562 | -} |
| 1563 | - |
| 1564 | -// Benchmark harness support for STK-REQ-004. |
| 1565 | -func (x *CBPerson) CodecDecodeSelf(d *codec1978.Decoder) { |
| 1566 | - var h codecSelfer6617 |
| 1567 | - z, r := codec1978.GenHelperDecoder(d) |
| 1568 | - _, _, _ = h, z, r |
| 1569 | - if false { |
| 1570 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1571 | - z.DecExtension(x, yyxt1) |
| 1572 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 1573 | - z.DecJSONUnmarshal(x) |
| 1574 | - } else { |
| 1575 | - yyct2 := r.ContainerType() |
| 1576 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 1577 | - yyl2 := r.ReadMapStart() |
| 1578 | - if yyl2 == 0 { |
| 1579 | - r.ReadMapEnd() |
| 1580 | - } else { |
| 1581 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 1582 | - } |
| 1583 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 1584 | - yyl2 := r.ReadArrayStart() |
| 1585 | - if yyl2 == 0 { |
| 1586 | - r.ReadArrayEnd() |
| 1587 | - } else { |
| 1588 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 1589 | - } |
| 1590 | - } else { |
| 1591 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 1592 | - } |
| 1593 | - } |
| 1594 | -} |
| 1595 | - |
| 1596 | -// Benchmark harness support for STK-REQ-004. |
| 1597 | -func (x *CBPerson) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 1598 | - var h codecSelfer6617 |
| 1599 | - z, r := codec1978.GenHelperDecoder(d) |
| 1600 | - _, _, _ = h, z, r |
| 1601 | - var yyhl3 bool = l >= 0 |
| 1602 | - for yyj3 := 0; ; yyj3++ { |
| 1603 | - if yyhl3 { |
| 1604 | - if yyj3 >= l { |
| 1605 | - break |
| 1606 | - } |
| 1607 | - } else { |
| 1608 | - if r.CheckBreak() { |
| 1609 | - break |
| 1610 | - } |
| 1611 | - } |
| 1612 | - r.ReadMapElemKey() |
| 1613 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 1614 | - r.ReadMapElemValue() |
| 1615 | - switch yys3 { |
| 1616 | - case "Name": |
| 1617 | - if r.TryDecodeAsNil() { |
| 1618 | - if true && x.Name != nil { |
| 1619 | - x.Name = nil |
| 1620 | - } |
| 1621 | - } else { |
| 1622 | - if x.Name == nil { |
| 1623 | - x.Name = new(CBName) |
| 1624 | - } |
| 1625 | - |
| 1626 | - x.Name.CodecDecodeSelf(d) |
| 1627 | - } |
| 1628 | - case "Github": |
| 1629 | - if r.TryDecodeAsNil() { |
| 1630 | - if true && x.Github != nil { |
| 1631 | - x.Github = nil |
| 1632 | - } |
| 1633 | - } else { |
| 1634 | - if x.Github == nil { |
| 1635 | - x.Github = new(CBGithub) |
| 1636 | - } |
| 1637 | - |
| 1638 | - x.Github.CodecDecodeSelf(d) |
| 1639 | - } |
| 1640 | - case "Gravatar": |
| 1641 | - if r.TryDecodeAsNil() { |
| 1642 | - if true && x.Gravatar != nil { |
| 1643 | - x.Gravatar = nil |
| 1644 | - } |
| 1645 | - } else { |
| 1646 | - if x.Gravatar == nil { |
| 1647 | - x.Gravatar = new(CBGravatar) |
| 1648 | - } |
| 1649 | - |
| 1650 | - x.Gravatar.CodecDecodeSelf(d) |
| 1651 | - } |
| 1652 | - default: |
| 1653 | - z.DecStructFieldNotFound(-1, yys3) |
| 1654 | - } // end switch yys3 |
| 1655 | - } // end for yyj3 |
| 1656 | - r.ReadMapEnd() |
| 1657 | -} |
| 1658 | - |
| 1659 | -// Benchmark harness support for STK-REQ-004. |
| 1660 | -func (x *CBPerson) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 1661 | - var h codecSelfer6617 |
| 1662 | - z, r := codec1978.GenHelperDecoder(d) |
| 1663 | - _, _, _ = h, z, r |
| 1664 | - var yyj7 int |
| 1665 | - var yyb7 bool |
| 1666 | - var yyhl7 bool = l >= 0 |
| 1667 | - yyj7++ |
| 1668 | - if yyhl7 { |
| 1669 | - yyb7 = yyj7 > l |
| 1670 | - } else { |
| 1671 | - yyb7 = r.CheckBreak() |
| 1672 | - } |
| 1673 | - if yyb7 { |
| 1674 | - r.ReadArrayEnd() |
| 1675 | - return |
| 1676 | - } |
| 1677 | - r.ReadArrayElem() |
| 1678 | - if r.TryDecodeAsNil() { |
| 1679 | - if true && x.Name != nil { |
| 1680 | - x.Name = nil |
| 1681 | - } |
| 1682 | - } else { |
| 1683 | - if x.Name == nil { |
| 1684 | - x.Name = new(CBName) |
| 1685 | - } |
| 1686 | - |
| 1687 | - x.Name.CodecDecodeSelf(d) |
| 1688 | - } |
| 1689 | - yyj7++ |
| 1690 | - if yyhl7 { |
| 1691 | - yyb7 = yyj7 > l |
| 1692 | - } else { |
| 1693 | - yyb7 = r.CheckBreak() |
| 1694 | - } |
| 1695 | - if yyb7 { |
| 1696 | - r.ReadArrayEnd() |
| 1697 | - return |
| 1698 | - } |
| 1699 | - r.ReadArrayElem() |
| 1700 | - if r.TryDecodeAsNil() { |
| 1701 | - if true && x.Github != nil { |
| 1702 | - x.Github = nil |
| 1703 | - } |
| 1704 | - } else { |
| 1705 | - if x.Github == nil { |
| 1706 | - x.Github = new(CBGithub) |
| 1707 | - } |
| 1708 | - |
| 1709 | - x.Github.CodecDecodeSelf(d) |
| 1710 | - } |
| 1711 | - yyj7++ |
| 1712 | - if yyhl7 { |
| 1713 | - yyb7 = yyj7 > l |
| 1714 | - } else { |
| 1715 | - yyb7 = r.CheckBreak() |
| 1716 | - } |
| 1717 | - if yyb7 { |
| 1718 | - r.ReadArrayEnd() |
| 1719 | - return |
| 1720 | - } |
| 1721 | - r.ReadArrayElem() |
| 1722 | - if r.TryDecodeAsNil() { |
| 1723 | - if true && x.Gravatar != nil { |
| 1724 | - x.Gravatar = nil |
| 1725 | - } |
| 1726 | - } else { |
| 1727 | - if x.Gravatar == nil { |
| 1728 | - x.Gravatar = new(CBGravatar) |
| 1729 | - } |
| 1730 | - |
| 1731 | - x.Gravatar.CodecDecodeSelf(d) |
| 1732 | - } |
| 1733 | - for { |
| 1734 | - yyj7++ |
| 1735 | - if yyhl7 { |
| 1736 | - yyb7 = yyj7 > l |
| 1737 | - } else { |
| 1738 | - yyb7 = r.CheckBreak() |
| 1739 | - } |
| 1740 | - if yyb7 { |
| 1741 | - break |
| 1742 | - } |
| 1743 | - r.ReadArrayElem() |
| 1744 | - z.DecStructFieldNotFound(yyj7-1, "") |
| 1745 | - } |
| 1746 | - r.ReadArrayEnd() |
| 1747 | -} |
| 1748 | - |
| 1749 | -// Benchmark harness support for STK-REQ-004. |
| 1750 | -func (x *MediumPayload) CodecEncodeSelf(e *codec1978.Encoder) { |
| 1751 | - var h codecSelfer6617 |
| 1752 | - z, r := codec1978.GenHelperEncoder(e) |
| 1753 | - _, _, _ = h, z, r |
| 1754 | - if x == nil { |
| 1755 | - r.EncodeNil() |
| 1756 | - } else { |
| 1757 | - if false { |
| 1758 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1759 | - z.EncExtension(x, yyxt1) |
| 1760 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 1761 | - z.EncJSONMarshal(x) |
| 1762 | - } else { |
| 1763 | - yysep2 := !z.EncBinary() |
| 1764 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 1765 | - _, _ = yysep2, yy2arr2 |
| 1766 | - const yyr2 bool = false // struct tag has 'toArray' |
| 1767 | - if yyr2 || yy2arr2 { |
| 1768 | - r.WriteArrayStart(2) |
| 1769 | - } else { |
| 1770 | - r.WriteMapStart(2) |
| 1771 | - } |
| 1772 | - var yyn3 bool |
| 1773 | - if x.Person == nil { |
| 1774 | - yyn3 = true |
| 1775 | - goto LABEL3 |
| 1776 | - } |
| 1777 | - LABEL3: |
| 1778 | - if yyr2 || yy2arr2 { |
| 1779 | - if yyn3 { |
| 1780 | - r.WriteArrayElem() |
| 1781 | - r.EncodeNil() |
| 1782 | - } else { |
| 1783 | - r.WriteArrayElem() |
| 1784 | - if x.Person == nil { |
| 1785 | - r.EncodeNil() |
| 1786 | - } else { |
| 1787 | - x.Person.CodecEncodeSelf(e) |
| 1788 | - } |
| 1789 | - } |
| 1790 | - } else { |
| 1791 | - r.WriteMapElemKey() |
| 1792 | - if z.IsJSONHandle() { |
| 1793 | - z.WriteStr("\"Person\"") |
| 1794 | - } else { |
| 1795 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Person`) |
| 1796 | - } |
| 1797 | - r.WriteMapElemValue() |
| 1798 | - if yyn3 { |
| 1799 | - r.EncodeNil() |
| 1800 | - } else { |
| 1801 | - if x.Person == nil { |
| 1802 | - r.EncodeNil() |
| 1803 | - } else { |
| 1804 | - x.Person.CodecEncodeSelf(e) |
| 1805 | - } |
| 1806 | - } |
| 1807 | - } |
| 1808 | - if yyr2 || yy2arr2 { |
| 1809 | - r.WriteArrayElem() |
| 1810 | - if x.Company == nil { |
| 1811 | - r.EncodeNil() |
| 1812 | - } else { |
| 1813 | - if false { |
| 1814 | - } else { |
| 1815 | - z.F.EncMapStringIntfV(x.Company, e) |
| 1816 | - } |
| 1817 | - } |
| 1818 | - } else { |
| 1819 | - r.WriteMapElemKey() |
| 1820 | - if z.IsJSONHandle() { |
| 1821 | - z.WriteStr("\"Company\"") |
| 1822 | - } else { |
| 1823 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Company`) |
| 1824 | - } |
| 1825 | - r.WriteMapElemValue() |
| 1826 | - if x.Company == nil { |
| 1827 | - r.EncodeNil() |
| 1828 | - } else { |
| 1829 | - if false { |
| 1830 | - } else { |
| 1831 | - z.F.EncMapStringIntfV(x.Company, e) |
| 1832 | - } |
| 1833 | - } |
| 1834 | - } |
| 1835 | - if yyr2 || yy2arr2 { |
| 1836 | - r.WriteArrayEnd() |
| 1837 | - } else { |
| 1838 | - r.WriteMapEnd() |
| 1839 | - } |
| 1840 | - } |
| 1841 | - } |
| 1842 | -} |
| 1843 | - |
| 1844 | -// Benchmark harness support for STK-REQ-004. |
| 1845 | -func (x *MediumPayload) CodecDecodeSelf(d *codec1978.Decoder) { |
| 1846 | - var h codecSelfer6617 |
| 1847 | - z, r := codec1978.GenHelperDecoder(d) |
| 1848 | - _, _, _ = h, z, r |
| 1849 | - if false { |
| 1850 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1851 | - z.DecExtension(x, yyxt1) |
| 1852 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 1853 | - z.DecJSONUnmarshal(x) |
| 1854 | - } else { |
| 1855 | - yyct2 := r.ContainerType() |
| 1856 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 1857 | - yyl2 := r.ReadMapStart() |
| 1858 | - if yyl2 == 0 { |
| 1859 | - r.ReadMapEnd() |
| 1860 | - } else { |
| 1861 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 1862 | - } |
| 1863 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 1864 | - yyl2 := r.ReadArrayStart() |
| 1865 | - if yyl2 == 0 { |
| 1866 | - r.ReadArrayEnd() |
| 1867 | - } else { |
| 1868 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 1869 | - } |
| 1870 | - } else { |
| 1871 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 1872 | - } |
| 1873 | - } |
| 1874 | -} |
| 1875 | - |
| 1876 | -// Benchmark harness support for STK-REQ-004. |
| 1877 | -func (x *MediumPayload) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 1878 | - var h codecSelfer6617 |
| 1879 | - z, r := codec1978.GenHelperDecoder(d) |
| 1880 | - _, _, _ = h, z, r |
| 1881 | - var yyhl3 bool = l >= 0 |
| 1882 | - for yyj3 := 0; ; yyj3++ { |
| 1883 | - if yyhl3 { |
| 1884 | - if yyj3 >= l { |
| 1885 | - break |
| 1886 | - } |
| 1887 | - } else { |
| 1888 | - if r.CheckBreak() { |
| 1889 | - break |
| 1890 | - } |
| 1891 | - } |
| 1892 | - r.ReadMapElemKey() |
| 1893 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 1894 | - r.ReadMapElemValue() |
| 1895 | - switch yys3 { |
| 1896 | - case "Person": |
| 1897 | - if r.TryDecodeAsNil() { |
| 1898 | - if true && x.Person != nil { |
| 1899 | - x.Person = nil |
| 1900 | - } |
| 1901 | - } else { |
| 1902 | - if x.Person == nil { |
| 1903 | - x.Person = new(CBPerson) |
| 1904 | - } |
| 1905 | - |
| 1906 | - x.Person.CodecDecodeSelf(d) |
| 1907 | - } |
| 1908 | - case "Company": |
| 1909 | - if r.TryDecodeAsNil() { |
| 1910 | - x.Company = nil |
| 1911 | - } else { |
| 1912 | - if false { |
| 1913 | - } else { |
| 1914 | - z.F.DecMapStringIntfX(&x.Company, d) |
| 1915 | - } |
| 1916 | - } |
| 1917 | - default: |
| 1918 | - z.DecStructFieldNotFound(-1, yys3) |
| 1919 | - } // end switch yys3 |
| 1920 | - } // end for yyj3 |
| 1921 | - r.ReadMapEnd() |
| 1922 | -} |
| 1923 | - |
| 1924 | -// Benchmark harness support for STK-REQ-004. |
| 1925 | -func (x *MediumPayload) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 1926 | - var h codecSelfer6617 |
| 1927 | - z, r := codec1978.GenHelperDecoder(d) |
| 1928 | - _, _, _ = h, z, r |
| 1929 | - var yyj7 int |
| 1930 | - var yyb7 bool |
| 1931 | - var yyhl7 bool = l >= 0 |
| 1932 | - yyj7++ |
| 1933 | - if yyhl7 { |
| 1934 | - yyb7 = yyj7 > l |
| 1935 | - } else { |
| 1936 | - yyb7 = r.CheckBreak() |
| 1937 | - } |
| 1938 | - if yyb7 { |
| 1939 | - r.ReadArrayEnd() |
| 1940 | - return |
| 1941 | - } |
| 1942 | - r.ReadArrayElem() |
| 1943 | - if r.TryDecodeAsNil() { |
| 1944 | - if true && x.Person != nil { |
| 1945 | - x.Person = nil |
| 1946 | - } |
| 1947 | - } else { |
| 1948 | - if x.Person == nil { |
| 1949 | - x.Person = new(CBPerson) |
| 1950 | - } |
| 1951 | - |
| 1952 | - x.Person.CodecDecodeSelf(d) |
| 1953 | - } |
| 1954 | - yyj7++ |
| 1955 | - if yyhl7 { |
| 1956 | - yyb7 = yyj7 > l |
| 1957 | - } else { |
| 1958 | - yyb7 = r.CheckBreak() |
| 1959 | - } |
| 1960 | - if yyb7 { |
| 1961 | - r.ReadArrayEnd() |
| 1962 | - return |
| 1963 | - } |
| 1964 | - r.ReadArrayElem() |
| 1965 | - if r.TryDecodeAsNil() { |
| 1966 | - x.Company = nil |
| 1967 | - } else { |
| 1968 | - if false { |
| 1969 | - } else { |
| 1970 | - z.F.DecMapStringIntfX(&x.Company, d) |
| 1971 | - } |
| 1972 | - } |
| 1973 | - for { |
| 1974 | - yyj7++ |
| 1975 | - if yyhl7 { |
| 1976 | - yyb7 = yyj7 > l |
| 1977 | - } else { |
| 1978 | - yyb7 = r.CheckBreak() |
| 1979 | - } |
| 1980 | - if yyb7 { |
| 1981 | - break |
| 1982 | - } |
| 1983 | - r.ReadArrayElem() |
| 1984 | - z.DecStructFieldNotFound(yyj7-1, "") |
| 1985 | - } |
| 1986 | - r.ReadArrayEnd() |
| 1987 | -} |
| 1988 | - |
| 1989 | -// Benchmark harness support for STK-REQ-004. |
| 1990 | -func (x *DSUser) CodecEncodeSelf(e *codec1978.Encoder) { |
| 1991 | - var h codecSelfer6617 |
| 1992 | - z, r := codec1978.GenHelperEncoder(e) |
| 1993 | - _, _, _ = h, z, r |
| 1994 | - if x == nil { |
| 1995 | - r.EncodeNil() |
| 1996 | - } else { |
| 1997 | - if false { |
| 1998 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 1999 | - z.EncExtension(x, yyxt1) |
| 2000 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 2001 | - z.EncJSONMarshal(x) |
| 2002 | - } else { |
| 2003 | - yysep2 := !z.EncBinary() |
| 2004 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 2005 | - _, _ = yysep2, yy2arr2 |
| 2006 | - const yyr2 bool = false // struct tag has 'toArray' |
| 2007 | - if yyr2 || yy2arr2 { |
| 2008 | - r.WriteArrayStart(1) |
| 2009 | - } else { |
| 2010 | - r.WriteMapStart(1) |
| 2011 | - } |
| 2012 | - if yyr2 || yy2arr2 { |
| 2013 | - r.WriteArrayElem() |
| 2014 | - if false { |
| 2015 | - } else { |
| 2016 | - if z.EncBasicHandle().StringToRaw { |
| 2017 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Username))) |
| 2018 | - } else { |
| 2019 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Username)) |
| 2020 | - } |
| 2021 | - } |
| 2022 | - } else { |
| 2023 | - r.WriteMapElemKey() |
| 2024 | - if z.IsJSONHandle() { |
| 2025 | - z.WriteStr("\"Username\"") |
| 2026 | - } else { |
| 2027 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Username`) |
| 2028 | - } |
| 2029 | - r.WriteMapElemValue() |
| 2030 | - if false { |
| 2031 | - } else { |
| 2032 | - if z.EncBasicHandle().StringToRaw { |
| 2033 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Username))) |
| 2034 | - } else { |
| 2035 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Username)) |
| 2036 | - } |
| 2037 | - } |
| 2038 | - } |
| 2039 | - if yyr2 || yy2arr2 { |
| 2040 | - r.WriteArrayEnd() |
| 2041 | - } else { |
| 2042 | - r.WriteMapEnd() |
| 2043 | - } |
| 2044 | - } |
| 2045 | - } |
| 2046 | -} |
| 2047 | - |
| 2048 | -// Benchmark harness support for STK-REQ-004. |
| 2049 | -func (x *DSUser) CodecDecodeSelf(d *codec1978.Decoder) { |
| 2050 | - var h codecSelfer6617 |
| 2051 | - z, r := codec1978.GenHelperDecoder(d) |
| 2052 | - _, _, _ = h, z, r |
| 2053 | - if false { |
| 2054 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2055 | - z.DecExtension(x, yyxt1) |
| 2056 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 2057 | - z.DecJSONUnmarshal(x) |
| 2058 | - } else { |
| 2059 | - yyct2 := r.ContainerType() |
| 2060 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 2061 | - yyl2 := r.ReadMapStart() |
| 2062 | - if yyl2 == 0 { |
| 2063 | - r.ReadMapEnd() |
| 2064 | - } else { |
| 2065 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 2066 | - } |
| 2067 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 2068 | - yyl2 := r.ReadArrayStart() |
| 2069 | - if yyl2 == 0 { |
| 2070 | - r.ReadArrayEnd() |
| 2071 | - } else { |
| 2072 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 2073 | - } |
| 2074 | - } else { |
| 2075 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 2076 | - } |
| 2077 | - } |
| 2078 | -} |
| 2079 | - |
| 2080 | -// Benchmark harness support for STK-REQ-004. |
| 2081 | -func (x *DSUser) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 2082 | - var h codecSelfer6617 |
| 2083 | - z, r := codec1978.GenHelperDecoder(d) |
| 2084 | - _, _, _ = h, z, r |
| 2085 | - var yyhl3 bool = l >= 0 |
| 2086 | - for yyj3 := 0; ; yyj3++ { |
| 2087 | - if yyhl3 { |
| 2088 | - if yyj3 >= l { |
| 2089 | - break |
| 2090 | - } |
| 2091 | - } else { |
| 2092 | - if r.CheckBreak() { |
| 2093 | - break |
| 2094 | - } |
| 2095 | - } |
| 2096 | - r.ReadMapElemKey() |
| 2097 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 2098 | - r.ReadMapElemValue() |
| 2099 | - switch yys3 { |
| 2100 | - case "Username": |
| 2101 | - if r.TryDecodeAsNil() { |
| 2102 | - x.Username = "" |
| 2103 | - } else { |
| 2104 | - x.Username = (string)(r.DecodeString()) |
| 2105 | - } |
| 2106 | - default: |
| 2107 | - z.DecStructFieldNotFound(-1, yys3) |
| 2108 | - } // end switch yys3 |
| 2109 | - } // end for yyj3 |
| 2110 | - r.ReadMapEnd() |
| 2111 | -} |
| 2112 | - |
| 2113 | -// Benchmark harness support for STK-REQ-004. |
| 2114 | -func (x *DSUser) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 2115 | - var h codecSelfer6617 |
| 2116 | - z, r := codec1978.GenHelperDecoder(d) |
| 2117 | - _, _, _ = h, z, r |
| 2118 | - var yyj5 int |
| 2119 | - var yyb5 bool |
| 2120 | - var yyhl5 bool = l >= 0 |
| 2121 | - yyj5++ |
| 2122 | - if yyhl5 { |
| 2123 | - yyb5 = yyj5 > l |
| 2124 | - } else { |
| 2125 | - yyb5 = r.CheckBreak() |
| 2126 | - } |
| 2127 | - if yyb5 { |
| 2128 | - r.ReadArrayEnd() |
| 2129 | - return |
| 2130 | - } |
| 2131 | - r.ReadArrayElem() |
| 2132 | - if r.TryDecodeAsNil() { |
| 2133 | - x.Username = "" |
| 2134 | - } else { |
| 2135 | - x.Username = (string)(r.DecodeString()) |
| 2136 | - } |
| 2137 | - for { |
| 2138 | - yyj5++ |
| 2139 | - if yyhl5 { |
| 2140 | - yyb5 = yyj5 > l |
| 2141 | - } else { |
| 2142 | - yyb5 = r.CheckBreak() |
| 2143 | - } |
| 2144 | - if yyb5 { |
| 2145 | - break |
| 2146 | - } |
| 2147 | - r.ReadArrayElem() |
| 2148 | - z.DecStructFieldNotFound(yyj5-1, "") |
| 2149 | - } |
| 2150 | - r.ReadArrayEnd() |
| 2151 | -} |
| 2152 | - |
| 2153 | -// Benchmark harness support for STK-REQ-004. |
| 2154 | -func (x *DSTopic) CodecEncodeSelf(e *codec1978.Encoder) { |
| 2155 | - var h codecSelfer6617 |
| 2156 | - z, r := codec1978.GenHelperEncoder(e) |
| 2157 | - _, _, _ = h, z, r |
| 2158 | - if x == nil { |
| 2159 | - r.EncodeNil() |
| 2160 | - } else { |
| 2161 | - if false { |
| 2162 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2163 | - z.EncExtension(x, yyxt1) |
| 2164 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 2165 | - z.EncJSONMarshal(x) |
| 2166 | - } else { |
| 2167 | - yysep2 := !z.EncBinary() |
| 2168 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 2169 | - _, _ = yysep2, yy2arr2 |
| 2170 | - const yyr2 bool = false // struct tag has 'toArray' |
| 2171 | - if yyr2 || yy2arr2 { |
| 2172 | - r.WriteArrayStart(2) |
| 2173 | - } else { |
| 2174 | - r.WriteMapStart(2) |
| 2175 | - } |
| 2176 | - if yyr2 || yy2arr2 { |
| 2177 | - r.WriteArrayElem() |
| 2178 | - if false { |
| 2179 | - } else { |
| 2180 | - r.EncodeInt(int64(x.Id)) |
| 2181 | - } |
| 2182 | - } else { |
| 2183 | - r.WriteMapElemKey() |
| 2184 | - if z.IsJSONHandle() { |
| 2185 | - z.WriteStr("\"Id\"") |
| 2186 | - } else { |
| 2187 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Id`) |
| 2188 | - } |
| 2189 | - r.WriteMapElemValue() |
| 2190 | - if false { |
| 2191 | - } else { |
| 2192 | - r.EncodeInt(int64(x.Id)) |
| 2193 | - } |
| 2194 | - } |
| 2195 | - if yyr2 || yy2arr2 { |
| 2196 | - r.WriteArrayElem() |
| 2197 | - if false { |
| 2198 | - } else { |
| 2199 | - if z.EncBasicHandle().StringToRaw { |
| 2200 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Slug))) |
| 2201 | - } else { |
| 2202 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Slug)) |
| 2203 | - } |
| 2204 | - } |
| 2205 | - } else { |
| 2206 | - r.WriteMapElemKey() |
| 2207 | - if z.IsJSONHandle() { |
| 2208 | - z.WriteStr("\"Slug\"") |
| 2209 | - } else { |
| 2210 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Slug`) |
| 2211 | - } |
| 2212 | - r.WriteMapElemValue() |
| 2213 | - if false { |
| 2214 | - } else { |
| 2215 | - if z.EncBasicHandle().StringToRaw { |
| 2216 | - r.EncodeStringBytesRaw(z.BytesView(string(x.Slug))) |
| 2217 | - } else { |
| 2218 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.Slug)) |
| 2219 | - } |
| 2220 | - } |
| 2221 | - } |
| 2222 | - if yyr2 || yy2arr2 { |
| 2223 | - r.WriteArrayEnd() |
| 2224 | - } else { |
| 2225 | - r.WriteMapEnd() |
| 2226 | - } |
| 2227 | - } |
| 2228 | - } |
| 2229 | -} |
| 2230 | - |
| 2231 | -// Benchmark harness support for STK-REQ-004. |
| 2232 | -func (x *DSTopic) CodecDecodeSelf(d *codec1978.Decoder) { |
| 2233 | - var h codecSelfer6617 |
| 2234 | - z, r := codec1978.GenHelperDecoder(d) |
| 2235 | - _, _, _ = h, z, r |
| 2236 | - if false { |
| 2237 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2238 | - z.DecExtension(x, yyxt1) |
| 2239 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 2240 | - z.DecJSONUnmarshal(x) |
| 2241 | - } else { |
| 2242 | - yyct2 := r.ContainerType() |
| 2243 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 2244 | - yyl2 := r.ReadMapStart() |
| 2245 | - if yyl2 == 0 { |
| 2246 | - r.ReadMapEnd() |
| 2247 | - } else { |
| 2248 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 2249 | - } |
| 2250 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 2251 | - yyl2 := r.ReadArrayStart() |
| 2252 | - if yyl2 == 0 { |
| 2253 | - r.ReadArrayEnd() |
| 2254 | - } else { |
| 2255 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 2256 | - } |
| 2257 | - } else { |
| 2258 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 2259 | - } |
| 2260 | - } |
| 2261 | -} |
| 2262 | - |
| 2263 | -// Benchmark harness support for STK-REQ-004. |
| 2264 | -func (x *DSTopic) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 2265 | - var h codecSelfer6617 |
| 2266 | - z, r := codec1978.GenHelperDecoder(d) |
| 2267 | - _, _, _ = h, z, r |
| 2268 | - var yyhl3 bool = l >= 0 |
| 2269 | - for yyj3 := 0; ; yyj3++ { |
| 2270 | - if yyhl3 { |
| 2271 | - if yyj3 >= l { |
| 2272 | - break |
| 2273 | - } |
| 2274 | - } else { |
| 2275 | - if r.CheckBreak() { |
| 2276 | - break |
| 2277 | - } |
| 2278 | - } |
| 2279 | - r.ReadMapElemKey() |
| 2280 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 2281 | - r.ReadMapElemValue() |
| 2282 | - switch yys3 { |
| 2283 | - case "Id": |
| 2284 | - if r.TryDecodeAsNil() { |
| 2285 | - x.Id = 0 |
| 2286 | - } else { |
| 2287 | - x.Id = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 2288 | - } |
| 2289 | - case "Slug": |
| 2290 | - if r.TryDecodeAsNil() { |
| 2291 | - x.Slug = "" |
| 2292 | - } else { |
| 2293 | - x.Slug = (string)(r.DecodeString()) |
| 2294 | - } |
| 2295 | - default: |
| 2296 | - z.DecStructFieldNotFound(-1, yys3) |
| 2297 | - } // end switch yys3 |
| 2298 | - } // end for yyj3 |
| 2299 | - r.ReadMapEnd() |
| 2300 | -} |
| 2301 | - |
| 2302 | -// Benchmark harness support for STK-REQ-004. |
| 2303 | -func (x *DSTopic) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 2304 | - var h codecSelfer6617 |
| 2305 | - z, r := codec1978.GenHelperDecoder(d) |
| 2306 | - _, _, _ = h, z, r |
| 2307 | - var yyj6 int |
| 2308 | - var yyb6 bool |
| 2309 | - var yyhl6 bool = l >= 0 |
| 2310 | - yyj6++ |
| 2311 | - if yyhl6 { |
| 2312 | - yyb6 = yyj6 > l |
| 2313 | - } else { |
| 2314 | - yyb6 = r.CheckBreak() |
| 2315 | - } |
| 2316 | - if yyb6 { |
| 2317 | - r.ReadArrayEnd() |
| 2318 | - return |
| 2319 | - } |
| 2320 | - r.ReadArrayElem() |
| 2321 | - if r.TryDecodeAsNil() { |
| 2322 | - x.Id = 0 |
| 2323 | - } else { |
| 2324 | - x.Id = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize6617)) |
| 2325 | - } |
| 2326 | - yyj6++ |
| 2327 | - if yyhl6 { |
| 2328 | - yyb6 = yyj6 > l |
| 2329 | - } else { |
| 2330 | - yyb6 = r.CheckBreak() |
| 2331 | - } |
| 2332 | - if yyb6 { |
| 2333 | - r.ReadArrayEnd() |
| 2334 | - return |
| 2335 | - } |
| 2336 | - r.ReadArrayElem() |
| 2337 | - if r.TryDecodeAsNil() { |
| 2338 | - x.Slug = "" |
| 2339 | - } else { |
| 2340 | - x.Slug = (string)(r.DecodeString()) |
| 2341 | - } |
| 2342 | - for { |
| 2343 | - yyj6++ |
| 2344 | - if yyhl6 { |
| 2345 | - yyb6 = yyj6 > l |
| 2346 | - } else { |
| 2347 | - yyb6 = r.CheckBreak() |
| 2348 | - } |
| 2349 | - if yyb6 { |
| 2350 | - break |
| 2351 | - } |
| 2352 | - r.ReadArrayElem() |
| 2353 | - z.DecStructFieldNotFound(yyj6-1, "") |
| 2354 | - } |
| 2355 | - r.ReadArrayEnd() |
| 2356 | -} |
| 2357 | - |
| 2358 | -// Benchmark harness support for STK-REQ-004. |
| 2359 | -func (x *DSTopicsList) CodecEncodeSelf(e *codec1978.Encoder) { |
| 2360 | - var h codecSelfer6617 |
| 2361 | - z, r := codec1978.GenHelperEncoder(e) |
| 2362 | - _, _, _ = h, z, r |
| 2363 | - if x == nil { |
| 2364 | - r.EncodeNil() |
| 2365 | - } else { |
| 2366 | - if false { |
| 2367 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2368 | - z.EncExtension(x, yyxt1) |
| 2369 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 2370 | - z.EncJSONMarshal(x) |
| 2371 | - } else { |
| 2372 | - yysep2 := !z.EncBinary() |
| 2373 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 2374 | - _, _ = yysep2, yy2arr2 |
| 2375 | - const yyr2 bool = false // struct tag has 'toArray' |
| 2376 | - if yyr2 || yy2arr2 { |
| 2377 | - r.WriteArrayStart(2) |
| 2378 | - } else { |
| 2379 | - r.WriteMapStart(2) |
| 2380 | - } |
| 2381 | - if yyr2 || yy2arr2 { |
| 2382 | - r.WriteArrayElem() |
| 2383 | - if x.Topics == nil { |
| 2384 | - r.EncodeNil() |
| 2385 | - } else { |
| 2386 | - if false { |
| 2387 | - } else { |
| 2388 | - h.encSlicePtrtoDSTopic(([]*DSTopic)(x.Topics), e) |
| 2389 | - } |
| 2390 | - } |
| 2391 | - } else { |
| 2392 | - r.WriteMapElemKey() |
| 2393 | - if z.IsJSONHandle() { |
| 2394 | - z.WriteStr("\"Topics\"") |
| 2395 | - } else { |
| 2396 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Topics`) |
| 2397 | - } |
| 2398 | - r.WriteMapElemValue() |
| 2399 | - if x.Topics == nil { |
| 2400 | - r.EncodeNil() |
| 2401 | - } else { |
| 2402 | - if false { |
| 2403 | - } else { |
| 2404 | - h.encSlicePtrtoDSTopic(([]*DSTopic)(x.Topics), e) |
| 2405 | - } |
| 2406 | - } |
| 2407 | - } |
| 2408 | - if yyr2 || yy2arr2 { |
| 2409 | - r.WriteArrayElem() |
| 2410 | - if false { |
| 2411 | - } else { |
| 2412 | - if z.EncBasicHandle().StringToRaw { |
| 2413 | - r.EncodeStringBytesRaw(z.BytesView(string(x.MoreTopicsUrl))) |
| 2414 | - } else { |
| 2415 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.MoreTopicsUrl)) |
| 2416 | - } |
| 2417 | - } |
| 2418 | - } else { |
| 2419 | - r.WriteMapElemKey() |
| 2420 | - if z.IsJSONHandle() { |
| 2421 | - z.WriteStr("\"MoreTopicsUrl\"") |
| 2422 | - } else { |
| 2423 | - r.EncodeStringEnc(codecSelferCcUTF86617, `MoreTopicsUrl`) |
| 2424 | - } |
| 2425 | - r.WriteMapElemValue() |
| 2426 | - if false { |
| 2427 | - } else { |
| 2428 | - if z.EncBasicHandle().StringToRaw { |
| 2429 | - r.EncodeStringBytesRaw(z.BytesView(string(x.MoreTopicsUrl))) |
| 2430 | - } else { |
| 2431 | - r.EncodeStringEnc(codecSelferCcUTF86617, string(x.MoreTopicsUrl)) |
| 2432 | - } |
| 2433 | - } |
| 2434 | - } |
| 2435 | - if yyr2 || yy2arr2 { |
| 2436 | - r.WriteArrayEnd() |
| 2437 | - } else { |
| 2438 | - r.WriteMapEnd() |
| 2439 | - } |
| 2440 | - } |
| 2441 | - } |
| 2442 | -} |
| 2443 | - |
| 2444 | -// Benchmark harness support for STK-REQ-004. |
| 2445 | -func (x *DSTopicsList) CodecDecodeSelf(d *codec1978.Decoder) { |
| 2446 | - var h codecSelfer6617 |
| 2447 | - z, r := codec1978.GenHelperDecoder(d) |
| 2448 | - _, _, _ = h, z, r |
| 2449 | - if false { |
| 2450 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2451 | - z.DecExtension(x, yyxt1) |
| 2452 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 2453 | - z.DecJSONUnmarshal(x) |
| 2454 | - } else { |
| 2455 | - yyct2 := r.ContainerType() |
| 2456 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 2457 | - yyl2 := r.ReadMapStart() |
| 2458 | - if yyl2 == 0 { |
| 2459 | - r.ReadMapEnd() |
| 2460 | - } else { |
| 2461 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 2462 | - } |
| 2463 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 2464 | - yyl2 := r.ReadArrayStart() |
| 2465 | - if yyl2 == 0 { |
| 2466 | - r.ReadArrayEnd() |
| 2467 | - } else { |
| 2468 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 2469 | - } |
| 2470 | - } else { |
| 2471 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 2472 | - } |
| 2473 | - } |
| 2474 | -} |
| 2475 | - |
| 2476 | -// Benchmark harness support for STK-REQ-004. |
| 2477 | -func (x *DSTopicsList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 2478 | - var h codecSelfer6617 |
| 2479 | - z, r := codec1978.GenHelperDecoder(d) |
| 2480 | - _, _, _ = h, z, r |
| 2481 | - var yyhl3 bool = l >= 0 |
| 2482 | - for yyj3 := 0; ; yyj3++ { |
| 2483 | - if yyhl3 { |
| 2484 | - if yyj3 >= l { |
| 2485 | - break |
| 2486 | - } |
| 2487 | - } else { |
| 2488 | - if r.CheckBreak() { |
| 2489 | - break |
| 2490 | - } |
| 2491 | - } |
| 2492 | - r.ReadMapElemKey() |
| 2493 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 2494 | - r.ReadMapElemValue() |
| 2495 | - switch yys3 { |
| 2496 | - case "Topics": |
| 2497 | - if r.TryDecodeAsNil() { |
| 2498 | - x.Topics = nil |
| 2499 | - } else { |
| 2500 | - if false { |
| 2501 | - } else { |
| 2502 | - h.decSlicePtrtoDSTopic((*[]*DSTopic)(&x.Topics), d) |
| 2503 | - } |
| 2504 | - } |
| 2505 | - case "MoreTopicsUrl": |
| 2506 | - if r.TryDecodeAsNil() { |
| 2507 | - x.MoreTopicsUrl = "" |
| 2508 | - } else { |
| 2509 | - x.MoreTopicsUrl = (string)(r.DecodeString()) |
| 2510 | - } |
| 2511 | - default: |
| 2512 | - z.DecStructFieldNotFound(-1, yys3) |
| 2513 | - } // end switch yys3 |
| 2514 | - } // end for yyj3 |
| 2515 | - r.ReadMapEnd() |
| 2516 | -} |
| 2517 | - |
| 2518 | -// Benchmark harness support for STK-REQ-004. |
| 2519 | -func (x *DSTopicsList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 2520 | - var h codecSelfer6617 |
| 2521 | - z, r := codec1978.GenHelperDecoder(d) |
| 2522 | - _, _, _ = h, z, r |
| 2523 | - var yyj7 int |
| 2524 | - var yyb7 bool |
| 2525 | - var yyhl7 bool = l >= 0 |
| 2526 | - yyj7++ |
| 2527 | - if yyhl7 { |
| 2528 | - yyb7 = yyj7 > l |
| 2529 | - } else { |
| 2530 | - yyb7 = r.CheckBreak() |
| 2531 | - } |
| 2532 | - if yyb7 { |
| 2533 | - r.ReadArrayEnd() |
| 2534 | - return |
| 2535 | - } |
| 2536 | - r.ReadArrayElem() |
| 2537 | - if r.TryDecodeAsNil() { |
| 2538 | - x.Topics = nil |
| 2539 | - } else { |
| 2540 | - if false { |
| 2541 | - } else { |
| 2542 | - h.decSlicePtrtoDSTopic((*[]*DSTopic)(&x.Topics), d) |
| 2543 | - } |
| 2544 | - } |
| 2545 | - yyj7++ |
| 2546 | - if yyhl7 { |
| 2547 | - yyb7 = yyj7 > l |
| 2548 | - } else { |
| 2549 | - yyb7 = r.CheckBreak() |
| 2550 | - } |
| 2551 | - if yyb7 { |
| 2552 | - r.ReadArrayEnd() |
| 2553 | - return |
| 2554 | - } |
| 2555 | - r.ReadArrayElem() |
| 2556 | - if r.TryDecodeAsNil() { |
| 2557 | - x.MoreTopicsUrl = "" |
| 2558 | - } else { |
| 2559 | - x.MoreTopicsUrl = (string)(r.DecodeString()) |
| 2560 | - } |
| 2561 | - for { |
| 2562 | - yyj7++ |
| 2563 | - if yyhl7 { |
| 2564 | - yyb7 = yyj7 > l |
| 2565 | - } else { |
| 2566 | - yyb7 = r.CheckBreak() |
| 2567 | - } |
| 2568 | - if yyb7 { |
| 2569 | - break |
| 2570 | - } |
| 2571 | - r.ReadArrayElem() |
| 2572 | - z.DecStructFieldNotFound(yyj7-1, "") |
| 2573 | - } |
| 2574 | - r.ReadArrayEnd() |
| 2575 | -} |
| 2576 | - |
| 2577 | -// Benchmark harness support for STK-REQ-004. |
| 2578 | -func (x *LargePayload) CodecEncodeSelf(e *codec1978.Encoder) { |
| 2579 | - var h codecSelfer6617 |
| 2580 | - z, r := codec1978.GenHelperEncoder(e) |
| 2581 | - _, _, _ = h, z, r |
| 2582 | - if x == nil { |
| 2583 | - r.EncodeNil() |
| 2584 | - } else { |
| 2585 | - if false { |
| 2586 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2587 | - z.EncExtension(x, yyxt1) |
| 2588 | - } else if !z.EncBinary() && z.IsJSONHandle() { |
| 2589 | - z.EncJSONMarshal(x) |
| 2590 | - } else { |
| 2591 | - yysep2 := !z.EncBinary() |
| 2592 | - yy2arr2 := z.EncBasicHandle().StructToArray |
| 2593 | - _, _ = yysep2, yy2arr2 |
| 2594 | - const yyr2 bool = false // struct tag has 'toArray' |
| 2595 | - if yyr2 || yy2arr2 { |
| 2596 | - r.WriteArrayStart(2) |
| 2597 | - } else { |
| 2598 | - r.WriteMapStart(2) |
| 2599 | - } |
| 2600 | - if yyr2 || yy2arr2 { |
| 2601 | - r.WriteArrayElem() |
| 2602 | - if x.Users == nil { |
| 2603 | - r.EncodeNil() |
| 2604 | - } else { |
| 2605 | - if false { |
| 2606 | - } else { |
| 2607 | - h.encSlicePtrtoDSUser(([]*DSUser)(x.Users), e) |
| 2608 | - } |
| 2609 | - } |
| 2610 | - } else { |
| 2611 | - r.WriteMapElemKey() |
| 2612 | - if z.IsJSONHandle() { |
| 2613 | - z.WriteStr("\"Users\"") |
| 2614 | - } else { |
| 2615 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Users`) |
| 2616 | - } |
| 2617 | - r.WriteMapElemValue() |
| 2618 | - if x.Users == nil { |
| 2619 | - r.EncodeNil() |
| 2620 | - } else { |
| 2621 | - if false { |
| 2622 | - } else { |
| 2623 | - h.encSlicePtrtoDSUser(([]*DSUser)(x.Users), e) |
| 2624 | - } |
| 2625 | - } |
| 2626 | - } |
| 2627 | - var yyn6 bool |
| 2628 | - if x.Topics == nil { |
| 2629 | - yyn6 = true |
| 2630 | - goto LABEL6 |
| 2631 | - } |
| 2632 | - LABEL6: |
| 2633 | - if yyr2 || yy2arr2 { |
| 2634 | - if yyn6 { |
| 2635 | - r.WriteArrayElem() |
| 2636 | - r.EncodeNil() |
| 2637 | - } else { |
| 2638 | - r.WriteArrayElem() |
| 2639 | - if x.Topics == nil { |
| 2640 | - r.EncodeNil() |
| 2641 | - } else { |
| 2642 | - x.Topics.CodecEncodeSelf(e) |
| 2643 | - } |
| 2644 | - } |
| 2645 | - } else { |
| 2646 | - r.WriteMapElemKey() |
| 2647 | - if z.IsJSONHandle() { |
| 2648 | - z.WriteStr("\"Topics\"") |
| 2649 | - } else { |
| 2650 | - r.EncodeStringEnc(codecSelferCcUTF86617, `Topics`) |
| 2651 | - } |
| 2652 | - r.WriteMapElemValue() |
| 2653 | - if yyn6 { |
| 2654 | - r.EncodeNil() |
| 2655 | - } else { |
| 2656 | - if x.Topics == nil { |
| 2657 | - r.EncodeNil() |
| 2658 | - } else { |
| 2659 | - x.Topics.CodecEncodeSelf(e) |
| 2660 | - } |
| 2661 | - } |
| 2662 | - } |
| 2663 | - if yyr2 || yy2arr2 { |
| 2664 | - r.WriteArrayEnd() |
| 2665 | - } else { |
| 2666 | - r.WriteMapEnd() |
| 2667 | - } |
| 2668 | - } |
| 2669 | - } |
| 2670 | -} |
| 2671 | - |
| 2672 | -// Benchmark harness support for STK-REQ-004. |
| 2673 | -func (x *LargePayload) CodecDecodeSelf(d *codec1978.Decoder) { |
| 2674 | - var h codecSelfer6617 |
| 2675 | - z, r := codec1978.GenHelperDecoder(d) |
| 2676 | - _, _, _ = h, z, r |
| 2677 | - if false { |
| 2678 | - } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { |
| 2679 | - z.DecExtension(x, yyxt1) |
| 2680 | - } else if !z.DecBinary() && z.IsJSONHandle() { |
| 2681 | - z.DecJSONUnmarshal(x) |
| 2682 | - } else { |
| 2683 | - yyct2 := r.ContainerType() |
| 2684 | - if yyct2 == codecSelferValueTypeMap6617 { |
| 2685 | - yyl2 := r.ReadMapStart() |
| 2686 | - if yyl2 == 0 { |
| 2687 | - r.ReadMapEnd() |
| 2688 | - } else { |
| 2689 | - x.codecDecodeSelfFromMap(yyl2, d) |
| 2690 | - } |
| 2691 | - } else if yyct2 == codecSelferValueTypeArray6617 { |
| 2692 | - yyl2 := r.ReadArrayStart() |
| 2693 | - if yyl2 == 0 { |
| 2694 | - r.ReadArrayEnd() |
| 2695 | - } else { |
| 2696 | - x.codecDecodeSelfFromArray(yyl2, d) |
| 2697 | - } |
| 2698 | - } else { |
| 2699 | - panic(errCodecSelferOnlyMapOrArrayEncodeToStruct6617) |
| 2700 | - } |
| 2701 | - } |
| 2702 | -} |
| 2703 | - |
| 2704 | -// Benchmark harness support for STK-REQ-004. |
| 2705 | -func (x *LargePayload) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { |
| 2706 | - var h codecSelfer6617 |
| 2707 | - z, r := codec1978.GenHelperDecoder(d) |
| 2708 | - _, _, _ = h, z, r |
| 2709 | - var yyhl3 bool = l >= 0 |
| 2710 | - for yyj3 := 0; ; yyj3++ { |
| 2711 | - if yyhl3 { |
| 2712 | - if yyj3 >= l { |
| 2713 | - break |
| 2714 | - } |
| 2715 | - } else { |
| 2716 | - if r.CheckBreak() { |
| 2717 | - break |
| 2718 | - } |
| 2719 | - } |
| 2720 | - r.ReadMapElemKey() |
| 2721 | - yys3 := z.StringView(r.DecodeStringAsBytes()) |
| 2722 | - r.ReadMapElemValue() |
| 2723 | - switch yys3 { |
| 2724 | - case "Users": |
| 2725 | - if r.TryDecodeAsNil() { |
| 2726 | - x.Users = nil |
| 2727 | - } else { |
| 2728 | - if false { |
| 2729 | - } else { |
| 2730 | - h.decSlicePtrtoDSUser((*[]*DSUser)(&x.Users), d) |
| 2731 | - } |
| 2732 | - } |
| 2733 | - case "Topics": |
| 2734 | - if r.TryDecodeAsNil() { |
| 2735 | - if true && x.Topics != nil { |
| 2736 | - x.Topics = nil |
| 2737 | - } |
| 2738 | - } else { |
| 2739 | - if x.Topics == nil { |
| 2740 | - x.Topics = new(DSTopicsList) |
| 2741 | - } |
| 2742 | - |
| 2743 | - x.Topics.CodecDecodeSelf(d) |
| 2744 | - } |
| 2745 | - default: |
| 2746 | - z.DecStructFieldNotFound(-1, yys3) |
| 2747 | - } // end switch yys3 |
| 2748 | - } // end for yyj3 |
| 2749 | - r.ReadMapEnd() |
| 2750 | -} |
| 2751 | - |
| 2752 | -// Benchmark harness support for STK-REQ-004. |
| 2753 | -func (x *LargePayload) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { |
| 2754 | - var h codecSelfer6617 |
| 2755 | - z, r := codec1978.GenHelperDecoder(d) |
| 2756 | - _, _, _ = h, z, r |
| 2757 | - var yyj7 int |
| 2758 | - var yyb7 bool |
| 2759 | - var yyhl7 bool = l >= 0 |
| 2760 | - yyj7++ |
| 2761 | - if yyhl7 { |
| 2762 | - yyb7 = yyj7 > l |
| 2763 | - } else { |
| 2764 | - yyb7 = r.CheckBreak() |
| 2765 | - } |
| 2766 | - if yyb7 { |
| 2767 | - r.ReadArrayEnd() |
| 2768 | - return |
| 2769 | - } |
| 2770 | - r.ReadArrayElem() |
| 2771 | - if r.TryDecodeAsNil() { |
| 2772 | - x.Users = nil |
| 2773 | - } else { |
| 2774 | - if false { |
| 2775 | - } else { |
| 2776 | - h.decSlicePtrtoDSUser((*[]*DSUser)(&x.Users), d) |
| 2777 | - } |
| 2778 | - } |
| 2779 | - yyj7++ |
| 2780 | - if yyhl7 { |
| 2781 | - yyb7 = yyj7 > l |
| 2782 | - } else { |
| 2783 | - yyb7 = r.CheckBreak() |
| 2784 | - } |
| 2785 | - if yyb7 { |
| 2786 | - r.ReadArrayEnd() |
| 2787 | - return |
| 2788 | - } |
| 2789 | - r.ReadArrayElem() |
| 2790 | - if r.TryDecodeAsNil() { |
| 2791 | - if true && x.Topics != nil { |
| 2792 | - x.Topics = nil |
| 2793 | - } |
| 2794 | - } else { |
| 2795 | - if x.Topics == nil { |
| 2796 | - x.Topics = new(DSTopicsList) |
| 2797 | - } |
| 2798 | - |
| 2799 | - x.Topics.CodecDecodeSelf(d) |
| 2800 | - } |
| 2801 | - for { |
| 2802 | - yyj7++ |
| 2803 | - if yyhl7 { |
| 2804 | - yyb7 = yyj7 > l |
| 2805 | - } else { |
| 2806 | - yyb7 = r.CheckBreak() |
| 2807 | - } |
| 2808 | - if yyb7 { |
| 2809 | - break |
| 2810 | - } |
| 2811 | - r.ReadArrayElem() |
| 2812 | - z.DecStructFieldNotFound(yyj7-1, "") |
| 2813 | - } |
| 2814 | - r.ReadArrayEnd() |
| 2815 | -} |
| 2816 | - |
| 2817 | -// Benchmark harness support for STK-REQ-004. |
| 2818 | -func (x codecSelfer6617) encSlicePtrtoCBAvatar(v []*CBAvatar, e *codec1978.Encoder) { |
| 2819 | - var h codecSelfer6617 |
| 2820 | - z, r := codec1978.GenHelperEncoder(e) |
| 2821 | - _, _, _ = h, z, r |
| 2822 | - r.WriteArrayStart(len(v)) |
| 2823 | - for _, yyv1 := range v { |
| 2824 | - r.WriteArrayElem() |
| 2825 | - if yyv1 == nil { |
| 2826 | - r.EncodeNil() |
| 2827 | - } else { |
| 2828 | - yyv1.CodecEncodeSelf(e) |
| 2829 | - } |
| 2830 | - } |
| 2831 | - r.WriteArrayEnd() |
| 2832 | -} |
| 2833 | - |
| 2834 | -// Benchmark harness support for STK-REQ-004. |
| 2835 | -func (x codecSelfer6617) decSlicePtrtoCBAvatar(v *[]*CBAvatar, d *codec1978.Decoder) { |
| 2836 | - var h codecSelfer6617 |
| 2837 | - z, r := codec1978.GenHelperDecoder(d) |
| 2838 | - _, _, _ = h, z, r |
| 2839 | - |
| 2840 | - yyv1 := *v |
| 2841 | - yyh1, yyl1 := z.DecSliceHelperStart() |
| 2842 | - var yyc1 bool |
| 2843 | - _ = yyc1 |
| 2844 | - if yyl1 == 0 { |
| 2845 | - if yyv1 == nil { |
| 2846 | - yyv1 = []*CBAvatar{} |
| 2847 | - yyc1 = true |
| 2848 | - } else if len(yyv1) != 0 { |
| 2849 | - yyv1 = yyv1[:0] |
| 2850 | - yyc1 = true |
| 2851 | - } |
| 2852 | - } else { |
| 2853 | - yyhl1 := yyl1 > 0 |
| 2854 | - var yyrl1 int |
| 2855 | - _ = yyrl1 |
| 2856 | - if yyhl1 { |
| 2857 | - if yyl1 > cap(yyv1) { |
| 2858 | - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) |
| 2859 | - if yyrl1 <= cap(yyv1) { |
| 2860 | - yyv1 = yyv1[:yyrl1] |
| 2861 | - } else { |
| 2862 | - yyv1 = make([]*CBAvatar, yyrl1) |
| 2863 | - } |
| 2864 | - yyc1 = true |
| 2865 | - } else if yyl1 != len(yyv1) { |
| 2866 | - yyv1 = yyv1[:yyl1] |
| 2867 | - yyc1 = true |
| 2868 | - } |
| 2869 | - } |
| 2870 | - var yyj1 int |
| 2871 | - // var yydn1 bool |
| 2872 | - for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { // bounds-check-elimination |
| 2873 | - if yyj1 == 0 && yyv1 == nil { |
| 2874 | - if yyhl1 { |
| 2875 | - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) |
| 2876 | - } else { |
| 2877 | - yyrl1 = 8 |
| 2878 | - } |
| 2879 | - yyv1 = make([]*CBAvatar, yyrl1) |
| 2880 | - yyc1 = true |
| 2881 | - } |
| 2882 | - yyh1.ElemContainerState(yyj1) |
| 2883 | - |
| 2884 | - var yydb1 bool |
| 2885 | - if yyj1 >= len(yyv1) { |
| 2886 | - yyv1 = append(yyv1, nil) |
| 2887 | - yyc1 = true |
| 2888 | - |
| 2889 | - } |
| 2890 | - if yydb1 { |
| 2891 | - z.DecSwallow() |
| 2892 | - } else { |
| 2893 | - if r.TryDecodeAsNil() { |
| 2894 | - yyv1[yyj1] = nil |
| 2895 | - } else { |
| 2896 | - if yyv1[yyj1] == nil { |
| 2897 | - yyv1[yyj1] = new(CBAvatar) |
| 2898 | - } |
| 2899 | - yyv1[yyj1].CodecDecodeSelf(d) |
| 2900 | - } |
| 2901 | - |
| 2902 | - } |
| 2903 | - |
| 2904 | - } |
| 2905 | - if yyj1 < len(yyv1) { |
| 2906 | - yyv1 = yyv1[:yyj1] |
| 2907 | - yyc1 = true |
| 2908 | - } else if yyj1 == 0 && yyv1 == nil { |
| 2909 | - yyv1 = make([]*CBAvatar, 0) |
| 2910 | - yyc1 = true |
| 2911 | - } |
| 2912 | - } |
| 2913 | - yyh1.End() |
| 2914 | - if yyc1 { |
| 2915 | - *v = yyv1 |
| 2916 | - } |
| 2917 | -} |
| 2918 | - |
| 2919 | -// Benchmark harness support for STK-REQ-004. |
| 2920 | -func (x codecSelfer6617) encSlicePtrtoDSTopic(v []*DSTopic, e *codec1978.Encoder) { |
| 2921 | - var h codecSelfer6617 |
| 2922 | - z, r := codec1978.GenHelperEncoder(e) |
| 2923 | - _, _, _ = h, z, r |
| 2924 | - r.WriteArrayStart(len(v)) |
| 2925 | - for _, yyv1 := range v { |
| 2926 | - r.WriteArrayElem() |
| 2927 | - if yyv1 == nil { |
| 2928 | - r.EncodeNil() |
| 2929 | - } else { |
| 2930 | - yyv1.CodecEncodeSelf(e) |
| 2931 | - } |
| 2932 | - } |
| 2933 | - r.WriteArrayEnd() |
| 2934 | -} |
| 2935 | - |
| 2936 | -// Benchmark harness support for STK-REQ-004. |
| 2937 | -func (x codecSelfer6617) decSlicePtrtoDSTopic(v *[]*DSTopic, d *codec1978.Decoder) { |
| 2938 | - var h codecSelfer6617 |
| 2939 | - z, r := codec1978.GenHelperDecoder(d) |
| 2940 | - _, _, _ = h, z, r |
| 2941 | - |
| 2942 | - yyv1 := *v |
| 2943 | - yyh1, yyl1 := z.DecSliceHelperStart() |
| 2944 | - var yyc1 bool |
| 2945 | - _ = yyc1 |
| 2946 | - if yyl1 == 0 { |
| 2947 | - if yyv1 == nil { |
| 2948 | - yyv1 = []*DSTopic{} |
| 2949 | - yyc1 = true |
| 2950 | - } else if len(yyv1) != 0 { |
| 2951 | - yyv1 = yyv1[:0] |
| 2952 | - yyc1 = true |
| 2953 | - } |
| 2954 | - } else { |
| 2955 | - yyhl1 := yyl1 > 0 |
| 2956 | - var yyrl1 int |
| 2957 | - _ = yyrl1 |
| 2958 | - if yyhl1 { |
| 2959 | - if yyl1 > cap(yyv1) { |
| 2960 | - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) |
| 2961 | - if yyrl1 <= cap(yyv1) { |
| 2962 | - yyv1 = yyv1[:yyrl1] |
| 2963 | - } else { |
| 2964 | - yyv1 = make([]*DSTopic, yyrl1) |
| 2965 | - } |
| 2966 | - yyc1 = true |
| 2967 | - } else if yyl1 != len(yyv1) { |
| 2968 | - yyv1 = yyv1[:yyl1] |
| 2969 | - yyc1 = true |
| 2970 | - } |
| 2971 | - } |
| 2972 | - var yyj1 int |
| 2973 | - // var yydn1 bool |
| 2974 | - for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { // bounds-check-elimination |
| 2975 | - if yyj1 == 0 && yyv1 == nil { |
| 2976 | - if yyhl1 { |
| 2977 | - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) |
| 2978 | - } else { |
| 2979 | - yyrl1 = 8 |
| 2980 | - } |
| 2981 | - yyv1 = make([]*DSTopic, yyrl1) |
| 2982 | - yyc1 = true |
| 2983 | - } |
| 2984 | - yyh1.ElemContainerState(yyj1) |
| 2985 | - |
| 2986 | - var yydb1 bool |
| 2987 | - if yyj1 >= len(yyv1) { |
| 2988 | - yyv1 = append(yyv1, nil) |
| 2989 | - yyc1 = true |
| 2990 | - |
| 2991 | - } |
| 2992 | - if yydb1 { |
| 2993 | - z.DecSwallow() |
| 2994 | - } else { |
| 2995 | - if r.TryDecodeAsNil() { |
| 2996 | - yyv1[yyj1] = nil |
| 2997 | - } else { |
| 2998 | - if yyv1[yyj1] == nil { |
| 2999 | - yyv1[yyj1] = new(DSTopic) |
| 3000 | - } |
| 3001 | - yyv1[yyj1].CodecDecodeSelf(d) |
| 3002 | - } |
| 3003 | - |
| 3004 | - } |
| 3005 | - |
| 3006 | - } |
| 3007 | - if yyj1 < len(yyv1) { |
| 3008 | - yyv1 = yyv1[:yyj1] |
| 3009 | - yyc1 = true |
| 3010 | - } else if yyj1 == 0 && yyv1 == nil { |
| 3011 | - yyv1 = make([]*DSTopic, 0) |
| 3012 | - yyc1 = true |
| 3013 | - } |
| 3014 | - } |
| 3015 | - yyh1.End() |
| 3016 | - if yyc1 { |
| 3017 | - *v = yyv1 |
| 3018 | - } |
| 3019 | -} |
| 3020 | - |
| 3021 | -// Benchmark harness support for STK-REQ-004. |
| 3022 | -func (x codecSelfer6617) encSlicePtrtoDSUser(v []*DSUser, e *codec1978.Encoder) { |
| 3023 | - var h codecSelfer6617 |
| 3024 | - z, r := codec1978.GenHelperEncoder(e) |
| 3025 | - _, _, _ = h, z, r |
| 3026 | - r.WriteArrayStart(len(v)) |
| 3027 | - for _, yyv1 := range v { |
| 3028 | - r.WriteArrayElem() |
| 3029 | - if yyv1 == nil { |
| 3030 | - r.EncodeNil() |
| 3031 | - } else { |
| 3032 | - yyv1.CodecEncodeSelf(e) |
| 3033 | - } |
| 3034 | - } |
| 3035 | - r.WriteArrayEnd() |
| 3036 | -} |
| 3037 | - |
| 3038 | -// Benchmark harness support for STK-REQ-004. |
| 3039 | -func (x codecSelfer6617) decSlicePtrtoDSUser(v *[]*DSUser, d *codec1978.Decoder) { |
| 3040 | - var h codecSelfer6617 |
| 3041 | - z, r := codec1978.GenHelperDecoder(d) |
| 3042 | - _, _, _ = h, z, r |
| 3043 | - |
| 3044 | - yyv1 := *v |
| 3045 | - yyh1, yyl1 := z.DecSliceHelperStart() |
| 3046 | - var yyc1 bool |
| 3047 | - _ = yyc1 |
| 3048 | - if yyl1 == 0 { |
| 3049 | - if yyv1 == nil { |
| 3050 | - yyv1 = []*DSUser{} |
| 3051 | - yyc1 = true |
| 3052 | - } else if len(yyv1) != 0 { |
| 3053 | - yyv1 = yyv1[:0] |
| 3054 | - yyc1 = true |
| 3055 | - } |
| 3056 | - } else { |
| 3057 | - yyhl1 := yyl1 > 0 |
| 3058 | - var yyrl1 int |
| 3059 | - _ = yyrl1 |
| 3060 | - if yyhl1 { |
| 3061 | - if yyl1 > cap(yyv1) { |
| 3062 | - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) |
| 3063 | - if yyrl1 <= cap(yyv1) { |
| 3064 | - yyv1 = yyv1[:yyrl1] |
| 3065 | - } else { |
| 3066 | - yyv1 = make([]*DSUser, yyrl1) |
| 3067 | - } |
| 3068 | - yyc1 = true |
| 3069 | - } else if yyl1 != len(yyv1) { |
| 3070 | - yyv1 = yyv1[:yyl1] |
| 3071 | - yyc1 = true |
| 3072 | - } |
| 3073 | - } |
| 3074 | - var yyj1 int |
| 3075 | - // var yydn1 bool |
| 3076 | - for yyj1 = 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { // bounds-check-elimination |
| 3077 | - if yyj1 == 0 && yyv1 == nil { |
| 3078 | - if yyhl1 { |
| 3079 | - yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) |
| 3080 | - } else { |
| 3081 | - yyrl1 = 8 |
| 3082 | - } |
| 3083 | - yyv1 = make([]*DSUser, yyrl1) |
| 3084 | - yyc1 = true |
| 3085 | - } |
| 3086 | - yyh1.ElemContainerState(yyj1) |
| 3087 | - |
| 3088 | - var yydb1 bool |
| 3089 | - if yyj1 >= len(yyv1) { |
| 3090 | - yyv1 = append(yyv1, nil) |
| 3091 | - yyc1 = true |
| 3092 | - |
| 3093 | - } |
| 3094 | - if yydb1 { |
| 3095 | - z.DecSwallow() |
| 3096 | - } else { |
| 3097 | - if r.TryDecodeAsNil() { |
| 3098 | - yyv1[yyj1] = nil |
| 3099 | - } else { |
| 3100 | - if yyv1[yyj1] == nil { |
| 3101 | - yyv1[yyj1] = new(DSUser) |
| 3102 | - } |
| 3103 | - yyv1[yyj1].CodecDecodeSelf(d) |
| 3104 | - } |
| 3105 | - |
| 3106 | - } |
| 3107 | - |
| 3108 | - } |
| 3109 | - if yyj1 < len(yyv1) { |
| 3110 | - yyv1 = yyv1[:yyj1] |
| 3111 | - yyc1 = true |
| 3112 | - } else if yyj1 == 0 && yyv1 == nil { |
| 3113 | - yyv1 = make([]*DSUser, 0) |
| 3114 | - yyc1 = true |
| 3115 | - } |
| 3116 | - } |
| 3117 | - yyh1.End() |
| 3118 | - if yyc1 { |
| 3119 | - *v = yyv1 |
| 3120 | - } |
| 3121 | -} |
| 3122 | --- a/benchmark/benchmark_easyjson.go |
| 3123 | +++ /dev/null |
| 3124 | @@ -1,788 +0,0 @@ |
| 3125 | -package benchmark |
| 3126 | - |
| 3127 | -import ( |
| 3128 | - json "encoding/json" |
| 3129 | - jlexer "github.com/mailru/easyjson/jlexer" |
| 3130 | - jwriter "github.com/mailru/easyjson/jwriter" |
| 3131 | -) |
| 3132 | - |
| 3133 | -var _ = json.RawMessage{} // suppress unused package warning |
| 3134 | - |
| 3135 | -// Benchmark harness support for STK-REQ-004. |
| 3136 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_LargePayload(in *jlexer.Lexer, out *LargePayload) { |
| 3137 | - in.Delim('{') |
| 3138 | - for !in.IsDelim('}') { |
| 3139 | - key := in.UnsafeString() |
| 3140 | - in.WantColon() |
| 3141 | - if in.IsNull() { |
| 3142 | - in.Skip() |
| 3143 | - in.WantComma() |
| 3144 | - continue |
| 3145 | - } |
| 3146 | - switch key { |
| 3147 | - case "users": |
| 3148 | - in.Delim('[') |
| 3149 | - if !in.IsDelim(']') { |
| 3150 | - out.Users = make([]*DSUser, 0, 8) |
| 3151 | - } else { |
| 3152 | - out.Users = nil |
| 3153 | - } |
| 3154 | - for !in.IsDelim(']') { |
| 3155 | - var v1 *DSUser |
| 3156 | - if in.IsNull() { |
| 3157 | - in.Skip() |
| 3158 | - v1 = nil |
| 3159 | - } else { |
| 3160 | - v1 = new(DSUser) |
| 3161 | - (*v1).UnmarshalEasyJSON(in) |
| 3162 | - } |
| 3163 | - out.Users = append(out.Users, v1) |
| 3164 | - in.WantComma() |
| 3165 | - } |
| 3166 | - in.Delim(']') |
| 3167 | - case "topics": |
| 3168 | - if in.IsNull() { |
| 3169 | - in.Skip() |
| 3170 | - out.Topics = nil |
| 3171 | - } else { |
| 3172 | - out.Topics = new(DSTopicsList) |
| 3173 | - (*out.Topics).UnmarshalEasyJSON(in) |
| 3174 | - } |
| 3175 | - default: |
| 3176 | - in.SkipRecursive() |
| 3177 | - } |
| 3178 | - in.WantComma() |
| 3179 | - } |
| 3180 | - in.Delim('}') |
| 3181 | -} |
| 3182 | - |
| 3183 | -// Benchmark harness support for STK-REQ-004. |
| 3184 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_LargePayload(out *jwriter.Writer, in *LargePayload) { |
| 3185 | - out.RawByte('{') |
| 3186 | - first := true |
| 3187 | - _ = first |
| 3188 | - if !first { |
| 3189 | - out.RawByte(',') |
| 3190 | - } |
| 3191 | - first = false |
| 3192 | - out.RawString("\"users\":") |
| 3193 | - out.RawByte('[') |
| 3194 | - for v2, v3 := range in.Users { |
| 3195 | - if v2 > 0 { |
| 3196 | - out.RawByte(',') |
| 3197 | - } |
| 3198 | - if v3 == nil { |
| 3199 | - out.RawString("null") |
| 3200 | - } else { |
| 3201 | - (*v3).MarshalEasyJSON(out) |
| 3202 | - } |
| 3203 | - } |
| 3204 | - out.RawByte(']') |
| 3205 | - if !first { |
| 3206 | - out.RawByte(',') |
| 3207 | - } |
| 3208 | - first = false |
| 3209 | - out.RawString("\"topics\":") |
| 3210 | - if in.Topics == nil { |
| 3211 | - out.RawString("null") |
| 3212 | - } else { |
| 3213 | - (*in.Topics).MarshalEasyJSON(out) |
| 3214 | - } |
| 3215 | - out.RawByte('}') |
| 3216 | -} |
| 3217 | - |
| 3218 | -// Benchmark harness support for STK-REQ-004. |
| 3219 | -func (v *LargePayload) MarshalEasyJSON(w *jwriter.Writer) { |
| 3220 | - easyjson_encode_github_com_buger_jsonparser_benchmark_LargePayload(w, v) |
| 3221 | -} |
| 3222 | - |
| 3223 | -// Benchmark harness support for STK-REQ-004. |
| 3224 | -func (v *LargePayload) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3225 | - easyjson_decode_github_com_buger_jsonparser_benchmark_LargePayload(l, v) |
| 3226 | -} |
| 3227 | - |
| 3228 | -// Benchmark harness support for STK-REQ-004. |
| 3229 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_DSTopicsList(in *jlexer.Lexer, out *DSTopicsList) { |
| 3230 | - in.Delim('{') |
| 3231 | - for !in.IsDelim('}') { |
| 3232 | - key := in.UnsafeString() |
| 3233 | - in.WantColon() |
| 3234 | - if in.IsNull() { |
| 3235 | - in.Skip() |
| 3236 | - in.WantComma() |
| 3237 | - continue |
| 3238 | - } |
| 3239 | - switch key { |
| 3240 | - case "topics": |
| 3241 | - in.Delim('[') |
| 3242 | - if !in.IsDelim(']') { |
| 3243 | - out.Topics = make([]*DSTopic, 0, 8) |
| 3244 | - } else { |
| 3245 | - out.Topics = nil |
| 3246 | - } |
| 3247 | - for !in.IsDelim(']') { |
| 3248 | - var v4 *DSTopic |
| 3249 | - if in.IsNull() { |
| 3250 | - in.Skip() |
| 3251 | - v4 = nil |
| 3252 | - } else { |
| 3253 | - v4 = new(DSTopic) |
| 3254 | - (*v4).UnmarshalEasyJSON(in) |
| 3255 | - } |
| 3256 | - out.Topics = append(out.Topics, v4) |
| 3257 | - in.WantComma() |
| 3258 | - } |
| 3259 | - in.Delim(']') |
| 3260 | - case "more_topics_url": |
| 3261 | - out.MoreTopicsUrl = in.String() |
| 3262 | - default: |
| 3263 | - in.SkipRecursive() |
| 3264 | - } |
| 3265 | - in.WantComma() |
| 3266 | - } |
| 3267 | - in.Delim('}') |
| 3268 | -} |
| 3269 | - |
| 3270 | -// Benchmark harness support for STK-REQ-004. |
| 3271 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_DSTopicsList(out *jwriter.Writer, in *DSTopicsList) { |
| 3272 | - out.RawByte('{') |
| 3273 | - first := true |
| 3274 | - _ = first |
| 3275 | - if !first { |
| 3276 | - out.RawByte(',') |
| 3277 | - } |
| 3278 | - first = false |
| 3279 | - out.RawString("\"topics\":") |
| 3280 | - out.RawByte('[') |
| 3281 | - for v5, v6 := range in.Topics { |
| 3282 | - if v5 > 0 { |
| 3283 | - out.RawByte(',') |
| 3284 | - } |
| 3285 | - if v6 == nil { |
| 3286 | - out.RawString("null") |
| 3287 | - } else { |
| 3288 | - (*v6).MarshalEasyJSON(out) |
| 3289 | - } |
| 3290 | - } |
| 3291 | - out.RawByte(']') |
| 3292 | - if !first { |
| 3293 | - out.RawByte(',') |
| 3294 | - } |
| 3295 | - first = false |
| 3296 | - out.RawString("\"more_topics_url\":") |
| 3297 | - out.String(in.MoreTopicsUrl) |
| 3298 | - out.RawByte('}') |
| 3299 | -} |
| 3300 | - |
| 3301 | -// Benchmark harness support for STK-REQ-004. |
| 3302 | -func (v *DSTopicsList) MarshalEasyJSON(w *jwriter.Writer) { |
| 3303 | - easyjson_encode_github_com_buger_jsonparser_benchmark_DSTopicsList(w, v) |
| 3304 | -} |
| 3305 | - |
| 3306 | -// Benchmark harness support for STK-REQ-004. |
| 3307 | -func (v *DSTopicsList) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3308 | - easyjson_decode_github_com_buger_jsonparser_benchmark_DSTopicsList(l, v) |
| 3309 | -} |
| 3310 | - |
| 3311 | -// Benchmark harness support for STK-REQ-004. |
| 3312 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_DSTopic(in *jlexer.Lexer, out *DSTopic) { |
| 3313 | - in.Delim('{') |
| 3314 | - for !in.IsDelim('}') { |
| 3315 | - key := in.UnsafeString() |
| 3316 | - in.WantColon() |
| 3317 | - if in.IsNull() { |
| 3318 | - in.Skip() |
| 3319 | - in.WantComma() |
| 3320 | - continue |
| 3321 | - } |
| 3322 | - switch key { |
| 3323 | - case "id": |
| 3324 | - out.Id = in.Int() |
| 3325 | - case "slug": |
| 3326 | - out.Slug = in.String() |
| 3327 | - default: |
| 3328 | - in.SkipRecursive() |
| 3329 | - } |
| 3330 | - in.WantComma() |
| 3331 | - } |
| 3332 | - in.Delim('}') |
| 3333 | -} |
| 3334 | - |
| 3335 | -// Benchmark harness support for STK-REQ-004. |
| 3336 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_DSTopic(out *jwriter.Writer, in *DSTopic) { |
| 3337 | - out.RawByte('{') |
| 3338 | - first := true |
| 3339 | - _ = first |
| 3340 | - if !first { |
| 3341 | - out.RawByte(',') |
| 3342 | - } |
| 3343 | - first = false |
| 3344 | - out.RawString("\"id\":") |
| 3345 | - out.Int(in.Id) |
| 3346 | - if !first { |
| 3347 | - out.RawByte(',') |
| 3348 | - } |
| 3349 | - first = false |
| 3350 | - out.RawString("\"slug\":") |
| 3351 | - out.String(in.Slug) |
| 3352 | - out.RawByte('}') |
| 3353 | -} |
| 3354 | - |
| 3355 | -// Benchmark harness support for STK-REQ-004. |
| 3356 | -func (v *DSTopic) MarshalEasyJSON(w *jwriter.Writer) { |
| 3357 | - easyjson_encode_github_com_buger_jsonparser_benchmark_DSTopic(w, v) |
| 3358 | -} |
| 3359 | - |
| 3360 | -// Benchmark harness support for STK-REQ-004. |
| 3361 | -func (v *DSTopic) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3362 | - easyjson_decode_github_com_buger_jsonparser_benchmark_DSTopic(l, v) |
| 3363 | -} |
| 3364 | - |
| 3365 | -// Benchmark harness support for STK-REQ-004. |
| 3366 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_DSUser(in *jlexer.Lexer, out *DSUser) { |
| 3367 | - in.Delim('{') |
| 3368 | - for !in.IsDelim('}') { |
| 3369 | - key := in.UnsafeString() |
| 3370 | - in.WantColon() |
| 3371 | - if in.IsNull() { |
| 3372 | - in.Skip() |
| 3373 | - in.WantComma() |
| 3374 | - continue |
| 3375 | - } |
| 3376 | - switch key { |
| 3377 | - case "username": |
| 3378 | - out.Username = in.String() |
| 3379 | - default: |
| 3380 | - in.SkipRecursive() |
| 3381 | - } |
| 3382 | - in.WantComma() |
| 3383 | - } |
| 3384 | - in.Delim('}') |
| 3385 | -} |
| 3386 | - |
| 3387 | -// Benchmark harness support for STK-REQ-004. |
| 3388 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_DSUser(out *jwriter.Writer, in *DSUser) { |
| 3389 | - out.RawByte('{') |
| 3390 | - first := true |
| 3391 | - _ = first |
| 3392 | - if !first { |
| 3393 | - out.RawByte(',') |
| 3394 | - } |
| 3395 | - first = false |
| 3396 | - out.RawString("\"username\":") |
| 3397 | - out.String(in.Username) |
| 3398 | - out.RawByte('}') |
| 3399 | -} |
| 3400 | - |
| 3401 | -// Benchmark harness support for STK-REQ-004. |
| 3402 | -func (v *DSUser) MarshalEasyJSON(w *jwriter.Writer) { |
| 3403 | - easyjson_encode_github_com_buger_jsonparser_benchmark_DSUser(w, v) |
| 3404 | -} |
| 3405 | - |
| 3406 | -// Benchmark harness support for STK-REQ-004. |
| 3407 | -func (v *DSUser) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3408 | - easyjson_decode_github_com_buger_jsonparser_benchmark_DSUser(l, v) |
| 3409 | -} |
| 3410 | - |
| 3411 | -// Benchmark harness support for STK-REQ-004. |
| 3412 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_MediumPayload(in *jlexer.Lexer, out *MediumPayload) { |
| 3413 | - in.Delim('{') |
| 3414 | - for !in.IsDelim('}') { |
| 3415 | - key := in.UnsafeString() |
| 3416 | - in.WantColon() |
| 3417 | - if in.IsNull() { |
| 3418 | - in.Skip() |
| 3419 | - in.WantComma() |
| 3420 | - continue |
| 3421 | - } |
| 3422 | - switch key { |
| 3423 | - case "person": |
| 3424 | - if in.IsNull() { |
| 3425 | - in.Skip() |
| 3426 | - out.Person = nil |
| 3427 | - } else { |
| 3428 | - out.Person = new(CBPerson) |
| 3429 | - (*out.Person).UnmarshalEasyJSON(in) |
| 3430 | - } |
| 3431 | - case "company": |
| 3432 | - in.Delim('{') |
| 3433 | - if !in.IsDelim('}') { |
| 3434 | - out.Company = make(map[string]interface{}) |
| 3435 | - } else { |
| 3436 | - out.Company = nil |
| 3437 | - } |
| 3438 | - for !in.IsDelim('}') { |
| 3439 | - key := in.String() |
| 3440 | - in.WantColon() |
| 3441 | - var v7 interface{} |
| 3442 | - v7 = in.Interface() |
| 3443 | - (out.Company)[key] = v7 |
| 3444 | - in.WantComma() |
| 3445 | - } |
| 3446 | - in.Delim('}') |
| 3447 | - default: |
| 3448 | - in.SkipRecursive() |
| 3449 | - } |
| 3450 | - in.WantComma() |
| 3451 | - } |
| 3452 | - in.Delim('}') |
| 3453 | -} |
| 3454 | - |
| 3455 | -// Benchmark harness support for STK-REQ-004. |
| 3456 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_MediumPayload(out *jwriter.Writer, in *MediumPayload) { |
| 3457 | - out.RawByte('{') |
| 3458 | - first := true |
| 3459 | - _ = first |
| 3460 | - if !first { |
| 3461 | - out.RawByte(',') |
| 3462 | - } |
| 3463 | - first = false |
| 3464 | - out.RawString("\"person\":") |
| 3465 | - if in.Person == nil { |
| 3466 | - out.RawString("null") |
| 3467 | - } else { |
| 3468 | - (*in.Person).MarshalEasyJSON(out) |
| 3469 | - } |
| 3470 | - if !first { |
| 3471 | - out.RawByte(',') |
| 3472 | - } |
| 3473 | - first = false |
| 3474 | - out.RawString("\"company\":") |
| 3475 | - out.RawByte('{') |
| 3476 | - v8_first := true |
| 3477 | - for v8_name, v8_value := range in.Company { |
| 3478 | - if !v8_first { |
| 3479 | - out.RawByte(',') |
| 3480 | - } |
| 3481 | - v8_first = false |
| 3482 | - out.String(v8_name) |
| 3483 | - out.Raw(json.Marshal(v8_value)) |
| 3484 | - } |
| 3485 | - out.RawByte('}') |
| 3486 | - out.RawByte('}') |
| 3487 | -} |
| 3488 | - |
| 3489 | -// Benchmark harness support for STK-REQ-004. |
| 3490 | -func (v *MediumPayload) MarshalEasyJSON(w *jwriter.Writer) { |
| 3491 | - easyjson_encode_github_com_buger_jsonparser_benchmark_MediumPayload(w, v) |
| 3492 | -} |
| 3493 | - |
| 3494 | -// Benchmark harness support for STK-REQ-004. |
| 3495 | -func (v *MediumPayload) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3496 | - easyjson_decode_github_com_buger_jsonparser_benchmark_MediumPayload(l, v) |
| 3497 | -} |
| 3498 | - |
| 3499 | -// Benchmark harness support for STK-REQ-004. |
| 3500 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_CBPerson(in *jlexer.Lexer, out *CBPerson) { |
| 3501 | - in.Delim('{') |
| 3502 | - for !in.IsDelim('}') { |
| 3503 | - key := in.UnsafeString() |
| 3504 | - in.WantColon() |
| 3505 | - if in.IsNull() { |
| 3506 | - in.Skip() |
| 3507 | - in.WantComma() |
| 3508 | - continue |
| 3509 | - } |
| 3510 | - switch key { |
| 3511 | - case "name": |
| 3512 | - if in.IsNull() { |
| 3513 | - in.Skip() |
| 3514 | - out.Name = nil |
| 3515 | - } else { |
| 3516 | - out.Name = new(CBName) |
| 3517 | - (*out.Name).UnmarshalEasyJSON(in) |
| 3518 | - } |
| 3519 | - case "github": |
| 3520 | - if in.IsNull() { |
| 3521 | - in.Skip() |
| 3522 | - out.Github = nil |
| 3523 | - } else { |
| 3524 | - out.Github = new(CBGithub) |
| 3525 | - (*out.Github).UnmarshalEasyJSON(in) |
| 3526 | - } |
| 3527 | - case "gravatar": |
| 3528 | - if in.IsNull() { |
| 3529 | - in.Skip() |
| 3530 | - out.Gravatar = nil |
| 3531 | - } else { |
| 3532 | - out.Gravatar = new(CBGravatar) |
| 3533 | - (*out.Gravatar).UnmarshalEasyJSON(in) |
| 3534 | - } |
| 3535 | - default: |
| 3536 | - in.SkipRecursive() |
| 3537 | - } |
| 3538 | - in.WantComma() |
| 3539 | - } |
| 3540 | - in.Delim('}') |
| 3541 | -} |
| 3542 | - |
| 3543 | -// Benchmark harness support for STK-REQ-004. |
| 3544 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_CBPerson(out *jwriter.Writer, in *CBPerson) { |
| 3545 | - out.RawByte('{') |
| 3546 | - first := true |
| 3547 | - _ = first |
| 3548 | - if !first { |
| 3549 | - out.RawByte(',') |
| 3550 | - } |
| 3551 | - first = false |
| 3552 | - out.RawString("\"name\":") |
| 3553 | - if in.Name == nil { |
| 3554 | - out.RawString("null") |
| 3555 | - } else { |
| 3556 | - (*in.Name).MarshalEasyJSON(out) |
| 3557 | - } |
| 3558 | - if !first { |
| 3559 | - out.RawByte(',') |
| 3560 | - } |
| 3561 | - first = false |
| 3562 | - out.RawString("\"github\":") |
| 3563 | - if in.Github == nil { |
| 3564 | - out.RawString("null") |
| 3565 | - } else { |
| 3566 | - (*in.Github).MarshalEasyJSON(out) |
| 3567 | - } |
| 3568 | - if !first { |
| 3569 | - out.RawByte(',') |
| 3570 | - } |
| 3571 | - first = false |
| 3572 | - out.RawString("\"gravatar\":") |
| 3573 | - if in.Gravatar == nil { |
| 3574 | - out.RawString("null") |
| 3575 | - } else { |
| 3576 | - (*in.Gravatar).MarshalEasyJSON(out) |
| 3577 | - } |
| 3578 | - out.RawByte('}') |
| 3579 | -} |
| 3580 | - |
| 3581 | -// Benchmark harness support for STK-REQ-004. |
| 3582 | -func (v *CBPerson) MarshalEasyJSON(w *jwriter.Writer) { |
| 3583 | - easyjson_encode_github_com_buger_jsonparser_benchmark_CBPerson(w, v) |
| 3584 | -} |
| 3585 | - |
| 3586 | -// Benchmark harness support for STK-REQ-004. |
| 3587 | -func (v *CBPerson) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3588 | - easyjson_decode_github_com_buger_jsonparser_benchmark_CBPerson(l, v) |
| 3589 | -} |
| 3590 | - |
| 3591 | -// Benchmark harness support for STK-REQ-004. |
| 3592 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_CBName(in *jlexer.Lexer, out *CBName) { |
| 3593 | - in.Delim('{') |
| 3594 | - for !in.IsDelim('}') { |
| 3595 | - key := in.UnsafeString() |
| 3596 | - in.WantColon() |
| 3597 | - if in.IsNull() { |
| 3598 | - in.Skip() |
| 3599 | - in.WantComma() |
| 3600 | - continue |
| 3601 | - } |
| 3602 | - switch key { |
| 3603 | - case "full_name": |
| 3604 | - out.FullName = in.String() |
| 3605 | - default: |
| 3606 | - in.SkipRecursive() |
| 3607 | - } |
| 3608 | - in.WantComma() |
| 3609 | - } |
| 3610 | - in.Delim('}') |
| 3611 | -} |
| 3612 | - |
| 3613 | -// Benchmark harness support for STK-REQ-004. |
| 3614 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_CBName(out *jwriter.Writer, in *CBName) { |
| 3615 | - out.RawByte('{') |
| 3616 | - first := true |
| 3617 | - _ = first |
| 3618 | - if !first { |
| 3619 | - out.RawByte(',') |
| 3620 | - } |
| 3621 | - first = false |
| 3622 | - out.RawString("\"full_name\":") |
| 3623 | - out.String(in.FullName) |
| 3624 | - out.RawByte('}') |
| 3625 | -} |
| 3626 | - |
| 3627 | -// Benchmark harness support for STK-REQ-004. |
| 3628 | -func (v *CBName) MarshalEasyJSON(w *jwriter.Writer) { |
| 3629 | - easyjson_encode_github_com_buger_jsonparser_benchmark_CBName(w, v) |
| 3630 | -} |
| 3631 | - |
| 3632 | -// Benchmark harness support for STK-REQ-004. |
| 3633 | -func (v *CBName) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3634 | - easyjson_decode_github_com_buger_jsonparser_benchmark_CBName(l, v) |
| 3635 | -} |
| 3636 | - |
| 3637 | -// Benchmark harness support for STK-REQ-004. |
| 3638 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_CBGithub(in *jlexer.Lexer, out *CBGithub) { |
| 3639 | - in.Delim('{') |
| 3640 | - for !in.IsDelim('}') { |
| 3641 | - key := in.UnsafeString() |
| 3642 | - in.WantColon() |
| 3643 | - if in.IsNull() { |
| 3644 | - in.Skip() |
| 3645 | - in.WantComma() |
| 3646 | - continue |
| 3647 | - } |
| 3648 | - switch key { |
| 3649 | - case "followers": |
| 3650 | - out.Followers = in.Int() |
| 3651 | - default: |
| 3652 | - in.SkipRecursive() |
| 3653 | - } |
| 3654 | - in.WantComma() |
| 3655 | - } |
| 3656 | - in.Delim('}') |
| 3657 | -} |
| 3658 | - |
| 3659 | -// Benchmark harness support for STK-REQ-004. |
| 3660 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_CBGithub(out *jwriter.Writer, in *CBGithub) { |
| 3661 | - out.RawByte('{') |
| 3662 | - first := true |
| 3663 | - _ = first |
| 3664 | - if !first { |
| 3665 | - out.RawByte(',') |
| 3666 | - } |
| 3667 | - first = false |
| 3668 | - out.RawString("\"followers\":") |
| 3669 | - out.Int(in.Followers) |
| 3670 | - out.RawByte('}') |
| 3671 | -} |
| 3672 | - |
| 3673 | -// Benchmark harness support for STK-REQ-004. |
| 3674 | -func (v *CBGithub) MarshalEasyJSON(w *jwriter.Writer) { |
| 3675 | - easyjson_encode_github_com_buger_jsonparser_benchmark_CBGithub(w, v) |
| 3676 | -} |
| 3677 | - |
| 3678 | -// Benchmark harness support for STK-REQ-004. |
| 3679 | -func (v *CBGithub) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3680 | - easyjson_decode_github_com_buger_jsonparser_benchmark_CBGithub(l, v) |
| 3681 | -} |
| 3682 | - |
| 3683 | -// Benchmark harness support for STK-REQ-004. |
| 3684 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_CBGravatar(in *jlexer.Lexer, out *CBGravatar) { |
| 3685 | - in.Delim('{') |
| 3686 | - for !in.IsDelim('}') { |
| 3687 | - key := in.UnsafeString() |
| 3688 | - in.WantColon() |
| 3689 | - if in.IsNull() { |
| 3690 | - in.Skip() |
| 3691 | - in.WantComma() |
| 3692 | - continue |
| 3693 | - } |
| 3694 | - switch key { |
| 3695 | - case "avatars": |
| 3696 | - in.Delim('[') |
| 3697 | - if !in.IsDelim(']') { |
| 3698 | - out.Avatars = make([]*CBAvatar, 0, 8) |
| 3699 | - } else { |
| 3700 | - out.Avatars = nil |
| 3701 | - } |
| 3702 | - for !in.IsDelim(']') { |
| 3703 | - var v9 *CBAvatar |
| 3704 | - if in.IsNull() { |
| 3705 | - in.Skip() |
| 3706 | - v9 = nil |
| 3707 | - } else { |
| 3708 | - v9 = new(CBAvatar) |
| 3709 | - (*v9).UnmarshalEasyJSON(in) |
| 3710 | - } |
| 3711 | - out.Avatars = append(out.Avatars, v9) |
| 3712 | - in.WantComma() |
| 3713 | - } |
| 3714 | - in.Delim(']') |
| 3715 | - default: |
| 3716 | - in.SkipRecursive() |
| 3717 | - } |
| 3718 | - in.WantComma() |
| 3719 | - } |
| 3720 | - in.Delim('}') |
| 3721 | -} |
| 3722 | - |
| 3723 | -// Benchmark harness support for STK-REQ-004. |
| 3724 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_CBGravatar(out *jwriter.Writer, in *CBGravatar) { |
| 3725 | - out.RawByte('{') |
| 3726 | - first := true |
| 3727 | - _ = first |
| 3728 | - if !first { |
| 3729 | - out.RawByte(',') |
| 3730 | - } |
| 3731 | - first = false |
| 3732 | - out.RawString("\"avatars\":") |
| 3733 | - out.RawByte('[') |
| 3734 | - for v10, v11 := range in.Avatars { |
| 3735 | - if v10 > 0 { |
| 3736 | - out.RawByte(',') |
| 3737 | - } |
| 3738 | - if v11 == nil { |
| 3739 | - out.RawString("null") |
| 3740 | - } else { |
| 3741 | - (*v11).MarshalEasyJSON(out) |
| 3742 | - } |
| 3743 | - } |
| 3744 | - out.RawByte(']') |
| 3745 | - out.RawByte('}') |
| 3746 | -} |
| 3747 | - |
| 3748 | -// Benchmark harness support for STK-REQ-004. |
| 3749 | -func (v *CBGravatar) MarshalEasyJSON(w *jwriter.Writer) { |
| 3750 | - easyjson_encode_github_com_buger_jsonparser_benchmark_CBGravatar(w, v) |
| 3751 | -} |
| 3752 | - |
| 3753 | -// Benchmark harness support for STK-REQ-004. |
| 3754 | -func (v *CBGravatar) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3755 | - easyjson_decode_github_com_buger_jsonparser_benchmark_CBGravatar(l, v) |
| 3756 | -} |
| 3757 | - |
| 3758 | -// Benchmark harness support for STK-REQ-004. |
| 3759 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_CBAvatar(in *jlexer.Lexer, out *CBAvatar) { |
| 3760 | - in.Delim('{') |
| 3761 | - for !in.IsDelim('}') { |
| 3762 | - key := in.UnsafeString() |
| 3763 | - in.WantColon() |
| 3764 | - if in.IsNull() { |
| 3765 | - in.Skip() |
| 3766 | - in.WantComma() |
| 3767 | - continue |
| 3768 | - } |
| 3769 | - switch key { |
| 3770 | - case "url": |
| 3771 | - out.Url = in.String() |
| 3772 | - default: |
| 3773 | - in.SkipRecursive() |
| 3774 | - } |
| 3775 | - in.WantComma() |
| 3776 | - } |
| 3777 | - in.Delim('}') |
| 3778 | -} |
| 3779 | - |
| 3780 | -// Benchmark harness support for STK-REQ-004. |
| 3781 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_CBAvatar(out *jwriter.Writer, in *CBAvatar) { |
| 3782 | - out.RawByte('{') |
| 3783 | - first := true |
| 3784 | - _ = first |
| 3785 | - if !first { |
| 3786 | - out.RawByte(',') |
| 3787 | - } |
| 3788 | - first = false |
| 3789 | - out.RawString("\"url\":") |
| 3790 | - out.String(in.Url) |
| 3791 | - out.RawByte('}') |
| 3792 | -} |
| 3793 | - |
| 3794 | -// Benchmark harness support for STK-REQ-004. |
| 3795 | -func (v *CBAvatar) MarshalEasyJSON(w *jwriter.Writer) { |
| 3796 | - easyjson_encode_github_com_buger_jsonparser_benchmark_CBAvatar(w, v) |
| 3797 | -} |
| 3798 | - |
| 3799 | -// Benchmark harness support for STK-REQ-004. |
| 3800 | -func (v *CBAvatar) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3801 | - easyjson_decode_github_com_buger_jsonparser_benchmark_CBAvatar(l, v) |
| 3802 | -} |
| 3803 | - |
| 3804 | -// Benchmark harness support for STK-REQ-004. |
| 3805 | -func easyjson_decode_github_com_buger_jsonparser_benchmark_SmallPayload(in *jlexer.Lexer, out *SmallPayload) { |
| 3806 | - in.Delim('{') |
| 3807 | - for !in.IsDelim('}') { |
| 3808 | - key := in.UnsafeString() |
| 3809 | - in.WantColon() |
| 3810 | - if in.IsNull() { |
| 3811 | - in.Skip() |
| 3812 | - in.WantComma() |
| 3813 | - continue |
| 3814 | - } |
| 3815 | - switch key { |
| 3816 | - case "st": |
| 3817 | - out.St = in.Int() |
| 3818 | - case "sid": |
| 3819 | - out.Sid = in.Int() |
| 3820 | - case "tt": |
| 3821 | - out.Tt = in.String() |
| 3822 | - case "gr": |
| 3823 | - out.Gr = in.Int() |
| 3824 | - case "uuid": |
| 3825 | - out.Uuid = in.String() |
| 3826 | - case "ip": |
| 3827 | - out.Ip = in.String() |
| 3828 | - case "ua": |
| 3829 | - out.Ua = in.String() |
| 3830 | - case "tz": |
| 3831 | - out.Tz = in.Int() |
| 3832 | - case "v": |
| 3833 | - out.V = in.Int() |
| 3834 | - default: |
| 3835 | - in.SkipRecursive() |
| 3836 | - } |
| 3837 | - in.WantComma() |
| 3838 | - } |
| 3839 | - in.Delim('}') |
| 3840 | -} |
| 3841 | - |
| 3842 | -// Benchmark harness support for STK-REQ-004. |
| 3843 | -func easyjson_encode_github_com_buger_jsonparser_benchmark_SmallPayload(out *jwriter.Writer, in *SmallPayload) { |
| 3844 | - out.RawByte('{') |
| 3845 | - first := true |
| 3846 | - _ = first |
| 3847 | - if !first { |
| 3848 | - out.RawByte(',') |
| 3849 | - } |
| 3850 | - first = false |
| 3851 | - out.RawString("\"st\":") |
| 3852 | - out.Int(in.St) |
| 3853 | - if !first { |
| 3854 | - out.RawByte(',') |
| 3855 | - } |
| 3856 | - first = false |
| 3857 | - out.RawString("\"sid\":") |
| 3858 | - out.Int(in.Sid) |
| 3859 | - if !first { |
| 3860 | - out.RawByte(',') |
| 3861 | - } |
| 3862 | - first = false |
| 3863 | - out.RawString("\"tt\":") |
| 3864 | - out.String(in.Tt) |
| 3865 | - if !first { |
| 3866 | - out.RawByte(',') |
| 3867 | - } |
| 3868 | - first = false |
| 3869 | - out.RawString("\"gr\":") |
| 3870 | - out.Int(in.Gr) |
| 3871 | - if !first { |
| 3872 | - out.RawByte(',') |
| 3873 | - } |
| 3874 | - first = false |
| 3875 | - out.RawString("\"uuid\":") |
| 3876 | - out.String(in.Uuid) |
| 3877 | - if !first { |
| 3878 | - out.RawByte(',') |
| 3879 | - } |
| 3880 | - first = false |
| 3881 | - out.RawString("\"ip\":") |
| 3882 | - out.String(in.Ip) |
| 3883 | - if !first { |
| 3884 | - out.RawByte(',') |
| 3885 | - } |
| 3886 | - first = false |
| 3887 | - out.RawString("\"ua\":") |
| 3888 | - out.String(in.Ua) |
| 3889 | - if !first { |
| 3890 | - out.RawByte(',') |
| 3891 | - } |
| 3892 | - first = false |
| 3893 | - out.RawString("\"tz\":") |
| 3894 | - out.Int(in.Tz) |
| 3895 | - if !first { |
| 3896 | - out.RawByte(',') |
| 3897 | - } |
| 3898 | - first = false |
| 3899 | - out.RawString("\"v\":") |
| 3900 | - out.Int(in.V) |
| 3901 | - out.RawByte('}') |
| 3902 | -} |
| 3903 | - |
| 3904 | -// Benchmark harness support for STK-REQ-004. |
| 3905 | -func (v *SmallPayload) MarshalEasyJSON(w *jwriter.Writer) { |
| 3906 | - easyjson_encode_github_com_buger_jsonparser_benchmark_SmallPayload(w, v) |
| 3907 | -} |
| 3908 | - |
| 3909 | -// Benchmark harness support for STK-REQ-004. |
| 3910 | -func (v *SmallPayload) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 3911 | - easyjson_decode_github_com_buger_jsonparser_benchmark_SmallPayload(l, v) |
| 3912 | -} |
| 3913 | --- a/benchmark/benchmark_ffjson.go |
| 3914 | +++ /dev/null |
| 3915 | @@ -1,3196 +0,0 @@ |
| 3916 | -// DO NOT EDIT! |
| 3917 | -// Code generated by ffjson <https://github.com/pquerna/ffjson> |
| 3918 | -// source: benchmark.go |
| 3919 | -// DO NOT EDIT! |
| 3920 | - |
| 3921 | -package benchmark |
| 3922 | - |
| 3923 | -import ( |
| 3924 | - "bytes" |
| 3925 | - "encoding/json" |
| 3926 | - "fmt" |
| 3927 | - fflib "github.com/pquerna/ffjson/fflib/v1" |
| 3928 | -) |
| 3929 | - |
| 3930 | -// Benchmark harness support for STK-REQ-004. |
| 3931 | -func (mj *CBAvatar) MarshalJSON() ([]byte, error) { |
| 3932 | - var buf fflib.Buffer |
| 3933 | - if mj == nil { |
| 3934 | - buf.WriteString("null") |
| 3935 | - return buf.Bytes(), nil |
| 3936 | - } |
| 3937 | - err := mj.MarshalJSONBuf(&buf) |
| 3938 | - if err != nil { |
| 3939 | - return nil, err |
| 3940 | - } |
| 3941 | - return buf.Bytes(), nil |
| 3942 | -} |
| 3943 | - |
| 3944 | -// Benchmark harness support for STK-REQ-004. |
| 3945 | -func (mj *CBAvatar) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 3946 | - if mj == nil { |
| 3947 | - buf.WriteString("null") |
| 3948 | - return nil |
| 3949 | - } |
| 3950 | - var err error |
| 3951 | - var obj []byte |
| 3952 | - _ = obj |
| 3953 | - _ = err |
| 3954 | - buf.WriteString(`{"Url":`) |
| 3955 | - fflib.WriteJsonString(buf, string(mj.Url)) |
| 3956 | - buf.WriteByte('}') |
| 3957 | - return nil |
| 3958 | -} |
| 3959 | - |
| 3960 | -const ( |
| 3961 | - ffj_t_CBAvatarbase = iota |
| 3962 | - ffj_t_CBAvatarno_such_key |
| 3963 | - |
| 3964 | - ffj_t_CBAvatar_Url |
| 3965 | -) |
| 3966 | - |
| 3967 | -var ffj_key_CBAvatar_Url = []byte("Url") |
| 3968 | - |
| 3969 | -// Benchmark harness support for STK-REQ-004. |
| 3970 | -func (uj *CBAvatar) UnmarshalJSON(input []byte) error { |
| 3971 | - fs := fflib.NewFFLexer(input) |
| 3972 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 3973 | -} |
| 3974 | - |
| 3975 | -// Benchmark harness support for STK-REQ-004. |
| 3976 | -func (uj *CBAvatar) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 3977 | - var err error = nil |
| 3978 | - currentKey := ffj_t_CBAvatarbase |
| 3979 | - _ = currentKey |
| 3980 | - tok := fflib.FFTok_init |
| 3981 | - wantedTok := fflib.FFTok_init |
| 3982 | - |
| 3983 | -mainparse: |
| 3984 | - for { |
| 3985 | - tok = fs.Scan() |
| 3986 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 3987 | - if tok == fflib.FFTok_error { |
| 3988 | - goto tokerror |
| 3989 | - } |
| 3990 | - |
| 3991 | - switch state { |
| 3992 | - |
| 3993 | - case fflib.FFParse_map_start: |
| 3994 | - if tok != fflib.FFTok_left_bracket { |
| 3995 | - wantedTok = fflib.FFTok_left_bracket |
| 3996 | - goto wrongtokenerror |
| 3997 | - } |
| 3998 | - state = fflib.FFParse_want_key |
| 3999 | - continue |
| 4000 | - |
| 4001 | - case fflib.FFParse_after_value: |
| 4002 | - if tok == fflib.FFTok_comma { |
| 4003 | - state = fflib.FFParse_want_key |
| 4004 | - } else if tok == fflib.FFTok_right_bracket { |
| 4005 | - goto done |
| 4006 | - } else { |
| 4007 | - wantedTok = fflib.FFTok_comma |
| 4008 | - goto wrongtokenerror |
| 4009 | - } |
| 4010 | - |
| 4011 | - case fflib.FFParse_want_key: |
| 4012 | - // json {} ended. goto exit. woo. |
| 4013 | - if tok == fflib.FFTok_right_bracket { |
| 4014 | - goto done |
| 4015 | - } |
| 4016 | - if tok != fflib.FFTok_string { |
| 4017 | - wantedTok = fflib.FFTok_string |
| 4018 | - goto wrongtokenerror |
| 4019 | - } |
| 4020 | - |
| 4021 | - kn := fs.Output.Bytes() |
| 4022 | - if len(kn) <= 0 { |
| 4023 | - // "" case. hrm. |
| 4024 | - currentKey = ffj_t_CBAvatarno_such_key |
| 4025 | - state = fflib.FFParse_want_colon |
| 4026 | - goto mainparse |
| 4027 | - } else { |
| 4028 | - switch kn[0] { |
| 4029 | - |
| 4030 | - case 'U': |
| 4031 | - |
| 4032 | - if bytes.Equal(ffj_key_CBAvatar_Url, kn) { |
| 4033 | - currentKey = ffj_t_CBAvatar_Url |
| 4034 | - state = fflib.FFParse_want_colon |
| 4035 | - goto mainparse |
| 4036 | - } |
| 4037 | - |
| 4038 | - } |
| 4039 | - |
| 4040 | - if fflib.SimpleLetterEqualFold(ffj_key_CBAvatar_Url, kn) { |
| 4041 | - currentKey = ffj_t_CBAvatar_Url |
| 4042 | - state = fflib.FFParse_want_colon |
| 4043 | - goto mainparse |
| 4044 | - } |
| 4045 | - |
| 4046 | - currentKey = ffj_t_CBAvatarno_such_key |
| 4047 | - state = fflib.FFParse_want_colon |
| 4048 | - goto mainparse |
| 4049 | - } |
| 4050 | - |
| 4051 | - case fflib.FFParse_want_colon: |
| 4052 | - if tok != fflib.FFTok_colon { |
| 4053 | - wantedTok = fflib.FFTok_colon |
| 4054 | - goto wrongtokenerror |
| 4055 | - } |
| 4056 | - state = fflib.FFParse_want_value |
| 4057 | - continue |
| 4058 | - case fflib.FFParse_want_value: |
| 4059 | - |
| 4060 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 4061 | - switch currentKey { |
| 4062 | - |
| 4063 | - case ffj_t_CBAvatar_Url: |
| 4064 | - goto handle_Url |
| 4065 | - |
| 4066 | - case ffj_t_CBAvatarno_such_key: |
| 4067 | - err = fs.SkipField(tok) |
| 4068 | - if err != nil { |
| 4069 | - return fs.WrapErr(err) |
| 4070 | - } |
| 4071 | - state = fflib.FFParse_after_value |
| 4072 | - goto mainparse |
| 4073 | - } |
| 4074 | - } else { |
| 4075 | - goto wantedvalue |
| 4076 | - } |
| 4077 | - } |
| 4078 | - } |
| 4079 | - |
| 4080 | -handle_Url: |
| 4081 | - |
| 4082 | - /* handler: uj.Url type=string kind=string quoted=false*/ |
| 4083 | - |
| 4084 | - { |
| 4085 | - |
| 4086 | - { |
| 4087 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 4088 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 4089 | - } |
| 4090 | - } |
| 4091 | - |
| 4092 | - if tok == fflib.FFTok_null { |
| 4093 | - |
| 4094 | - } else { |
| 4095 | - |
| 4096 | - outBuf := fs.Output.Bytes() |
| 4097 | - |
| 4098 | - uj.Url = string(string(outBuf)) |
| 4099 | - |
| 4100 | - } |
| 4101 | - } |
| 4102 | - |
| 4103 | - state = fflib.FFParse_after_value |
| 4104 | - goto mainparse |
| 4105 | - |
| 4106 | -wantedvalue: |
| 4107 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 4108 | -wrongtokenerror: |
| 4109 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 4110 | -tokerror: |
| 4111 | - if fs.BigError != nil { |
| 4112 | - return fs.WrapErr(fs.BigError) |
| 4113 | - } |
| 4114 | - err = fs.Error.ToError() |
| 4115 | - if err != nil { |
| 4116 | - return fs.WrapErr(err) |
| 4117 | - } |
| 4118 | - panic("ffjson-generated: unreachable, please report bug.") |
| 4119 | -done: |
| 4120 | - return nil |
| 4121 | -} |
| 4122 | - |
| 4123 | -// Benchmark harness support for STK-REQ-004. |
| 4124 | -func (mj *CBGithub) MarshalJSON() ([]byte, error) { |
| 4125 | - var buf fflib.Buffer |
| 4126 | - if mj == nil { |
| 4127 | - buf.WriteString("null") |
| 4128 | - return buf.Bytes(), nil |
| 4129 | - } |
| 4130 | - err := mj.MarshalJSONBuf(&buf) |
| 4131 | - if err != nil { |
| 4132 | - return nil, err |
| 4133 | - } |
| 4134 | - return buf.Bytes(), nil |
| 4135 | -} |
| 4136 | - |
| 4137 | -// Benchmark harness support for STK-REQ-004. |
| 4138 | -func (mj *CBGithub) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 4139 | - if mj == nil { |
| 4140 | - buf.WriteString("null") |
| 4141 | - return nil |
| 4142 | - } |
| 4143 | - var err error |
| 4144 | - var obj []byte |
| 4145 | - _ = obj |
| 4146 | - _ = err |
| 4147 | - buf.WriteString(`{"Followers":`) |
| 4148 | - fflib.FormatBits2(buf, uint64(mj.Followers), 10, mj.Followers < 0) |
| 4149 | - buf.WriteByte('}') |
| 4150 | - return nil |
| 4151 | -} |
| 4152 | - |
| 4153 | -const ( |
| 4154 | - ffj_t_CBGithubbase = iota |
| 4155 | - ffj_t_CBGithubno_such_key |
| 4156 | - |
| 4157 | - ffj_t_CBGithub_Followers |
| 4158 | -) |
| 4159 | - |
| 4160 | -var ffj_key_CBGithub_Followers = []byte("Followers") |
| 4161 | - |
| 4162 | -// Benchmark harness support for STK-REQ-004. |
| 4163 | -func (uj *CBGithub) UnmarshalJSON(input []byte) error { |
| 4164 | - fs := fflib.NewFFLexer(input) |
| 4165 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 4166 | -} |
| 4167 | - |
| 4168 | -// Benchmark harness support for STK-REQ-004. |
| 4169 | -func (uj *CBGithub) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 4170 | - var err error = nil |
| 4171 | - currentKey := ffj_t_CBGithubbase |
| 4172 | - _ = currentKey |
| 4173 | - tok := fflib.FFTok_init |
| 4174 | - wantedTok := fflib.FFTok_init |
| 4175 | - |
| 4176 | -mainparse: |
| 4177 | - for { |
| 4178 | - tok = fs.Scan() |
| 4179 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 4180 | - if tok == fflib.FFTok_error { |
| 4181 | - goto tokerror |
| 4182 | - } |
| 4183 | - |
| 4184 | - switch state { |
| 4185 | - |
| 4186 | - case fflib.FFParse_map_start: |
| 4187 | - if tok != fflib.FFTok_left_bracket { |
| 4188 | - wantedTok = fflib.FFTok_left_bracket |
| 4189 | - goto wrongtokenerror |
| 4190 | - } |
| 4191 | - state = fflib.FFParse_want_key |
| 4192 | - continue |
| 4193 | - |
| 4194 | - case fflib.FFParse_after_value: |
| 4195 | - if tok == fflib.FFTok_comma { |
| 4196 | - state = fflib.FFParse_want_key |
| 4197 | - } else if tok == fflib.FFTok_right_bracket { |
| 4198 | - goto done |
| 4199 | - } else { |
| 4200 | - wantedTok = fflib.FFTok_comma |
| 4201 | - goto wrongtokenerror |
| 4202 | - } |
| 4203 | - |
| 4204 | - case fflib.FFParse_want_key: |
| 4205 | - // json {} ended. goto exit. woo. |
| 4206 | - if tok == fflib.FFTok_right_bracket { |
| 4207 | - goto done |
| 4208 | - } |
| 4209 | - if tok != fflib.FFTok_string { |
| 4210 | - wantedTok = fflib.FFTok_string |
| 4211 | - goto wrongtokenerror |
| 4212 | - } |
| 4213 | - |
| 4214 | - kn := fs.Output.Bytes() |
| 4215 | - if len(kn) <= 0 { |
| 4216 | - // "" case. hrm. |
| 4217 | - currentKey = ffj_t_CBGithubno_such_key |
| 4218 | - state = fflib.FFParse_want_colon |
| 4219 | - goto mainparse |
| 4220 | - } else { |
| 4221 | - switch kn[0] { |
| 4222 | - |
| 4223 | - case 'F': |
| 4224 | - |
| 4225 | - if bytes.Equal(ffj_key_CBGithub_Followers, kn) { |
| 4226 | - currentKey = ffj_t_CBGithub_Followers |
| 4227 | - state = fflib.FFParse_want_colon |
| 4228 | - goto mainparse |
| 4229 | - } |
| 4230 | - |
| 4231 | - } |
| 4232 | - |
| 4233 | - if fflib.EqualFoldRight(ffj_key_CBGithub_Followers, kn) { |
| 4234 | - currentKey = ffj_t_CBGithub_Followers |
| 4235 | - state = fflib.FFParse_want_colon |
| 4236 | - goto mainparse |
| 4237 | - } |
| 4238 | - |
| 4239 | - currentKey = ffj_t_CBGithubno_such_key |
| 4240 | - state = fflib.FFParse_want_colon |
| 4241 | - goto mainparse |
| 4242 | - } |
| 4243 | - |
| 4244 | - case fflib.FFParse_want_colon: |
| 4245 | - if tok != fflib.FFTok_colon { |
| 4246 | - wantedTok = fflib.FFTok_colon |
| 4247 | - goto wrongtokenerror |
| 4248 | - } |
| 4249 | - state = fflib.FFParse_want_value |
| 4250 | - continue |
| 4251 | - case fflib.FFParse_want_value: |
| 4252 | - |
| 4253 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 4254 | - switch currentKey { |
| 4255 | - |
| 4256 | - case ffj_t_CBGithub_Followers: |
| 4257 | - goto handle_Followers |
| 4258 | - |
| 4259 | - case ffj_t_CBGithubno_such_key: |
| 4260 | - err = fs.SkipField(tok) |
| 4261 | - if err != nil { |
| 4262 | - return fs.WrapErr(err) |
| 4263 | - } |
| 4264 | - state = fflib.FFParse_after_value |
| 4265 | - goto mainparse |
| 4266 | - } |
| 4267 | - } else { |
| 4268 | - goto wantedvalue |
| 4269 | - } |
| 4270 | - } |
| 4271 | - } |
| 4272 | - |
| 4273 | -handle_Followers: |
| 4274 | - |
| 4275 | - /* handler: uj.Followers type=int kind=int quoted=false*/ |
| 4276 | - |
| 4277 | - { |
| 4278 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 4279 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 4280 | - } |
| 4281 | - } |
| 4282 | - |
| 4283 | - { |
| 4284 | - |
| 4285 | - if tok == fflib.FFTok_null { |
| 4286 | - |
| 4287 | - } else { |
| 4288 | - |
| 4289 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 4290 | - |
| 4291 | - if err != nil { |
| 4292 | - return fs.WrapErr(err) |
| 4293 | - } |
| 4294 | - |
| 4295 | - uj.Followers = int(tval) |
| 4296 | - |
| 4297 | - } |
| 4298 | - } |
| 4299 | - |
| 4300 | - state = fflib.FFParse_after_value |
| 4301 | - goto mainparse |
| 4302 | - |
| 4303 | -wantedvalue: |
| 4304 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 4305 | -wrongtokenerror: |
| 4306 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 4307 | -tokerror: |
| 4308 | - if fs.BigError != nil { |
| 4309 | - return fs.WrapErr(fs.BigError) |
| 4310 | - } |
| 4311 | - err = fs.Error.ToError() |
| 4312 | - if err != nil { |
| 4313 | - return fs.WrapErr(err) |
| 4314 | - } |
| 4315 | - panic("ffjson-generated: unreachable, please report bug.") |
| 4316 | -done: |
| 4317 | - return nil |
| 4318 | -} |
| 4319 | - |
| 4320 | -// Benchmark harness support for STK-REQ-004. |
| 4321 | -func (mj *CBGravatar) MarshalJSON() ([]byte, error) { |
| 4322 | - var buf fflib.Buffer |
| 4323 | - if mj == nil { |
| 4324 | - buf.WriteString("null") |
| 4325 | - return buf.Bytes(), nil |
| 4326 | - } |
| 4327 | - err := mj.MarshalJSONBuf(&buf) |
| 4328 | - if err != nil { |
| 4329 | - return nil, err |
| 4330 | - } |
| 4331 | - return buf.Bytes(), nil |
| 4332 | -} |
| 4333 | - |
| 4334 | -// Benchmark harness support for STK-REQ-004. |
| 4335 | -func (mj *CBGravatar) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 4336 | - if mj == nil { |
| 4337 | - buf.WriteString("null") |
| 4338 | - return nil |
| 4339 | - } |
| 4340 | - var err error |
| 4341 | - var obj []byte |
| 4342 | - _ = obj |
| 4343 | - _ = err |
| 4344 | - buf.WriteString(`{"Avatars":`) |
| 4345 | - if mj.Avatars != nil { |
| 4346 | - buf.WriteString(`[`) |
| 4347 | - for i, v := range mj.Avatars { |
| 4348 | - if i != 0 { |
| 4349 | - buf.WriteString(`,`) |
| 4350 | - } |
| 4351 | - |
| 4352 | - { |
| 4353 | - |
| 4354 | - if v == nil { |
| 4355 | - buf.WriteString("null") |
| 4356 | - return nil |
| 4357 | - } |
| 4358 | - |
| 4359 | - err = v.MarshalJSONBuf(buf) |
| 4360 | - if err != nil { |
| 4361 | - return err |
| 4362 | - } |
| 4363 | - |
| 4364 | - } |
| 4365 | - } |
| 4366 | - buf.WriteString(`]`) |
| 4367 | - } else { |
| 4368 | - buf.WriteString(`null`) |
| 4369 | - } |
| 4370 | - buf.WriteByte('}') |
| 4371 | - return nil |
| 4372 | -} |
| 4373 | - |
| 4374 | -const ( |
| 4375 | - ffj_t_CBGravatarbase = iota |
| 4376 | - ffj_t_CBGravatarno_such_key |
| 4377 | - |
| 4378 | - ffj_t_CBGravatar_Avatars |
| 4379 | -) |
| 4380 | - |
| 4381 | -var ffj_key_CBGravatar_Avatars = []byte("Avatars") |
| 4382 | - |
| 4383 | -// Benchmark harness support for STK-REQ-004. |
| 4384 | -func (uj *CBGravatar) UnmarshalJSON(input []byte) error { |
| 4385 | - fs := fflib.NewFFLexer(input) |
| 4386 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 4387 | -} |
| 4388 | - |
| 4389 | -// Benchmark harness support for STK-REQ-004. |
| 4390 | -func (uj *CBGravatar) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 4391 | - var err error = nil |
| 4392 | - currentKey := ffj_t_CBGravatarbase |
| 4393 | - _ = currentKey |
| 4394 | - tok := fflib.FFTok_init |
| 4395 | - wantedTok := fflib.FFTok_init |
| 4396 | - |
| 4397 | -mainparse: |
| 4398 | - for { |
| 4399 | - tok = fs.Scan() |
| 4400 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 4401 | - if tok == fflib.FFTok_error { |
| 4402 | - goto tokerror |
| 4403 | - } |
| 4404 | - |
| 4405 | - switch state { |
| 4406 | - |
| 4407 | - case fflib.FFParse_map_start: |
| 4408 | - if tok != fflib.FFTok_left_bracket { |
| 4409 | - wantedTok = fflib.FFTok_left_bracket |
| 4410 | - goto wrongtokenerror |
| 4411 | - } |
| 4412 | - state = fflib.FFParse_want_key |
| 4413 | - continue |
| 4414 | - |
| 4415 | - case fflib.FFParse_after_value: |
| 4416 | - if tok == fflib.FFTok_comma { |
| 4417 | - state = fflib.FFParse_want_key |
| 4418 | - } else if tok == fflib.FFTok_right_bracket { |
| 4419 | - goto done |
| 4420 | - } else { |
| 4421 | - wantedTok = fflib.FFTok_comma |
| 4422 | - goto wrongtokenerror |
| 4423 | - } |
| 4424 | - |
| 4425 | - case fflib.FFParse_want_key: |
| 4426 | - // json {} ended. goto exit. woo. |
| 4427 | - if tok == fflib.FFTok_right_bracket { |
| 4428 | - goto done |
| 4429 | - } |
| 4430 | - if tok != fflib.FFTok_string { |
| 4431 | - wantedTok = fflib.FFTok_string |
| 4432 | - goto wrongtokenerror |
| 4433 | - } |
| 4434 | - |
| 4435 | - kn := fs.Output.Bytes() |
| 4436 | - if len(kn) <= 0 { |
| 4437 | - // "" case. hrm. |
| 4438 | - currentKey = ffj_t_CBGravatarno_such_key |
| 4439 | - state = fflib.FFParse_want_colon |
| 4440 | - goto mainparse |
| 4441 | - } else { |
| 4442 | - switch kn[0] { |
| 4443 | - |
| 4444 | - case 'A': |
| 4445 | - |
| 4446 | - if bytes.Equal(ffj_key_CBGravatar_Avatars, kn) { |
| 4447 | - currentKey = ffj_t_CBGravatar_Avatars |
| 4448 | - state = fflib.FFParse_want_colon |
| 4449 | - goto mainparse |
| 4450 | - } |
| 4451 | - |
| 4452 | - } |
| 4453 | - |
| 4454 | - if fflib.EqualFoldRight(ffj_key_CBGravatar_Avatars, kn) { |
| 4455 | - currentKey = ffj_t_CBGravatar_Avatars |
| 4456 | - state = fflib.FFParse_want_colon |
| 4457 | - goto mainparse |
| 4458 | - } |
| 4459 | - |
| 4460 | - currentKey = ffj_t_CBGravatarno_such_key |
| 4461 | - state = fflib.FFParse_want_colon |
| 4462 | - goto mainparse |
| 4463 | - } |
| 4464 | - |
| 4465 | - case fflib.FFParse_want_colon: |
| 4466 | - if tok != fflib.FFTok_colon { |
| 4467 | - wantedTok = fflib.FFTok_colon |
| 4468 | - goto wrongtokenerror |
| 4469 | - } |
| 4470 | - state = fflib.FFParse_want_value |
| 4471 | - continue |
| 4472 | - case fflib.FFParse_want_value: |
| 4473 | - |
| 4474 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 4475 | - switch currentKey { |
| 4476 | - |
| 4477 | - case ffj_t_CBGravatar_Avatars: |
| 4478 | - goto handle_Avatars |
| 4479 | - |
| 4480 | - case ffj_t_CBGravatarno_such_key: |
| 4481 | - err = fs.SkipField(tok) |
| 4482 | - if err != nil { |
| 4483 | - return fs.WrapErr(err) |
| 4484 | - } |
| 4485 | - state = fflib.FFParse_after_value |
| 4486 | - goto mainparse |
| 4487 | - } |
| 4488 | - } else { |
| 4489 | - goto wantedvalue |
| 4490 | - } |
| 4491 | - } |
| 4492 | - } |
| 4493 | - |
| 4494 | -handle_Avatars: |
| 4495 | - |
| 4496 | - /* handler: uj.Avatars type=[]*benchmark.CBAvatar kind=slice quoted=false*/ |
| 4497 | - |
| 4498 | - { |
| 4499 | - |
| 4500 | - { |
| 4501 | - if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null { |
| 4502 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok)) |
| 4503 | - } |
| 4504 | - } |
| 4505 | - |
| 4506 | - if tok == fflib.FFTok_null { |
| 4507 | - uj.Avatars = nil |
| 4508 | - } else { |
| 4509 | - |
| 4510 | - uj.Avatars = make([]*CBAvatar, 0) |
| 4511 | - |
| 4512 | - wantVal := true |
| 4513 | - |
| 4514 | - for { |
| 4515 | - |
| 4516 | - var tmp_uj__Avatars *CBAvatar |
| 4517 | - |
| 4518 | - tok = fs.Scan() |
| 4519 | - if tok == fflib.FFTok_error { |
| 4520 | - goto tokerror |
| 4521 | - } |
| 4522 | - if tok == fflib.FFTok_right_brace { |
| 4523 | - break |
| 4524 | - } |
| 4525 | - |
| 4526 | - if tok == fflib.FFTok_comma { |
| 4527 | - if wantVal == true { |
| 4528 | - // TODO(pquerna): this isn't an ideal error message, this handles |
| 4529 | - // things like [,,,] as an array value. |
| 4530 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 4531 | - } |
| 4532 | - continue |
| 4533 | - } else { |
| 4534 | - wantVal = true |
| 4535 | - } |
| 4536 | - |
| 4537 | - /* handler: tmp_uj__Avatars type=*benchmark.CBAvatar kind=ptr quoted=false*/ |
| 4538 | - |
| 4539 | - { |
| 4540 | - if tok == fflib.FFTok_null { |
| 4541 | - |
| 4542 | - tmp_uj__Avatars = nil |
| 4543 | - |
| 4544 | - state = fflib.FFParse_after_value |
| 4545 | - goto mainparse |
| 4546 | - } |
| 4547 | - |
| 4548 | - if tmp_uj__Avatars == nil { |
| 4549 | - tmp_uj__Avatars = new(CBAvatar) |
| 4550 | - } |
| 4551 | - |
| 4552 | - err = tmp_uj__Avatars.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 4553 | - if err != nil { |
| 4554 | - return err |
| 4555 | - } |
| 4556 | - state = fflib.FFParse_after_value |
| 4557 | - } |
| 4558 | - |
| 4559 | - uj.Avatars = append(uj.Avatars, tmp_uj__Avatars) |
| 4560 | - wantVal = false |
| 4561 | - } |
| 4562 | - } |
| 4563 | - } |
| 4564 | - |
| 4565 | - state = fflib.FFParse_after_value |
| 4566 | - goto mainparse |
| 4567 | - |
| 4568 | -wantedvalue: |
| 4569 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 4570 | -wrongtokenerror: |
| 4571 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 4572 | -tokerror: |
| 4573 | - if fs.BigError != nil { |
| 4574 | - return fs.WrapErr(fs.BigError) |
| 4575 | - } |
| 4576 | - err = fs.Error.ToError() |
| 4577 | - if err != nil { |
| 4578 | - return fs.WrapErr(err) |
| 4579 | - } |
| 4580 | - panic("ffjson-generated: unreachable, please report bug.") |
| 4581 | -done: |
| 4582 | - return nil |
| 4583 | -} |
| 4584 | - |
| 4585 | -// Benchmark harness support for STK-REQ-004. |
| 4586 | -func (mj *CBName) MarshalJSON() ([]byte, error) { |
| 4587 | - var buf fflib.Buffer |
| 4588 | - if mj == nil { |
| 4589 | - buf.WriteString("null") |
| 4590 | - return buf.Bytes(), nil |
| 4591 | - } |
| 4592 | - err := mj.MarshalJSONBuf(&buf) |
| 4593 | - if err != nil { |
| 4594 | - return nil, err |
| 4595 | - } |
| 4596 | - return buf.Bytes(), nil |
| 4597 | -} |
| 4598 | - |
| 4599 | -// Benchmark harness support for STK-REQ-004. |
| 4600 | -func (mj *CBName) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 4601 | - if mj == nil { |
| 4602 | - buf.WriteString("null") |
| 4603 | - return nil |
| 4604 | - } |
| 4605 | - var err error |
| 4606 | - var obj []byte |
| 4607 | - _ = obj |
| 4608 | - _ = err |
| 4609 | - buf.WriteString(`{"FullName":`) |
| 4610 | - fflib.WriteJsonString(buf, string(mj.FullName)) |
| 4611 | - buf.WriteByte('}') |
| 4612 | - return nil |
| 4613 | -} |
| 4614 | - |
| 4615 | -const ( |
| 4616 | - ffj_t_CBNamebase = iota |
| 4617 | - ffj_t_CBNameno_such_key |
| 4618 | - |
| 4619 | - ffj_t_CBName_FullName |
| 4620 | -) |
| 4621 | - |
| 4622 | -var ffj_key_CBName_FullName = []byte("FullName") |
| 4623 | - |
| 4624 | -// Benchmark harness support for STK-REQ-004. |
| 4625 | -func (uj *CBName) UnmarshalJSON(input []byte) error { |
| 4626 | - fs := fflib.NewFFLexer(input) |
| 4627 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 4628 | -} |
| 4629 | - |
| 4630 | -// Benchmark harness support for STK-REQ-004. |
| 4631 | -func (uj *CBName) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 4632 | - var err error = nil |
| 4633 | - currentKey := ffj_t_CBNamebase |
| 4634 | - _ = currentKey |
| 4635 | - tok := fflib.FFTok_init |
| 4636 | - wantedTok := fflib.FFTok_init |
| 4637 | - |
| 4638 | -mainparse: |
| 4639 | - for { |
| 4640 | - tok = fs.Scan() |
| 4641 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 4642 | - if tok == fflib.FFTok_error { |
| 4643 | - goto tokerror |
| 4644 | - } |
| 4645 | - |
| 4646 | - switch state { |
| 4647 | - |
| 4648 | - case fflib.FFParse_map_start: |
| 4649 | - if tok != fflib.FFTok_left_bracket { |
| 4650 | - wantedTok = fflib.FFTok_left_bracket |
| 4651 | - goto wrongtokenerror |
| 4652 | - } |
| 4653 | - state = fflib.FFParse_want_key |
| 4654 | - continue |
| 4655 | - |
| 4656 | - case fflib.FFParse_after_value: |
| 4657 | - if tok == fflib.FFTok_comma { |
| 4658 | - state = fflib.FFParse_want_key |
| 4659 | - } else if tok == fflib.FFTok_right_bracket { |
| 4660 | - goto done |
| 4661 | - } else { |
| 4662 | - wantedTok = fflib.FFTok_comma |
| 4663 | - goto wrongtokenerror |
| 4664 | - } |
| 4665 | - |
| 4666 | - case fflib.FFParse_want_key: |
| 4667 | - // json {} ended. goto exit. woo. |
| 4668 | - if tok == fflib.FFTok_right_bracket { |
| 4669 | - goto done |
| 4670 | - } |
| 4671 | - if tok != fflib.FFTok_string { |
| 4672 | - wantedTok = fflib.FFTok_string |
| 4673 | - goto wrongtokenerror |
| 4674 | - } |
| 4675 | - |
| 4676 | - kn := fs.Output.Bytes() |
| 4677 | - if len(kn) <= 0 { |
| 4678 | - // "" case. hrm. |
| 4679 | - currentKey = ffj_t_CBNameno_such_key |
| 4680 | - state = fflib.FFParse_want_colon |
| 4681 | - goto mainparse |
| 4682 | - } else { |
| 4683 | - switch kn[0] { |
| 4684 | - |
| 4685 | - case 'F': |
| 4686 | - |
| 4687 | - if bytes.Equal(ffj_key_CBName_FullName, kn) { |
| 4688 | - currentKey = ffj_t_CBName_FullName |
| 4689 | - state = fflib.FFParse_want_colon |
| 4690 | - goto mainparse |
| 4691 | - } |
| 4692 | - |
| 4693 | - } |
| 4694 | - |
| 4695 | - if fflib.SimpleLetterEqualFold(ffj_key_CBName_FullName, kn) { |
| 4696 | - currentKey = ffj_t_CBName_FullName |
| 4697 | - state = fflib.FFParse_want_colon |
| 4698 | - goto mainparse |
| 4699 | - } |
| 4700 | - |
| 4701 | - currentKey = ffj_t_CBNameno_such_key |
| 4702 | - state = fflib.FFParse_want_colon |
| 4703 | - goto mainparse |
| 4704 | - } |
| 4705 | - |
| 4706 | - case fflib.FFParse_want_colon: |
| 4707 | - if tok != fflib.FFTok_colon { |
| 4708 | - wantedTok = fflib.FFTok_colon |
| 4709 | - goto wrongtokenerror |
| 4710 | - } |
| 4711 | - state = fflib.FFParse_want_value |
| 4712 | - continue |
| 4713 | - case fflib.FFParse_want_value: |
| 4714 | - |
| 4715 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 4716 | - switch currentKey { |
| 4717 | - |
| 4718 | - case ffj_t_CBName_FullName: |
| 4719 | - goto handle_FullName |
| 4720 | - |
| 4721 | - case ffj_t_CBNameno_such_key: |
| 4722 | - err = fs.SkipField(tok) |
| 4723 | - if err != nil { |
| 4724 | - return fs.WrapErr(err) |
| 4725 | - } |
| 4726 | - state = fflib.FFParse_after_value |
| 4727 | - goto mainparse |
| 4728 | - } |
| 4729 | - } else { |
| 4730 | - goto wantedvalue |
| 4731 | - } |
| 4732 | - } |
| 4733 | - } |
| 4734 | - |
| 4735 | -handle_FullName: |
| 4736 | - |
| 4737 | - /* handler: uj.FullName type=string kind=string quoted=false*/ |
| 4738 | - |
| 4739 | - { |
| 4740 | - |
| 4741 | - { |
| 4742 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 4743 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 4744 | - } |
| 4745 | - } |
| 4746 | - |
| 4747 | - if tok == fflib.FFTok_null { |
| 4748 | - |
| 4749 | - } else { |
| 4750 | - |
| 4751 | - outBuf := fs.Output.Bytes() |
| 4752 | - |
| 4753 | - uj.FullName = string(string(outBuf)) |
| 4754 | - |
| 4755 | - } |
| 4756 | - } |
| 4757 | - |
| 4758 | - state = fflib.FFParse_after_value |
| 4759 | - goto mainparse |
| 4760 | - |
| 4761 | -wantedvalue: |
| 4762 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 4763 | -wrongtokenerror: |
| 4764 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 4765 | -tokerror: |
| 4766 | - if fs.BigError != nil { |
| 4767 | - return fs.WrapErr(fs.BigError) |
| 4768 | - } |
| 4769 | - err = fs.Error.ToError() |
| 4770 | - if err != nil { |
| 4771 | - return fs.WrapErr(err) |
| 4772 | - } |
| 4773 | - panic("ffjson-generated: unreachable, please report bug.") |
| 4774 | -done: |
| 4775 | - return nil |
| 4776 | -} |
| 4777 | - |
| 4778 | -// Benchmark harness support for STK-REQ-004. |
| 4779 | -func (mj *CBPerson) MarshalJSON() ([]byte, error) { |
| 4780 | - var buf fflib.Buffer |
| 4781 | - if mj == nil { |
| 4782 | - buf.WriteString("null") |
| 4783 | - return buf.Bytes(), nil |
| 4784 | - } |
| 4785 | - err := mj.MarshalJSONBuf(&buf) |
| 4786 | - if err != nil { |
| 4787 | - return nil, err |
| 4788 | - } |
| 4789 | - return buf.Bytes(), nil |
| 4790 | -} |
| 4791 | - |
| 4792 | -// Benchmark harness support for STK-REQ-004. |
| 4793 | -func (mj *CBPerson) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 4794 | - if mj == nil { |
| 4795 | - buf.WriteString("null") |
| 4796 | - return nil |
| 4797 | - } |
| 4798 | - var err error |
| 4799 | - var obj []byte |
| 4800 | - _ = obj |
| 4801 | - _ = err |
| 4802 | - if mj.Name != nil { |
| 4803 | - buf.WriteString(`{"Name":`) |
| 4804 | - |
| 4805 | - { |
| 4806 | - |
| 4807 | - err = mj.Name.MarshalJSONBuf(buf) |
| 4808 | - if err != nil { |
| 4809 | - return err |
| 4810 | - } |
| 4811 | - |
| 4812 | - } |
| 4813 | - } else { |
| 4814 | - buf.WriteString(`{"Name":null`) |
| 4815 | - } |
| 4816 | - if mj.Github != nil { |
| 4817 | - buf.WriteString(`,"Github":`) |
| 4818 | - |
| 4819 | - { |
| 4820 | - |
| 4821 | - err = mj.Github.MarshalJSONBuf(buf) |
| 4822 | - if err != nil { |
| 4823 | - return err |
| 4824 | - } |
| 4825 | - |
| 4826 | - } |
| 4827 | - } else { |
| 4828 | - buf.WriteString(`,"Github":null`) |
| 4829 | - } |
| 4830 | - if mj.Gravatar != nil { |
| 4831 | - buf.WriteString(`,"Gravatar":`) |
| 4832 | - |
| 4833 | - { |
| 4834 | - |
| 4835 | - err = mj.Gravatar.MarshalJSONBuf(buf) |
| 4836 | - if err != nil { |
| 4837 | - return err |
| 4838 | - } |
| 4839 | - |
| 4840 | - } |
| 4841 | - } else { |
| 4842 | - buf.WriteString(`,"Gravatar":null`) |
| 4843 | - } |
| 4844 | - buf.WriteByte('}') |
| 4845 | - return nil |
| 4846 | -} |
| 4847 | - |
| 4848 | -const ( |
| 4849 | - ffj_t_CBPersonbase = iota |
| 4850 | - ffj_t_CBPersonno_such_key |
| 4851 | - |
| 4852 | - ffj_t_CBPerson_Name |
| 4853 | - |
| 4854 | - ffj_t_CBPerson_Github |
| 4855 | - |
| 4856 | - ffj_t_CBPerson_Gravatar |
| 4857 | -) |
| 4858 | - |
| 4859 | -var ffj_key_CBPerson_Name = []byte("Name") |
| 4860 | - |
| 4861 | -var ffj_key_CBPerson_Github = []byte("Github") |
| 4862 | - |
| 4863 | -var ffj_key_CBPerson_Gravatar = []byte("Gravatar") |
| 4864 | - |
| 4865 | -// Benchmark harness support for STK-REQ-004. |
| 4866 | -func (uj *CBPerson) UnmarshalJSON(input []byte) error { |
| 4867 | - fs := fflib.NewFFLexer(input) |
| 4868 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 4869 | -} |
| 4870 | - |
| 4871 | -// Benchmark harness support for STK-REQ-004. |
| 4872 | -func (uj *CBPerson) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 4873 | - var err error = nil |
| 4874 | - currentKey := ffj_t_CBPersonbase |
| 4875 | - _ = currentKey |
| 4876 | - tok := fflib.FFTok_init |
| 4877 | - wantedTok := fflib.FFTok_init |
| 4878 | - |
| 4879 | -mainparse: |
| 4880 | - for { |
| 4881 | - tok = fs.Scan() |
| 4882 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 4883 | - if tok == fflib.FFTok_error { |
| 4884 | - goto tokerror |
| 4885 | - } |
| 4886 | - |
| 4887 | - switch state { |
| 4888 | - |
| 4889 | - case fflib.FFParse_map_start: |
| 4890 | - if tok != fflib.FFTok_left_bracket { |
| 4891 | - wantedTok = fflib.FFTok_left_bracket |
| 4892 | - goto wrongtokenerror |
| 4893 | - } |
| 4894 | - state = fflib.FFParse_want_key |
| 4895 | - continue |
| 4896 | - |
| 4897 | - case fflib.FFParse_after_value: |
| 4898 | - if tok == fflib.FFTok_comma { |
| 4899 | - state = fflib.FFParse_want_key |
| 4900 | - } else if tok == fflib.FFTok_right_bracket { |
| 4901 | - goto done |
| 4902 | - } else { |
| 4903 | - wantedTok = fflib.FFTok_comma |
| 4904 | - goto wrongtokenerror |
| 4905 | - } |
| 4906 | - |
| 4907 | - case fflib.FFParse_want_key: |
| 4908 | - // json {} ended. goto exit. woo. |
| 4909 | - if tok == fflib.FFTok_right_bracket { |
| 4910 | - goto done |
| 4911 | - } |
| 4912 | - if tok != fflib.FFTok_string { |
| 4913 | - wantedTok = fflib.FFTok_string |
| 4914 | - goto wrongtokenerror |
| 4915 | - } |
| 4916 | - |
| 4917 | - kn := fs.Output.Bytes() |
| 4918 | - if len(kn) <= 0 { |
| 4919 | - // "" case. hrm. |
| 4920 | - currentKey = ffj_t_CBPersonno_such_key |
| 4921 | - state = fflib.FFParse_want_colon |
| 4922 | - goto mainparse |
| 4923 | - } else { |
| 4924 | - switch kn[0] { |
| 4925 | - |
| 4926 | - case 'G': |
| 4927 | - |
| 4928 | - if bytes.Equal(ffj_key_CBPerson_Github, kn) { |
| 4929 | - currentKey = ffj_t_CBPerson_Github |
| 4930 | - state = fflib.FFParse_want_colon |
| 4931 | - goto mainparse |
| 4932 | - |
| 4933 | - } else if bytes.Equal(ffj_key_CBPerson_Gravatar, kn) { |
| 4934 | - currentKey = ffj_t_CBPerson_Gravatar |
| 4935 | - state = fflib.FFParse_want_colon |
| 4936 | - goto mainparse |
| 4937 | - } |
| 4938 | - |
| 4939 | - case 'N': |
| 4940 | - |
| 4941 | - if bytes.Equal(ffj_key_CBPerson_Name, kn) { |
| 4942 | - currentKey = ffj_t_CBPerson_Name |
| 4943 | - state = fflib.FFParse_want_colon |
| 4944 | - goto mainparse |
| 4945 | - } |
| 4946 | - |
| 4947 | - } |
| 4948 | - |
| 4949 | - if fflib.SimpleLetterEqualFold(ffj_key_CBPerson_Gravatar, kn) { |
| 4950 | - currentKey = ffj_t_CBPerson_Gravatar |
| 4951 | - state = fflib.FFParse_want_colon |
| 4952 | - goto mainparse |
| 4953 | - } |
| 4954 | - |
| 4955 | - if fflib.SimpleLetterEqualFold(ffj_key_CBPerson_Github, kn) { |
| 4956 | - currentKey = ffj_t_CBPerson_Github |
| 4957 | - state = fflib.FFParse_want_colon |
| 4958 | - goto mainparse |
| 4959 | - } |
| 4960 | - |
| 4961 | - if fflib.SimpleLetterEqualFold(ffj_key_CBPerson_Name, kn) { |
| 4962 | - currentKey = ffj_t_CBPerson_Name |
| 4963 | - state = fflib.FFParse_want_colon |
| 4964 | - goto mainparse |
| 4965 | - } |
| 4966 | - |
| 4967 | - currentKey = ffj_t_CBPersonno_such_key |
| 4968 | - state = fflib.FFParse_want_colon |
| 4969 | - goto mainparse |
| 4970 | - } |
| 4971 | - |
| 4972 | - case fflib.FFParse_want_colon: |
| 4973 | - if tok != fflib.FFTok_colon { |
| 4974 | - wantedTok = fflib.FFTok_colon |
| 4975 | - goto wrongtokenerror |
| 4976 | - } |
| 4977 | - state = fflib.FFParse_want_value |
| 4978 | - continue |
| 4979 | - case fflib.FFParse_want_value: |
| 4980 | - |
| 4981 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 4982 | - switch currentKey { |
| 4983 | - |
| 4984 | - case ffj_t_CBPerson_Name: |
| 4985 | - goto handle_Name |
| 4986 | - |
| 4987 | - case ffj_t_CBPerson_Github: |
| 4988 | - goto handle_Github |
| 4989 | - |
| 4990 | - case ffj_t_CBPerson_Gravatar: |
| 4991 | - goto handle_Gravatar |
| 4992 | - |
| 4993 | - case ffj_t_CBPersonno_such_key: |
| 4994 | - err = fs.SkipField(tok) |
| 4995 | - if err != nil { |
| 4996 | - return fs.WrapErr(err) |
| 4997 | - } |
| 4998 | - state = fflib.FFParse_after_value |
| 4999 | - goto mainparse |
| 5000 | - } |
| 5001 | - } else { |
| 5002 | - goto wantedvalue |
| 5003 | - } |
| 5004 | - } |
| 5005 | - } |
| 5006 | - |
| 5007 | -handle_Name: |
| 5008 | - |
| 5009 | - /* handler: uj.Name type=benchmark.CBName kind=struct quoted=false*/ |
| 5010 | - |
| 5011 | - { |
| 5012 | - if tok == fflib.FFTok_null { |
| 5013 | - |
| 5014 | - uj.Name = nil |
| 5015 | - |
| 5016 | - state = fflib.FFParse_after_value |
| 5017 | - goto mainparse |
| 5018 | - } |
| 5019 | - |
| 5020 | - if uj.Name == nil { |
| 5021 | - uj.Name = new(CBName) |
| 5022 | - } |
| 5023 | - |
| 5024 | - err = uj.Name.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 5025 | - if err != nil { |
| 5026 | - return err |
| 5027 | - } |
| 5028 | - state = fflib.FFParse_after_value |
| 5029 | - } |
| 5030 | - |
| 5031 | - state = fflib.FFParse_after_value |
| 5032 | - goto mainparse |
| 5033 | - |
| 5034 | -handle_Github: |
| 5035 | - |
| 5036 | - /* handler: uj.Github type=benchmark.CBGithub kind=struct quoted=false*/ |
| 5037 | - |
| 5038 | - { |
| 5039 | - if tok == fflib.FFTok_null { |
| 5040 | - |
| 5041 | - uj.Github = nil |
| 5042 | - |
| 5043 | - state = fflib.FFParse_after_value |
| 5044 | - goto mainparse |
| 5045 | - } |
| 5046 | - |
| 5047 | - if uj.Github == nil { |
| 5048 | - uj.Github = new(CBGithub) |
| 5049 | - } |
| 5050 | - |
| 5051 | - err = uj.Github.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 5052 | - if err != nil { |
| 5053 | - return err |
| 5054 | - } |
| 5055 | - state = fflib.FFParse_after_value |
| 5056 | - } |
| 5057 | - |
| 5058 | - state = fflib.FFParse_after_value |
| 5059 | - goto mainparse |
| 5060 | - |
| 5061 | -handle_Gravatar: |
| 5062 | - |
| 5063 | - /* handler: uj.Gravatar type=benchmark.CBGravatar kind=struct quoted=false*/ |
| 5064 | - |
| 5065 | - { |
| 5066 | - if tok == fflib.FFTok_null { |
| 5067 | - |
| 5068 | - uj.Gravatar = nil |
| 5069 | - |
| 5070 | - state = fflib.FFParse_after_value |
| 5071 | - goto mainparse |
| 5072 | - } |
| 5073 | - |
| 5074 | - if uj.Gravatar == nil { |
| 5075 | - uj.Gravatar = new(CBGravatar) |
| 5076 | - } |
| 5077 | - |
| 5078 | - err = uj.Gravatar.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 5079 | - if err != nil { |
| 5080 | - return err |
| 5081 | - } |
| 5082 | - state = fflib.FFParse_after_value |
| 5083 | - } |
| 5084 | - |
| 5085 | - state = fflib.FFParse_after_value |
| 5086 | - goto mainparse |
| 5087 | - |
| 5088 | -wantedvalue: |
| 5089 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 5090 | -wrongtokenerror: |
| 5091 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 5092 | -tokerror: |
| 5093 | - if fs.BigError != nil { |
| 5094 | - return fs.WrapErr(fs.BigError) |
| 5095 | - } |
| 5096 | - err = fs.Error.ToError() |
| 5097 | - if err != nil { |
| 5098 | - return fs.WrapErr(err) |
| 5099 | - } |
| 5100 | - panic("ffjson-generated: unreachable, please report bug.") |
| 5101 | -done: |
| 5102 | - return nil |
| 5103 | -} |
| 5104 | - |
| 5105 | -// Benchmark harness support for STK-REQ-004. |
| 5106 | -func (mj *DSTopic) MarshalJSON() ([]byte, error) { |
| 5107 | - var buf fflib.Buffer |
| 5108 | - if mj == nil { |
| 5109 | - buf.WriteString("null") |
| 5110 | - return buf.Bytes(), nil |
| 5111 | - } |
| 5112 | - err := mj.MarshalJSONBuf(&buf) |
| 5113 | - if err != nil { |
| 5114 | - return nil, err |
| 5115 | - } |
| 5116 | - return buf.Bytes(), nil |
| 5117 | -} |
| 5118 | - |
| 5119 | -// Benchmark harness support for STK-REQ-004. |
| 5120 | -func (mj *DSTopic) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 5121 | - if mj == nil { |
| 5122 | - buf.WriteString("null") |
| 5123 | - return nil |
| 5124 | - } |
| 5125 | - var err error |
| 5126 | - var obj []byte |
| 5127 | - _ = obj |
| 5128 | - _ = err |
| 5129 | - buf.WriteString(`{"Id":`) |
| 5130 | - fflib.FormatBits2(buf, uint64(mj.Id), 10, mj.Id < 0) |
| 5131 | - buf.WriteString(`,"Slug":`) |
| 5132 | - fflib.WriteJsonString(buf, string(mj.Slug)) |
| 5133 | - buf.WriteByte('}') |
| 5134 | - return nil |
| 5135 | -} |
| 5136 | - |
| 5137 | -const ( |
| 5138 | - ffj_t_DSTopicbase = iota |
| 5139 | - ffj_t_DSTopicno_such_key |
| 5140 | - |
| 5141 | - ffj_t_DSTopic_Id |
| 5142 | - |
| 5143 | - ffj_t_DSTopic_Slug |
| 5144 | -) |
| 5145 | - |
| 5146 | -var ffj_key_DSTopic_Id = []byte("Id") |
| 5147 | - |
| 5148 | -var ffj_key_DSTopic_Slug = []byte("Slug") |
| 5149 | - |
| 5150 | -// Benchmark harness support for STK-REQ-004. |
| 5151 | -func (uj *DSTopic) UnmarshalJSON(input []byte) error { |
| 5152 | - fs := fflib.NewFFLexer(input) |
| 5153 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 5154 | -} |
| 5155 | - |
| 5156 | -// Benchmark harness support for STK-REQ-004. |
| 5157 | -func (uj *DSTopic) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 5158 | - var err error = nil |
| 5159 | - currentKey := ffj_t_DSTopicbase |
| 5160 | - _ = currentKey |
| 5161 | - tok := fflib.FFTok_init |
| 5162 | - wantedTok := fflib.FFTok_init |
| 5163 | - |
| 5164 | -mainparse: |
| 5165 | - for { |
| 5166 | - tok = fs.Scan() |
| 5167 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 5168 | - if tok == fflib.FFTok_error { |
| 5169 | - goto tokerror |
| 5170 | - } |
| 5171 | - |
| 5172 | - switch state { |
| 5173 | - |
| 5174 | - case fflib.FFParse_map_start: |
| 5175 | - if tok != fflib.FFTok_left_bracket { |
| 5176 | - wantedTok = fflib.FFTok_left_bracket |
| 5177 | - goto wrongtokenerror |
| 5178 | - } |
| 5179 | - state = fflib.FFParse_want_key |
| 5180 | - continue |
| 5181 | - |
| 5182 | - case fflib.FFParse_after_value: |
| 5183 | - if tok == fflib.FFTok_comma { |
| 5184 | - state = fflib.FFParse_want_key |
| 5185 | - } else if tok == fflib.FFTok_right_bracket { |
| 5186 | - goto done |
| 5187 | - } else { |
| 5188 | - wantedTok = fflib.FFTok_comma |
| 5189 | - goto wrongtokenerror |
| 5190 | - } |
| 5191 | - |
| 5192 | - case fflib.FFParse_want_key: |
| 5193 | - // json {} ended. goto exit. woo. |
| 5194 | - if tok == fflib.FFTok_right_bracket { |
| 5195 | - goto done |
| 5196 | - } |
| 5197 | - if tok != fflib.FFTok_string { |
| 5198 | - wantedTok = fflib.FFTok_string |
| 5199 | - goto wrongtokenerror |
| 5200 | - } |
| 5201 | - |
| 5202 | - kn := fs.Output.Bytes() |
| 5203 | - if len(kn) <= 0 { |
| 5204 | - // "" case. hrm. |
| 5205 | - currentKey = ffj_t_DSTopicno_such_key |
| 5206 | - state = fflib.FFParse_want_colon |
| 5207 | - goto mainparse |
| 5208 | - } else { |
| 5209 | - switch kn[0] { |
| 5210 | - |
| 5211 | - case 'I': |
| 5212 | - |
| 5213 | - if bytes.Equal(ffj_key_DSTopic_Id, kn) { |
| 5214 | - currentKey = ffj_t_DSTopic_Id |
| 5215 | - state = fflib.FFParse_want_colon |
| 5216 | - goto mainparse |
| 5217 | - } |
| 5218 | - |
| 5219 | - case 'S': |
| 5220 | - |
| 5221 | - if bytes.Equal(ffj_key_DSTopic_Slug, kn) { |
| 5222 | - currentKey = ffj_t_DSTopic_Slug |
| 5223 | - state = fflib.FFParse_want_colon |
| 5224 | - goto mainparse |
| 5225 | - } |
| 5226 | - |
| 5227 | - } |
| 5228 | - |
| 5229 | - if fflib.EqualFoldRight(ffj_key_DSTopic_Slug, kn) { |
| 5230 | - currentKey = ffj_t_DSTopic_Slug |
| 5231 | - state = fflib.FFParse_want_colon |
| 5232 | - goto mainparse |
| 5233 | - } |
| 5234 | - |
| 5235 | - if fflib.SimpleLetterEqualFold(ffj_key_DSTopic_Id, kn) { |
| 5236 | - currentKey = ffj_t_DSTopic_Id |
| 5237 | - state = fflib.FFParse_want_colon |
| 5238 | - goto mainparse |
| 5239 | - } |
| 5240 | - |
| 5241 | - currentKey = ffj_t_DSTopicno_such_key |
| 5242 | - state = fflib.FFParse_want_colon |
| 5243 | - goto mainparse |
| 5244 | - } |
| 5245 | - |
| 5246 | - case fflib.FFParse_want_colon: |
| 5247 | - if tok != fflib.FFTok_colon { |
| 5248 | - wantedTok = fflib.FFTok_colon |
| 5249 | - goto wrongtokenerror |
| 5250 | - } |
| 5251 | - state = fflib.FFParse_want_value |
| 5252 | - continue |
| 5253 | - case fflib.FFParse_want_value: |
| 5254 | - |
| 5255 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 5256 | - switch currentKey { |
| 5257 | - |
| 5258 | - case ffj_t_DSTopic_Id: |
| 5259 | - goto handle_Id |
| 5260 | - |
| 5261 | - case ffj_t_DSTopic_Slug: |
| 5262 | - goto handle_Slug |
| 5263 | - |
| 5264 | - case ffj_t_DSTopicno_such_key: |
| 5265 | - err = fs.SkipField(tok) |
| 5266 | - if err != nil { |
| 5267 | - return fs.WrapErr(err) |
| 5268 | - } |
| 5269 | - state = fflib.FFParse_after_value |
| 5270 | - goto mainparse |
| 5271 | - } |
| 5272 | - } else { |
| 5273 | - goto wantedvalue |
| 5274 | - } |
| 5275 | - } |
| 5276 | - } |
| 5277 | - |
| 5278 | -handle_Id: |
| 5279 | - |
| 5280 | - /* handler: uj.Id type=int kind=int quoted=false*/ |
| 5281 | - |
| 5282 | - { |
| 5283 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 5284 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 5285 | - } |
| 5286 | - } |
| 5287 | - |
| 5288 | - { |
| 5289 | - |
| 5290 | - if tok == fflib.FFTok_null { |
| 5291 | - |
| 5292 | - } else { |
| 5293 | - |
| 5294 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 5295 | - |
| 5296 | - if err != nil { |
| 5297 | - return fs.WrapErr(err) |
| 5298 | - } |
| 5299 | - |
| 5300 | - uj.Id = int(tval) |
| 5301 | - |
| 5302 | - } |
| 5303 | - } |
| 5304 | - |
| 5305 | - state = fflib.FFParse_after_value |
| 5306 | - goto mainparse |
| 5307 | - |
| 5308 | -handle_Slug: |
| 5309 | - |
| 5310 | - /* handler: uj.Slug type=string kind=string quoted=false*/ |
| 5311 | - |
| 5312 | - { |
| 5313 | - |
| 5314 | - { |
| 5315 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 5316 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 5317 | - } |
| 5318 | - } |
| 5319 | - |
| 5320 | - if tok == fflib.FFTok_null { |
| 5321 | - |
| 5322 | - } else { |
| 5323 | - |
| 5324 | - outBuf := fs.Output.Bytes() |
| 5325 | - |
| 5326 | - uj.Slug = string(string(outBuf)) |
| 5327 | - |
| 5328 | - } |
| 5329 | - } |
| 5330 | - |
| 5331 | - state = fflib.FFParse_after_value |
| 5332 | - goto mainparse |
| 5333 | - |
| 5334 | -wantedvalue: |
| 5335 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 5336 | -wrongtokenerror: |
| 5337 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 5338 | -tokerror: |
| 5339 | - if fs.BigError != nil { |
| 5340 | - return fs.WrapErr(fs.BigError) |
| 5341 | - } |
| 5342 | - err = fs.Error.ToError() |
| 5343 | - if err != nil { |
| 5344 | - return fs.WrapErr(err) |
| 5345 | - } |
| 5346 | - panic("ffjson-generated: unreachable, please report bug.") |
| 5347 | -done: |
| 5348 | - return nil |
| 5349 | -} |
| 5350 | - |
| 5351 | -// Benchmark harness support for STK-REQ-004. |
| 5352 | -func (mj *DSTopicsList) MarshalJSON() ([]byte, error) { |
| 5353 | - var buf fflib.Buffer |
| 5354 | - if mj == nil { |
| 5355 | - buf.WriteString("null") |
| 5356 | - return buf.Bytes(), nil |
| 5357 | - } |
| 5358 | - err := mj.MarshalJSONBuf(&buf) |
| 5359 | - if err != nil { |
| 5360 | - return nil, err |
| 5361 | - } |
| 5362 | - return buf.Bytes(), nil |
| 5363 | -} |
| 5364 | - |
| 5365 | -// Benchmark harness support for STK-REQ-004. |
| 5366 | -func (mj *DSTopicsList) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 5367 | - if mj == nil { |
| 5368 | - buf.WriteString("null") |
| 5369 | - return nil |
| 5370 | - } |
| 5371 | - var err error |
| 5372 | - var obj []byte |
| 5373 | - _ = obj |
| 5374 | - _ = err |
| 5375 | - buf.WriteString(`{"Topics":`) |
| 5376 | - if mj.Topics != nil { |
| 5377 | - buf.WriteString(`[`) |
| 5378 | - for i, v := range mj.Topics { |
| 5379 | - if i != 0 { |
| 5380 | - buf.WriteString(`,`) |
| 5381 | - } |
| 5382 | - |
| 5383 | - { |
| 5384 | - |
| 5385 | - if v == nil { |
| 5386 | - buf.WriteString("null") |
| 5387 | - return nil |
| 5388 | - } |
| 5389 | - |
| 5390 | - err = v.MarshalJSONBuf(buf) |
| 5391 | - if err != nil { |
| 5392 | - return err |
| 5393 | - } |
| 5394 | - |
| 5395 | - } |
| 5396 | - } |
| 5397 | - buf.WriteString(`]`) |
| 5398 | - } else { |
| 5399 | - buf.WriteString(`null`) |
| 5400 | - } |
| 5401 | - buf.WriteString(`,"MoreTopicsUrl":`) |
| 5402 | - fflib.WriteJsonString(buf, string(mj.MoreTopicsUrl)) |
| 5403 | - buf.WriteByte('}') |
| 5404 | - return nil |
| 5405 | -} |
| 5406 | - |
| 5407 | -const ( |
| 5408 | - ffj_t_DSTopicsListbase = iota |
| 5409 | - ffj_t_DSTopicsListno_such_key |
| 5410 | - |
| 5411 | - ffj_t_DSTopicsList_Topics |
| 5412 | - |
| 5413 | - ffj_t_DSTopicsList_MoreTopicsUrl |
| 5414 | -) |
| 5415 | - |
| 5416 | -var ffj_key_DSTopicsList_Topics = []byte("Topics") |
| 5417 | - |
| 5418 | -var ffj_key_DSTopicsList_MoreTopicsUrl = []byte("MoreTopicsUrl") |
| 5419 | - |
| 5420 | -// Benchmark harness support for STK-REQ-004. |
| 5421 | -func (uj *DSTopicsList) UnmarshalJSON(input []byte) error { |
| 5422 | - fs := fflib.NewFFLexer(input) |
| 5423 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 5424 | -} |
| 5425 | - |
| 5426 | -// Benchmark harness support for STK-REQ-004. |
| 5427 | -func (uj *DSTopicsList) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 5428 | - var err error = nil |
| 5429 | - currentKey := ffj_t_DSTopicsListbase |
| 5430 | - _ = currentKey |
| 5431 | - tok := fflib.FFTok_init |
| 5432 | - wantedTok := fflib.FFTok_init |
| 5433 | - |
| 5434 | -mainparse: |
| 5435 | - for { |
| 5436 | - tok = fs.Scan() |
| 5437 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 5438 | - if tok == fflib.FFTok_error { |
| 5439 | - goto tokerror |
| 5440 | - } |
| 5441 | - |
| 5442 | - switch state { |
| 5443 | - |
| 5444 | - case fflib.FFParse_map_start: |
| 5445 | - if tok != fflib.FFTok_left_bracket { |
| 5446 | - wantedTok = fflib.FFTok_left_bracket |
| 5447 | - goto wrongtokenerror |
| 5448 | - } |
| 5449 | - state = fflib.FFParse_want_key |
| 5450 | - continue |
| 5451 | - |
| 5452 | - case fflib.FFParse_after_value: |
| 5453 | - if tok == fflib.FFTok_comma { |
| 5454 | - state = fflib.FFParse_want_key |
| 5455 | - } else if tok == fflib.FFTok_right_bracket { |
| 5456 | - goto done |
| 5457 | - } else { |
| 5458 | - wantedTok = fflib.FFTok_comma |
| 5459 | - goto wrongtokenerror |
| 5460 | - } |
| 5461 | - |
| 5462 | - case fflib.FFParse_want_key: |
| 5463 | - // json {} ended. goto exit. woo. |
| 5464 | - if tok == fflib.FFTok_right_bracket { |
| 5465 | - goto done |
| 5466 | - } |
| 5467 | - if tok != fflib.FFTok_string { |
| 5468 | - wantedTok = fflib.FFTok_string |
| 5469 | - goto wrongtokenerror |
| 5470 | - } |
| 5471 | - |
| 5472 | - kn := fs.Output.Bytes() |
| 5473 | - if len(kn) <= 0 { |
| 5474 | - // "" case. hrm. |
| 5475 | - currentKey = ffj_t_DSTopicsListno_such_key |
| 5476 | - state = fflib.FFParse_want_colon |
| 5477 | - goto mainparse |
| 5478 | - } else { |
| 5479 | - switch kn[0] { |
| 5480 | - |
| 5481 | - case 'M': |
| 5482 | - |
| 5483 | - if bytes.Equal(ffj_key_DSTopicsList_MoreTopicsUrl, kn) { |
| 5484 | - currentKey = ffj_t_DSTopicsList_MoreTopicsUrl |
| 5485 | - state = fflib.FFParse_want_colon |
| 5486 | - goto mainparse |
| 5487 | - } |
| 5488 | - |
| 5489 | - case 'T': |
| 5490 | - |
| 5491 | - if bytes.Equal(ffj_key_DSTopicsList_Topics, kn) { |
| 5492 | - currentKey = ffj_t_DSTopicsList_Topics |
| 5493 | - state = fflib.FFParse_want_colon |
| 5494 | - goto mainparse |
| 5495 | - } |
| 5496 | - |
| 5497 | - } |
| 5498 | - |
| 5499 | - if fflib.EqualFoldRight(ffj_key_DSTopicsList_MoreTopicsUrl, kn) { |
| 5500 | - currentKey = ffj_t_DSTopicsList_MoreTopicsUrl |
| 5501 | - state = fflib.FFParse_want_colon |
| 5502 | - goto mainparse |
| 5503 | - } |
| 5504 | - |
| 5505 | - if fflib.EqualFoldRight(ffj_key_DSTopicsList_Topics, kn) { |
| 5506 | - currentKey = ffj_t_DSTopicsList_Topics |
| 5507 | - state = fflib.FFParse_want_colon |
| 5508 | - goto mainparse |
| 5509 | - } |
| 5510 | - |
| 5511 | - currentKey = ffj_t_DSTopicsListno_such_key |
| 5512 | - state = fflib.FFParse_want_colon |
| 5513 | - goto mainparse |
| 5514 | - } |
| 5515 | - |
| 5516 | - case fflib.FFParse_want_colon: |
| 5517 | - if tok != fflib.FFTok_colon { |
| 5518 | - wantedTok = fflib.FFTok_colon |
| 5519 | - goto wrongtokenerror |
| 5520 | - } |
| 5521 | - state = fflib.FFParse_want_value |
| 5522 | - continue |
| 5523 | - case fflib.FFParse_want_value: |
| 5524 | - |
| 5525 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 5526 | - switch currentKey { |
| 5527 | - |
| 5528 | - case ffj_t_DSTopicsList_Topics: |
| 5529 | - goto handle_Topics |
| 5530 | - |
| 5531 | - case ffj_t_DSTopicsList_MoreTopicsUrl: |
| 5532 | - goto handle_MoreTopicsUrl |
| 5533 | - |
| 5534 | - case ffj_t_DSTopicsListno_such_key: |
| 5535 | - err = fs.SkipField(tok) |
| 5536 | - if err != nil { |
| 5537 | - return fs.WrapErr(err) |
| 5538 | - } |
| 5539 | - state = fflib.FFParse_after_value |
| 5540 | - goto mainparse |
| 5541 | - } |
| 5542 | - } else { |
| 5543 | - goto wantedvalue |
| 5544 | - } |
| 5545 | - } |
| 5546 | - } |
| 5547 | - |
| 5548 | -handle_Topics: |
| 5549 | - |
| 5550 | - /* handler: uj.Topics type=[]*benchmark.DSTopic kind=slice quoted=false*/ |
| 5551 | - |
| 5552 | - { |
| 5553 | - |
| 5554 | - { |
| 5555 | - if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null { |
| 5556 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok)) |
| 5557 | - } |
| 5558 | - } |
| 5559 | - |
| 5560 | - if tok == fflib.FFTok_null { |
| 5561 | - uj.Topics = nil |
| 5562 | - } else { |
| 5563 | - |
| 5564 | - uj.Topics = make([]*DSTopic, 0) |
| 5565 | - |
| 5566 | - wantVal := true |
| 5567 | - |
| 5568 | - for { |
| 5569 | - |
| 5570 | - var tmp_uj__Topics *DSTopic |
| 5571 | - |
| 5572 | - tok = fs.Scan() |
| 5573 | - if tok == fflib.FFTok_error { |
| 5574 | - goto tokerror |
| 5575 | - } |
| 5576 | - if tok == fflib.FFTok_right_brace { |
| 5577 | - break |
| 5578 | - } |
| 5579 | - |
| 5580 | - if tok == fflib.FFTok_comma { |
| 5581 | - if wantVal == true { |
| 5582 | - // TODO(pquerna): this isn't an ideal error message, this handles |
| 5583 | - // things like [,,,] as an array value. |
| 5584 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 5585 | - } |
| 5586 | - continue |
| 5587 | - } else { |
| 5588 | - wantVal = true |
| 5589 | - } |
| 5590 | - |
| 5591 | - /* handler: tmp_uj__Topics type=*benchmark.DSTopic kind=ptr quoted=false*/ |
| 5592 | - |
| 5593 | - { |
| 5594 | - if tok == fflib.FFTok_null { |
| 5595 | - |
| 5596 | - tmp_uj__Topics = nil |
| 5597 | - |
| 5598 | - state = fflib.FFParse_after_value |
| 5599 | - goto mainparse |
| 5600 | - } |
| 5601 | - |
| 5602 | - if tmp_uj__Topics == nil { |
| 5603 | - tmp_uj__Topics = new(DSTopic) |
| 5604 | - } |
| 5605 | - |
| 5606 | - err = tmp_uj__Topics.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 5607 | - if err != nil { |
| 5608 | - return err |
| 5609 | - } |
| 5610 | - state = fflib.FFParse_after_value |
| 5611 | - } |
| 5612 | - |
| 5613 | - uj.Topics = append(uj.Topics, tmp_uj__Topics) |
| 5614 | - wantVal = false |
| 5615 | - } |
| 5616 | - } |
| 5617 | - } |
| 5618 | - |
| 5619 | - state = fflib.FFParse_after_value |
| 5620 | - goto mainparse |
| 5621 | - |
| 5622 | -handle_MoreTopicsUrl: |
| 5623 | - |
| 5624 | - /* handler: uj.MoreTopicsUrl type=string kind=string quoted=false*/ |
| 5625 | - |
| 5626 | - { |
| 5627 | - |
| 5628 | - { |
| 5629 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 5630 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 5631 | - } |
| 5632 | - } |
| 5633 | - |
| 5634 | - if tok == fflib.FFTok_null { |
| 5635 | - |
| 5636 | - } else { |
| 5637 | - |
| 5638 | - outBuf := fs.Output.Bytes() |
| 5639 | - |
| 5640 | - uj.MoreTopicsUrl = string(string(outBuf)) |
| 5641 | - |
| 5642 | - } |
| 5643 | - } |
| 5644 | - |
| 5645 | - state = fflib.FFParse_after_value |
| 5646 | - goto mainparse |
| 5647 | - |
| 5648 | -wantedvalue: |
| 5649 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 5650 | -wrongtokenerror: |
| 5651 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 5652 | -tokerror: |
| 5653 | - if fs.BigError != nil { |
| 5654 | - return fs.WrapErr(fs.BigError) |
| 5655 | - } |
| 5656 | - err = fs.Error.ToError() |
| 5657 | - if err != nil { |
| 5658 | - return fs.WrapErr(err) |
| 5659 | - } |
| 5660 | - panic("ffjson-generated: unreachable, please report bug.") |
| 5661 | -done: |
| 5662 | - return nil |
| 5663 | -} |
| 5664 | - |
| 5665 | -// Benchmark harness support for STK-REQ-004. |
| 5666 | -func (mj *DSUser) MarshalJSON() ([]byte, error) { |
| 5667 | - var buf fflib.Buffer |
| 5668 | - if mj == nil { |
| 5669 | - buf.WriteString("null") |
| 5670 | - return buf.Bytes(), nil |
| 5671 | - } |
| 5672 | - err := mj.MarshalJSONBuf(&buf) |
| 5673 | - if err != nil { |
| 5674 | - return nil, err |
| 5675 | - } |
| 5676 | - return buf.Bytes(), nil |
| 5677 | -} |
| 5678 | - |
| 5679 | -// Benchmark harness support for STK-REQ-004. |
| 5680 | -func (mj *DSUser) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 5681 | - if mj == nil { |
| 5682 | - buf.WriteString("null") |
| 5683 | - return nil |
| 5684 | - } |
| 5685 | - var err error |
| 5686 | - var obj []byte |
| 5687 | - _ = obj |
| 5688 | - _ = err |
| 5689 | - buf.WriteString(`{"Username":`) |
| 5690 | - fflib.WriteJsonString(buf, string(mj.Username)) |
| 5691 | - buf.WriteByte('}') |
| 5692 | - return nil |
| 5693 | -} |
| 5694 | - |
| 5695 | -const ( |
| 5696 | - ffj_t_DSUserbase = iota |
| 5697 | - ffj_t_DSUserno_such_key |
| 5698 | - |
| 5699 | - ffj_t_DSUser_Username |
| 5700 | -) |
| 5701 | - |
| 5702 | -var ffj_key_DSUser_Username = []byte("Username") |
| 5703 | - |
| 5704 | -// Benchmark harness support for STK-REQ-004. |
| 5705 | -func (uj *DSUser) UnmarshalJSON(input []byte) error { |
| 5706 | - fs := fflib.NewFFLexer(input) |
| 5707 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 5708 | -} |
| 5709 | - |
| 5710 | -// Benchmark harness support for STK-REQ-004. |
| 5711 | -func (uj *DSUser) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 5712 | - var err error = nil |
| 5713 | - currentKey := ffj_t_DSUserbase |
| 5714 | - _ = currentKey |
| 5715 | - tok := fflib.FFTok_init |
| 5716 | - wantedTok := fflib.FFTok_init |
| 5717 | - |
| 5718 | -mainparse: |
| 5719 | - for { |
| 5720 | - tok = fs.Scan() |
| 5721 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 5722 | - if tok == fflib.FFTok_error { |
| 5723 | - goto tokerror |
| 5724 | - } |
| 5725 | - |
| 5726 | - switch state { |
| 5727 | - |
| 5728 | - case fflib.FFParse_map_start: |
| 5729 | - if tok != fflib.FFTok_left_bracket { |
| 5730 | - wantedTok = fflib.FFTok_left_bracket |
| 5731 | - goto wrongtokenerror |
| 5732 | - } |
| 5733 | - state = fflib.FFParse_want_key |
| 5734 | - continue |
| 5735 | - |
| 5736 | - case fflib.FFParse_after_value: |
| 5737 | - if tok == fflib.FFTok_comma { |
| 5738 | - state = fflib.FFParse_want_key |
| 5739 | - } else if tok == fflib.FFTok_right_bracket { |
| 5740 | - goto done |
| 5741 | - } else { |
| 5742 | - wantedTok = fflib.FFTok_comma |
| 5743 | - goto wrongtokenerror |
| 5744 | - } |
| 5745 | - |
| 5746 | - case fflib.FFParse_want_key: |
| 5747 | - // json {} ended. goto exit. woo. |
| 5748 | - if tok == fflib.FFTok_right_bracket { |
| 5749 | - goto done |
| 5750 | - } |
| 5751 | - if tok != fflib.FFTok_string { |
| 5752 | - wantedTok = fflib.FFTok_string |
| 5753 | - goto wrongtokenerror |
| 5754 | - } |
| 5755 | - |
| 5756 | - kn := fs.Output.Bytes() |
| 5757 | - if len(kn) <= 0 { |
| 5758 | - // "" case. hrm. |
| 5759 | - currentKey = ffj_t_DSUserno_such_key |
| 5760 | - state = fflib.FFParse_want_colon |
| 5761 | - goto mainparse |
| 5762 | - } else { |
| 5763 | - switch kn[0] { |
| 5764 | - |
| 5765 | - case 'U': |
| 5766 | - |
| 5767 | - if bytes.Equal(ffj_key_DSUser_Username, kn) { |
| 5768 | - currentKey = ffj_t_DSUser_Username |
| 5769 | - state = fflib.FFParse_want_colon |
| 5770 | - goto mainparse |
| 5771 | - } |
| 5772 | - |
| 5773 | - } |
| 5774 | - |
| 5775 | - if fflib.EqualFoldRight(ffj_key_DSUser_Username, kn) { |
| 5776 | - currentKey = ffj_t_DSUser_Username |
| 5777 | - state = fflib.FFParse_want_colon |
| 5778 | - goto mainparse |
| 5779 | - } |
| 5780 | - |
| 5781 | - currentKey = ffj_t_DSUserno_such_key |
| 5782 | - state = fflib.FFParse_want_colon |
| 5783 | - goto mainparse |
| 5784 | - } |
| 5785 | - |
| 5786 | - case fflib.FFParse_want_colon: |
| 5787 | - if tok != fflib.FFTok_colon { |
| 5788 | - wantedTok = fflib.FFTok_colon |
| 5789 | - goto wrongtokenerror |
| 5790 | - } |
| 5791 | - state = fflib.FFParse_want_value |
| 5792 | - continue |
| 5793 | - case fflib.FFParse_want_value: |
| 5794 | - |
| 5795 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 5796 | - switch currentKey { |
| 5797 | - |
| 5798 | - case ffj_t_DSUser_Username: |
| 5799 | - goto handle_Username |
| 5800 | - |
| 5801 | - case ffj_t_DSUserno_such_key: |
| 5802 | - err = fs.SkipField(tok) |
| 5803 | - if err != nil { |
| 5804 | - return fs.WrapErr(err) |
| 5805 | - } |
| 5806 | - state = fflib.FFParse_after_value |
| 5807 | - goto mainparse |
| 5808 | - } |
| 5809 | - } else { |
| 5810 | - goto wantedvalue |
| 5811 | - } |
| 5812 | - } |
| 5813 | - } |
| 5814 | - |
| 5815 | -handle_Username: |
| 5816 | - |
| 5817 | - /* handler: uj.Username type=string kind=string quoted=false*/ |
| 5818 | - |
| 5819 | - { |
| 5820 | - |
| 5821 | - { |
| 5822 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 5823 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 5824 | - } |
| 5825 | - } |
| 5826 | - |
| 5827 | - if tok == fflib.FFTok_null { |
| 5828 | - |
| 5829 | - } else { |
| 5830 | - |
| 5831 | - outBuf := fs.Output.Bytes() |
| 5832 | - |
| 5833 | - uj.Username = string(string(outBuf)) |
| 5834 | - |
| 5835 | - } |
| 5836 | - } |
| 5837 | - |
| 5838 | - state = fflib.FFParse_after_value |
| 5839 | - goto mainparse |
| 5840 | - |
| 5841 | -wantedvalue: |
| 5842 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 5843 | -wrongtokenerror: |
| 5844 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 5845 | -tokerror: |
| 5846 | - if fs.BigError != nil { |
| 5847 | - return fs.WrapErr(fs.BigError) |
| 5848 | - } |
| 5849 | - err = fs.Error.ToError() |
| 5850 | - if err != nil { |
| 5851 | - return fs.WrapErr(err) |
| 5852 | - } |
| 5853 | - panic("ffjson-generated: unreachable, please report bug.") |
| 5854 | -done: |
| 5855 | - return nil |
| 5856 | -} |
| 5857 | - |
| 5858 | -// Benchmark harness support for STK-REQ-004. |
| 5859 | -func (mj *LargePayload) MarshalJSON() ([]byte, error) { |
| 5860 | - var buf fflib.Buffer |
| 5861 | - if mj == nil { |
| 5862 | - buf.WriteString("null") |
| 5863 | - return buf.Bytes(), nil |
| 5864 | - } |
| 5865 | - err := mj.MarshalJSONBuf(&buf) |
| 5866 | - if err != nil { |
| 5867 | - return nil, err |
| 5868 | - } |
| 5869 | - return buf.Bytes(), nil |
| 5870 | -} |
| 5871 | - |
| 5872 | -// Benchmark harness support for STK-REQ-004. |
| 5873 | -func (mj *LargePayload) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 5874 | - if mj == nil { |
| 5875 | - buf.WriteString("null") |
| 5876 | - return nil |
| 5877 | - } |
| 5878 | - var err error |
| 5879 | - var obj []byte |
| 5880 | - _ = obj |
| 5881 | - _ = err |
| 5882 | - buf.WriteString(`{"Users":`) |
| 5883 | - if mj.Users != nil { |
| 5884 | - buf.WriteString(`[`) |
| 5885 | - for i, v := range mj.Users { |
| 5886 | - if i != 0 { |
| 5887 | - buf.WriteString(`,`) |
| 5888 | - } |
| 5889 | - |
| 5890 | - { |
| 5891 | - |
| 5892 | - if v == nil { |
| 5893 | - buf.WriteString("null") |
| 5894 | - return nil |
| 5895 | - } |
| 5896 | - |
| 5897 | - err = v.MarshalJSONBuf(buf) |
| 5898 | - if err != nil { |
| 5899 | - return err |
| 5900 | - } |
| 5901 | - |
| 5902 | - } |
| 5903 | - } |
| 5904 | - buf.WriteString(`]`) |
| 5905 | - } else { |
| 5906 | - buf.WriteString(`null`) |
| 5907 | - } |
| 5908 | - if mj.Topics != nil { |
| 5909 | - buf.WriteString(`,"Topics":`) |
| 5910 | - |
| 5911 | - { |
| 5912 | - |
| 5913 | - err = mj.Topics.MarshalJSONBuf(buf) |
| 5914 | - if err != nil { |
| 5915 | - return err |
| 5916 | - } |
| 5917 | - |
| 5918 | - } |
| 5919 | - } else { |
| 5920 | - buf.WriteString(`,"Topics":null`) |
| 5921 | - } |
| 5922 | - buf.WriteByte('}') |
| 5923 | - return nil |
| 5924 | -} |
| 5925 | - |
| 5926 | -const ( |
| 5927 | - ffj_t_LargePayloadbase = iota |
| 5928 | - ffj_t_LargePayloadno_such_key |
| 5929 | - |
| 5930 | - ffj_t_LargePayload_Users |
| 5931 | - |
| 5932 | - ffj_t_LargePayload_Topics |
| 5933 | -) |
| 5934 | - |
| 5935 | -var ffj_key_LargePayload_Users = []byte("Users") |
| 5936 | - |
| 5937 | -var ffj_key_LargePayload_Topics = []byte("Topics") |
| 5938 | - |
| 5939 | -// Benchmark harness support for STK-REQ-004. |
| 5940 | -func (uj *LargePayload) UnmarshalJSON(input []byte) error { |
| 5941 | - fs := fflib.NewFFLexer(input) |
| 5942 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 5943 | -} |
| 5944 | - |
| 5945 | -// Benchmark harness support for STK-REQ-004. |
| 5946 | -func (uj *LargePayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 5947 | - var err error = nil |
| 5948 | - currentKey := ffj_t_LargePayloadbase |
| 5949 | - _ = currentKey |
| 5950 | - tok := fflib.FFTok_init |
| 5951 | - wantedTok := fflib.FFTok_init |
| 5952 | - |
| 5953 | -mainparse: |
| 5954 | - for { |
| 5955 | - tok = fs.Scan() |
| 5956 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 5957 | - if tok == fflib.FFTok_error { |
| 5958 | - goto tokerror |
| 5959 | - } |
| 5960 | - |
| 5961 | - switch state { |
| 5962 | - |
| 5963 | - case fflib.FFParse_map_start: |
| 5964 | - if tok != fflib.FFTok_left_bracket { |
| 5965 | - wantedTok = fflib.FFTok_left_bracket |
| 5966 | - goto wrongtokenerror |
| 5967 | - } |
| 5968 | - state = fflib.FFParse_want_key |
| 5969 | - continue |
| 5970 | - |
| 5971 | - case fflib.FFParse_after_value: |
| 5972 | - if tok == fflib.FFTok_comma { |
| 5973 | - state = fflib.FFParse_want_key |
| 5974 | - } else if tok == fflib.FFTok_right_bracket { |
| 5975 | - goto done |
| 5976 | - } else { |
| 5977 | - wantedTok = fflib.FFTok_comma |
| 5978 | - goto wrongtokenerror |
| 5979 | - } |
| 5980 | - |
| 5981 | - case fflib.FFParse_want_key: |
| 5982 | - // json {} ended. goto exit. woo. |
| 5983 | - if tok == fflib.FFTok_right_bracket { |
| 5984 | - goto done |
| 5985 | - } |
| 5986 | - if tok != fflib.FFTok_string { |
| 5987 | - wantedTok = fflib.FFTok_string |
| 5988 | - goto wrongtokenerror |
| 5989 | - } |
| 5990 | - |
| 5991 | - kn := fs.Output.Bytes() |
| 5992 | - if len(kn) <= 0 { |
| 5993 | - // "" case. hrm. |
| 5994 | - currentKey = ffj_t_LargePayloadno_such_key |
| 5995 | - state = fflib.FFParse_want_colon |
| 5996 | - goto mainparse |
| 5997 | - } else { |
| 5998 | - switch kn[0] { |
| 5999 | - |
| 6000 | - case 'T': |
| 6001 | - |
| 6002 | - if bytes.Equal(ffj_key_LargePayload_Topics, kn) { |
| 6003 | - currentKey = ffj_t_LargePayload_Topics |
| 6004 | - state = fflib.FFParse_want_colon |
| 6005 | - goto mainparse |
| 6006 | - } |
| 6007 | - |
| 6008 | - case 'U': |
| 6009 | - |
| 6010 | - if bytes.Equal(ffj_key_LargePayload_Users, kn) { |
| 6011 | - currentKey = ffj_t_LargePayload_Users |
| 6012 | - state = fflib.FFParse_want_colon |
| 6013 | - goto mainparse |
| 6014 | - } |
| 6015 | - |
| 6016 | - } |
| 6017 | - |
| 6018 | - if fflib.EqualFoldRight(ffj_key_LargePayload_Topics, kn) { |
| 6019 | - currentKey = ffj_t_LargePayload_Topics |
| 6020 | - state = fflib.FFParse_want_colon |
| 6021 | - goto mainparse |
| 6022 | - } |
| 6023 | - |
| 6024 | - if fflib.EqualFoldRight(ffj_key_LargePayload_Users, kn) { |
| 6025 | - currentKey = ffj_t_LargePayload_Users |
| 6026 | - state = fflib.FFParse_want_colon |
| 6027 | - goto mainparse |
| 6028 | - } |
| 6029 | - |
| 6030 | - currentKey = ffj_t_LargePayloadno_such_key |
| 6031 | - state = fflib.FFParse_want_colon |
| 6032 | - goto mainparse |
| 6033 | - } |
| 6034 | - |
| 6035 | - case fflib.FFParse_want_colon: |
| 6036 | - if tok != fflib.FFTok_colon { |
| 6037 | - wantedTok = fflib.FFTok_colon |
| 6038 | - goto wrongtokenerror |
| 6039 | - } |
| 6040 | - state = fflib.FFParse_want_value |
| 6041 | - continue |
| 6042 | - case fflib.FFParse_want_value: |
| 6043 | - |
| 6044 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 6045 | - switch currentKey { |
| 6046 | - |
| 6047 | - case ffj_t_LargePayload_Users: |
| 6048 | - goto handle_Users |
| 6049 | - |
| 6050 | - case ffj_t_LargePayload_Topics: |
| 6051 | - goto handle_Topics |
| 6052 | - |
| 6053 | - case ffj_t_LargePayloadno_such_key: |
| 6054 | - err = fs.SkipField(tok) |
| 6055 | - if err != nil { |
| 6056 | - return fs.WrapErr(err) |
| 6057 | - } |
| 6058 | - state = fflib.FFParse_after_value |
| 6059 | - goto mainparse |
| 6060 | - } |
| 6061 | - } else { |
| 6062 | - goto wantedvalue |
| 6063 | - } |
| 6064 | - } |
| 6065 | - } |
| 6066 | - |
| 6067 | -handle_Users: |
| 6068 | - |
| 6069 | - /* handler: uj.Users type=[]*benchmark.DSUser kind=slice quoted=false*/ |
| 6070 | - |
| 6071 | - { |
| 6072 | - |
| 6073 | - { |
| 6074 | - if tok != fflib.FFTok_left_brace && tok != fflib.FFTok_null { |
| 6075 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok)) |
| 6076 | - } |
| 6077 | - } |
| 6078 | - |
| 6079 | - if tok == fflib.FFTok_null { |
| 6080 | - uj.Users = nil |
| 6081 | - } else { |
| 6082 | - |
| 6083 | - uj.Users = make([]*DSUser, 0) |
| 6084 | - |
| 6085 | - wantVal := true |
| 6086 | - |
| 6087 | - for { |
| 6088 | - |
| 6089 | - var tmp_uj__Users *DSUser |
| 6090 | - |
| 6091 | - tok = fs.Scan() |
| 6092 | - if tok == fflib.FFTok_error { |
| 6093 | - goto tokerror |
| 6094 | - } |
| 6095 | - if tok == fflib.FFTok_right_brace { |
| 6096 | - break |
| 6097 | - } |
| 6098 | - |
| 6099 | - if tok == fflib.FFTok_comma { |
| 6100 | - if wantVal == true { |
| 6101 | - // TODO(pquerna): this isn't an ideal error message, this handles |
| 6102 | - // things like [,,,] as an array value. |
| 6103 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 6104 | - } |
| 6105 | - continue |
| 6106 | - } else { |
| 6107 | - wantVal = true |
| 6108 | - } |
| 6109 | - |
| 6110 | - /* handler: tmp_uj__Users type=*benchmark.DSUser kind=ptr quoted=false*/ |
| 6111 | - |
| 6112 | - { |
| 6113 | - if tok == fflib.FFTok_null { |
| 6114 | - |
| 6115 | - tmp_uj__Users = nil |
| 6116 | - |
| 6117 | - state = fflib.FFParse_after_value |
| 6118 | - goto mainparse |
| 6119 | - } |
| 6120 | - |
| 6121 | - if tmp_uj__Users == nil { |
| 6122 | - tmp_uj__Users = new(DSUser) |
| 6123 | - } |
| 6124 | - |
| 6125 | - err = tmp_uj__Users.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 6126 | - if err != nil { |
| 6127 | - return err |
| 6128 | - } |
| 6129 | - state = fflib.FFParse_after_value |
| 6130 | - } |
| 6131 | - |
| 6132 | - uj.Users = append(uj.Users, tmp_uj__Users) |
| 6133 | - wantVal = false |
| 6134 | - } |
| 6135 | - } |
| 6136 | - } |
| 6137 | - |
| 6138 | - state = fflib.FFParse_after_value |
| 6139 | - goto mainparse |
| 6140 | - |
| 6141 | -handle_Topics: |
| 6142 | - |
| 6143 | - /* handler: uj.Topics type=benchmark.DSTopicsList kind=struct quoted=false*/ |
| 6144 | - |
| 6145 | - { |
| 6146 | - if tok == fflib.FFTok_null { |
| 6147 | - |
| 6148 | - uj.Topics = nil |
| 6149 | - |
| 6150 | - state = fflib.FFParse_after_value |
| 6151 | - goto mainparse |
| 6152 | - } |
| 6153 | - |
| 6154 | - if uj.Topics == nil { |
| 6155 | - uj.Topics = new(DSTopicsList) |
| 6156 | - } |
| 6157 | - |
| 6158 | - err = uj.Topics.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 6159 | - if err != nil { |
| 6160 | - return err |
| 6161 | - } |
| 6162 | - state = fflib.FFParse_after_value |
| 6163 | - } |
| 6164 | - |
| 6165 | - state = fflib.FFParse_after_value |
| 6166 | - goto mainparse |
| 6167 | - |
| 6168 | -wantedvalue: |
| 6169 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 6170 | -wrongtokenerror: |
| 6171 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 6172 | -tokerror: |
| 6173 | - if fs.BigError != nil { |
| 6174 | - return fs.WrapErr(fs.BigError) |
| 6175 | - } |
| 6176 | - err = fs.Error.ToError() |
| 6177 | - if err != nil { |
| 6178 | - return fs.WrapErr(err) |
| 6179 | - } |
| 6180 | - panic("ffjson-generated: unreachable, please report bug.") |
| 6181 | -done: |
| 6182 | - return nil |
| 6183 | -} |
| 6184 | - |
| 6185 | -// Benchmark harness support for STK-REQ-004. |
| 6186 | -func (mj *MediumPayload) MarshalJSON() ([]byte, error) { |
| 6187 | - var buf fflib.Buffer |
| 6188 | - if mj == nil { |
| 6189 | - buf.WriteString("null") |
| 6190 | - return buf.Bytes(), nil |
| 6191 | - } |
| 6192 | - err := mj.MarshalJSONBuf(&buf) |
| 6193 | - if err != nil { |
| 6194 | - return nil, err |
| 6195 | - } |
| 6196 | - return buf.Bytes(), nil |
| 6197 | -} |
| 6198 | - |
| 6199 | -// Benchmark harness support for STK-REQ-004. |
| 6200 | -func (mj *MediumPayload) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 6201 | - if mj == nil { |
| 6202 | - buf.WriteString("null") |
| 6203 | - return nil |
| 6204 | - } |
| 6205 | - var err error |
| 6206 | - var obj []byte |
| 6207 | - _ = obj |
| 6208 | - _ = err |
| 6209 | - if mj.Person != nil { |
| 6210 | - buf.WriteString(`{"Person":`) |
| 6211 | - |
| 6212 | - { |
| 6213 | - |
| 6214 | - err = mj.Person.MarshalJSONBuf(buf) |
| 6215 | - if err != nil { |
| 6216 | - return err |
| 6217 | - } |
| 6218 | - |
| 6219 | - } |
| 6220 | - } else { |
| 6221 | - buf.WriteString(`{"Person":null`) |
| 6222 | - } |
| 6223 | - buf.WriteString(`,"Company":`) |
| 6224 | - /* Falling back. type=map[string]interface {} kind=map */ |
| 6225 | - err = buf.Encode(mj.Company) |
| 6226 | - if err != nil { |
| 6227 | - return err |
| 6228 | - } |
| 6229 | - buf.WriteByte('}') |
| 6230 | - return nil |
| 6231 | -} |
| 6232 | - |
| 6233 | -const ( |
| 6234 | - ffj_t_MediumPayloadbase = iota |
| 6235 | - ffj_t_MediumPayloadno_such_key |
| 6236 | - |
| 6237 | - ffj_t_MediumPayload_Person |
| 6238 | - |
| 6239 | - ffj_t_MediumPayload_Company |
| 6240 | -) |
| 6241 | - |
| 6242 | -var ffj_key_MediumPayload_Person = []byte("Person") |
| 6243 | - |
| 6244 | -var ffj_key_MediumPayload_Company = []byte("Company") |
| 6245 | - |
| 6246 | -// Benchmark harness support for STK-REQ-004. |
| 6247 | -func (uj *MediumPayload) UnmarshalJSON(input []byte) error { |
| 6248 | - fs := fflib.NewFFLexer(input) |
| 6249 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 6250 | -} |
| 6251 | - |
| 6252 | -// Benchmark harness support for STK-REQ-004. |
| 6253 | -func (uj *MediumPayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 6254 | - var err error = nil |
| 6255 | - currentKey := ffj_t_MediumPayloadbase |
| 6256 | - _ = currentKey |
| 6257 | - tok := fflib.FFTok_init |
| 6258 | - wantedTok := fflib.FFTok_init |
| 6259 | - |
| 6260 | -mainparse: |
| 6261 | - for { |
| 6262 | - tok = fs.Scan() |
| 6263 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 6264 | - if tok == fflib.FFTok_error { |
| 6265 | - goto tokerror |
| 6266 | - } |
| 6267 | - |
| 6268 | - switch state { |
| 6269 | - |
| 6270 | - case fflib.FFParse_map_start: |
| 6271 | - if tok != fflib.FFTok_left_bracket { |
| 6272 | - wantedTok = fflib.FFTok_left_bracket |
| 6273 | - goto wrongtokenerror |
| 6274 | - } |
| 6275 | - state = fflib.FFParse_want_key |
| 6276 | - continue |
| 6277 | - |
| 6278 | - case fflib.FFParse_after_value: |
| 6279 | - if tok == fflib.FFTok_comma { |
| 6280 | - state = fflib.FFParse_want_key |
| 6281 | - } else if tok == fflib.FFTok_right_bracket { |
| 6282 | - goto done |
| 6283 | - } else { |
| 6284 | - wantedTok = fflib.FFTok_comma |
| 6285 | - goto wrongtokenerror |
| 6286 | - } |
| 6287 | - |
| 6288 | - case fflib.FFParse_want_key: |
| 6289 | - // json {} ended. goto exit. woo. |
| 6290 | - if tok == fflib.FFTok_right_bracket { |
| 6291 | - goto done |
| 6292 | - } |
| 6293 | - if tok != fflib.FFTok_string { |
| 6294 | - wantedTok = fflib.FFTok_string |
| 6295 | - goto wrongtokenerror |
| 6296 | - } |
| 6297 | - |
| 6298 | - kn := fs.Output.Bytes() |
| 6299 | - if len(kn) <= 0 { |
| 6300 | - // "" case. hrm. |
| 6301 | - currentKey = ffj_t_MediumPayloadno_such_key |
| 6302 | - state = fflib.FFParse_want_colon |
| 6303 | - goto mainparse |
| 6304 | - } else { |
| 6305 | - switch kn[0] { |
| 6306 | - |
| 6307 | - case 'C': |
| 6308 | - |
| 6309 | - if bytes.Equal(ffj_key_MediumPayload_Company, kn) { |
| 6310 | - currentKey = ffj_t_MediumPayload_Company |
| 6311 | - state = fflib.FFParse_want_colon |
| 6312 | - goto mainparse |
| 6313 | - } |
| 6314 | - |
| 6315 | - case 'P': |
| 6316 | - |
| 6317 | - if bytes.Equal(ffj_key_MediumPayload_Person, kn) { |
| 6318 | - currentKey = ffj_t_MediumPayload_Person |
| 6319 | - state = fflib.FFParse_want_colon |
| 6320 | - goto mainparse |
| 6321 | - } |
| 6322 | - |
| 6323 | - } |
| 6324 | - |
| 6325 | - if fflib.SimpleLetterEqualFold(ffj_key_MediumPayload_Company, kn) { |
| 6326 | - currentKey = ffj_t_MediumPayload_Company |
| 6327 | - state = fflib.FFParse_want_colon |
| 6328 | - goto mainparse |
| 6329 | - } |
| 6330 | - |
| 6331 | - if fflib.EqualFoldRight(ffj_key_MediumPayload_Person, kn) { |
| 6332 | - currentKey = ffj_t_MediumPayload_Person |
| 6333 | - state = fflib.FFParse_want_colon |
| 6334 | - goto mainparse |
| 6335 | - } |
| 6336 | - |
| 6337 | - currentKey = ffj_t_MediumPayloadno_such_key |
| 6338 | - state = fflib.FFParse_want_colon |
| 6339 | - goto mainparse |
| 6340 | - } |
| 6341 | - |
| 6342 | - case fflib.FFParse_want_colon: |
| 6343 | - if tok != fflib.FFTok_colon { |
| 6344 | - wantedTok = fflib.FFTok_colon |
| 6345 | - goto wrongtokenerror |
| 6346 | - } |
| 6347 | - state = fflib.FFParse_want_value |
| 6348 | - continue |
| 6349 | - case fflib.FFParse_want_value: |
| 6350 | - |
| 6351 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 6352 | - switch currentKey { |
| 6353 | - |
| 6354 | - case ffj_t_MediumPayload_Person: |
| 6355 | - goto handle_Person |
| 6356 | - |
| 6357 | - case ffj_t_MediumPayload_Company: |
| 6358 | - goto handle_Company |
| 6359 | - |
| 6360 | - case ffj_t_MediumPayloadno_such_key: |
| 6361 | - err = fs.SkipField(tok) |
| 6362 | - if err != nil { |
| 6363 | - return fs.WrapErr(err) |
| 6364 | - } |
| 6365 | - state = fflib.FFParse_after_value |
| 6366 | - goto mainparse |
| 6367 | - } |
| 6368 | - } else { |
| 6369 | - goto wantedvalue |
| 6370 | - } |
| 6371 | - } |
| 6372 | - } |
| 6373 | - |
| 6374 | -handle_Person: |
| 6375 | - |
| 6376 | - /* handler: uj.Person type=benchmark.CBPerson kind=struct quoted=false*/ |
| 6377 | - |
| 6378 | - { |
| 6379 | - if tok == fflib.FFTok_null { |
| 6380 | - |
| 6381 | - uj.Person = nil |
| 6382 | - |
| 6383 | - state = fflib.FFParse_after_value |
| 6384 | - goto mainparse |
| 6385 | - } |
| 6386 | - |
| 6387 | - if uj.Person == nil { |
| 6388 | - uj.Person = new(CBPerson) |
| 6389 | - } |
| 6390 | - |
| 6391 | - err = uj.Person.UnmarshalJSONFFLexer(fs, fflib.FFParse_want_key) |
| 6392 | - if err != nil { |
| 6393 | - return err |
| 6394 | - } |
| 6395 | - state = fflib.FFParse_after_value |
| 6396 | - } |
| 6397 | - |
| 6398 | - state = fflib.FFParse_after_value |
| 6399 | - goto mainparse |
| 6400 | - |
| 6401 | -handle_Company: |
| 6402 | - |
| 6403 | - /* handler: uj.Company type=map[string]interface {} kind=map quoted=false*/ |
| 6404 | - |
| 6405 | - { |
| 6406 | - |
| 6407 | - { |
| 6408 | - if tok != fflib.FFTok_left_bracket && tok != fflib.FFTok_null { |
| 6409 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for ", tok)) |
| 6410 | - } |
| 6411 | - } |
| 6412 | - |
| 6413 | - if tok == fflib.FFTok_null { |
| 6414 | - uj.Company = nil |
| 6415 | - } else { |
| 6416 | - |
| 6417 | - uj.Company = make(map[string]interface{}, 0) |
| 6418 | - |
| 6419 | - wantVal := true |
| 6420 | - |
| 6421 | - for { |
| 6422 | - |
| 6423 | - var k string |
| 6424 | - |
| 6425 | - var tmp_uj__Company interface{} |
| 6426 | - |
| 6427 | - tok = fs.Scan() |
| 6428 | - if tok == fflib.FFTok_error { |
| 6429 | - goto tokerror |
| 6430 | - } |
| 6431 | - if tok == fflib.FFTok_right_bracket { |
| 6432 | - break |
| 6433 | - } |
| 6434 | - |
| 6435 | - if tok == fflib.FFTok_comma { |
| 6436 | - if wantVal == true { |
| 6437 | - // TODO(pquerna): this isn't an ideal error message, this handles |
| 6438 | - // things like [,,,] as an array value. |
| 6439 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 6440 | - } |
| 6441 | - continue |
| 6442 | - } else { |
| 6443 | - wantVal = true |
| 6444 | - } |
| 6445 | - |
| 6446 | - /* handler: k type=string kind=string quoted=false*/ |
| 6447 | - |
| 6448 | - { |
| 6449 | - |
| 6450 | - { |
| 6451 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 6452 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 6453 | - } |
| 6454 | - } |
| 6455 | - |
| 6456 | - if tok == fflib.FFTok_null { |
| 6457 | - |
| 6458 | - } else { |
| 6459 | - |
| 6460 | - outBuf := fs.Output.Bytes() |
| 6461 | - |
| 6462 | - k = string(string(outBuf)) |
| 6463 | - |
| 6464 | - } |
| 6465 | - } |
| 6466 | - |
| 6467 | - // Expect ':' after key |
| 6468 | - tok = fs.Scan() |
| 6469 | - if tok != fflib.FFTok_colon { |
| 6470 | - return fs.WrapErr(fmt.Errorf("wanted colon token, but got token: %v", tok)) |
| 6471 | - } |
| 6472 | - |
| 6473 | - tok = fs.Scan() |
| 6474 | - /* handler: tmp_uj__Company type=interface {} kind=interface quoted=false*/ |
| 6475 | - |
| 6476 | - { |
| 6477 | - /* Falling back. type=interface {} kind=interface */ |
| 6478 | - tbuf, err := fs.CaptureField(tok) |
| 6479 | - if err != nil { |
| 6480 | - return fs.WrapErr(err) |
| 6481 | - } |
| 6482 | - |
| 6483 | - err = json.Unmarshal(tbuf, &tmp_uj__Company) |
| 6484 | - if err != nil { |
| 6485 | - return fs.WrapErr(err) |
| 6486 | - } |
| 6487 | - } |
| 6488 | - |
| 6489 | - uj.Company[k] = tmp_uj__Company |
| 6490 | - |
| 6491 | - wantVal = false |
| 6492 | - } |
| 6493 | - |
| 6494 | - } |
| 6495 | - } |
| 6496 | - |
| 6497 | - state = fflib.FFParse_after_value |
| 6498 | - goto mainparse |
| 6499 | - |
| 6500 | -wantedvalue: |
| 6501 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 6502 | -wrongtokenerror: |
| 6503 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 6504 | -tokerror: |
| 6505 | - if fs.BigError != nil { |
| 6506 | - return fs.WrapErr(fs.BigError) |
| 6507 | - } |
| 6508 | - err = fs.Error.ToError() |
| 6509 | - if err != nil { |
| 6510 | - return fs.WrapErr(err) |
| 6511 | - } |
| 6512 | - panic("ffjson-generated: unreachable, please report bug.") |
| 6513 | -done: |
| 6514 | - return nil |
| 6515 | -} |
| 6516 | - |
| 6517 | -// Benchmark harness support for STK-REQ-004. |
| 6518 | -func (mj *SmallPayload) MarshalJSON() ([]byte, error) { |
| 6519 | - var buf fflib.Buffer |
| 6520 | - if mj == nil { |
| 6521 | - buf.WriteString("null") |
| 6522 | - return buf.Bytes(), nil |
| 6523 | - } |
| 6524 | - err := mj.MarshalJSONBuf(&buf) |
| 6525 | - if err != nil { |
| 6526 | - return nil, err |
| 6527 | - } |
| 6528 | - return buf.Bytes(), nil |
| 6529 | -} |
| 6530 | - |
| 6531 | -// Benchmark harness support for STK-REQ-004. |
| 6532 | -func (mj *SmallPayload) MarshalJSONBuf(buf fflib.EncodingBuffer) error { |
| 6533 | - if mj == nil { |
| 6534 | - buf.WriteString("null") |
| 6535 | - return nil |
| 6536 | - } |
| 6537 | - var err error |
| 6538 | - var obj []byte |
| 6539 | - _ = obj |
| 6540 | - _ = err |
| 6541 | - buf.WriteString(`{"St":`) |
| 6542 | - fflib.FormatBits2(buf, uint64(mj.St), 10, mj.St < 0) |
| 6543 | - buf.WriteString(`,"Sid":`) |
| 6544 | - fflib.FormatBits2(buf, uint64(mj.Sid), 10, mj.Sid < 0) |
| 6545 | - buf.WriteString(`,"Tt":`) |
| 6546 | - fflib.WriteJsonString(buf, string(mj.Tt)) |
| 6547 | - buf.WriteString(`,"Gr":`) |
| 6548 | - fflib.FormatBits2(buf, uint64(mj.Gr), 10, mj.Gr < 0) |
| 6549 | - buf.WriteString(`,"Uuid":`) |
| 6550 | - fflib.WriteJsonString(buf, string(mj.Uuid)) |
| 6551 | - buf.WriteString(`,"Ip":`) |
| 6552 | - fflib.WriteJsonString(buf, string(mj.Ip)) |
| 6553 | - buf.WriteString(`,"Ua":`) |
| 6554 | - fflib.WriteJsonString(buf, string(mj.Ua)) |
| 6555 | - buf.WriteString(`,"Tz":`) |
| 6556 | - fflib.FormatBits2(buf, uint64(mj.Tz), 10, mj.Tz < 0) |
| 6557 | - buf.WriteString(`,"V":`) |
| 6558 | - fflib.FormatBits2(buf, uint64(mj.V), 10, mj.V < 0) |
| 6559 | - buf.WriteByte('}') |
| 6560 | - return nil |
| 6561 | -} |
| 6562 | - |
| 6563 | -const ( |
| 6564 | - ffj_t_SmallPayloadbase = iota |
| 6565 | - ffj_t_SmallPayloadno_such_key |
| 6566 | - |
| 6567 | - ffj_t_SmallPayload_St |
| 6568 | - |
| 6569 | - ffj_t_SmallPayload_Sid |
| 6570 | - |
| 6571 | - ffj_t_SmallPayload_Tt |
| 6572 | - |
| 6573 | - ffj_t_SmallPayload_Gr |
| 6574 | - |
| 6575 | - ffj_t_SmallPayload_Uuid |
| 6576 | - |
| 6577 | - ffj_t_SmallPayload_Ip |
| 6578 | - |
| 6579 | - ffj_t_SmallPayload_Ua |
| 6580 | - |
| 6581 | - ffj_t_SmallPayload_Tz |
| 6582 | - |
| 6583 | - ffj_t_SmallPayload_V |
| 6584 | -) |
| 6585 | - |
| 6586 | -var ffj_key_SmallPayload_St = []byte("St") |
| 6587 | - |
| 6588 | -var ffj_key_SmallPayload_Sid = []byte("Sid") |
| 6589 | - |
| 6590 | -var ffj_key_SmallPayload_Tt = []byte("Tt") |
| 6591 | - |
| 6592 | -var ffj_key_SmallPayload_Gr = []byte("Gr") |
| 6593 | - |
| 6594 | -var ffj_key_SmallPayload_Uuid = []byte("Uuid") |
| 6595 | - |
| 6596 | -var ffj_key_SmallPayload_Ip = []byte("Ip") |
| 6597 | - |
| 6598 | -var ffj_key_SmallPayload_Ua = []byte("Ua") |
| 6599 | - |
| 6600 | -var ffj_key_SmallPayload_Tz = []byte("Tz") |
| 6601 | - |
| 6602 | -var ffj_key_SmallPayload_V = []byte("V") |
| 6603 | - |
| 6604 | -// Benchmark harness support for STK-REQ-004. |
| 6605 | -func (uj *SmallPayload) UnmarshalJSON(input []byte) error { |
| 6606 | - fs := fflib.NewFFLexer(input) |
| 6607 | - return uj.UnmarshalJSONFFLexer(fs, fflib.FFParse_map_start) |
| 6608 | -} |
| 6609 | - |
| 6610 | -// Benchmark harness support for STK-REQ-004. |
| 6611 | -func (uj *SmallPayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error { |
| 6612 | - var err error = nil |
| 6613 | - currentKey := ffj_t_SmallPayloadbase |
| 6614 | - _ = currentKey |
| 6615 | - tok := fflib.FFTok_init |
| 6616 | - wantedTok := fflib.FFTok_init |
| 6617 | - |
| 6618 | -mainparse: |
| 6619 | - for { |
| 6620 | - tok = fs.Scan() |
| 6621 | - // println(fmt.Sprintf("debug: tok: %v state: %v", tok, state)) |
| 6622 | - if tok == fflib.FFTok_error { |
| 6623 | - goto tokerror |
| 6624 | - } |
| 6625 | - |
| 6626 | - switch state { |
| 6627 | - |
| 6628 | - case fflib.FFParse_map_start: |
| 6629 | - if tok != fflib.FFTok_left_bracket { |
| 6630 | - wantedTok = fflib.FFTok_left_bracket |
| 6631 | - goto wrongtokenerror |
| 6632 | - } |
| 6633 | - state = fflib.FFParse_want_key |
| 6634 | - continue |
| 6635 | - |
| 6636 | - case fflib.FFParse_after_value: |
| 6637 | - if tok == fflib.FFTok_comma { |
| 6638 | - state = fflib.FFParse_want_key |
| 6639 | - } else if tok == fflib.FFTok_right_bracket { |
| 6640 | - goto done |
| 6641 | - } else { |
| 6642 | - wantedTok = fflib.FFTok_comma |
| 6643 | - goto wrongtokenerror |
| 6644 | - } |
| 6645 | - |
| 6646 | - case fflib.FFParse_want_key: |
| 6647 | - // json {} ended. goto exit. woo. |
| 6648 | - if tok == fflib.FFTok_right_bracket { |
| 6649 | - goto done |
| 6650 | - } |
| 6651 | - if tok != fflib.FFTok_string { |
| 6652 | - wantedTok = fflib.FFTok_string |
| 6653 | - goto wrongtokenerror |
| 6654 | - } |
| 6655 | - |
| 6656 | - kn := fs.Output.Bytes() |
| 6657 | - if len(kn) <= 0 { |
| 6658 | - // "" case. hrm. |
| 6659 | - currentKey = ffj_t_SmallPayloadno_such_key |
| 6660 | - state = fflib.FFParse_want_colon |
| 6661 | - goto mainparse |
| 6662 | - } else { |
| 6663 | - switch kn[0] { |
| 6664 | - |
| 6665 | - case 'G': |
| 6666 | - |
| 6667 | - if bytes.Equal(ffj_key_SmallPayload_Gr, kn) { |
| 6668 | - currentKey = ffj_t_SmallPayload_Gr |
| 6669 | - state = fflib.FFParse_want_colon |
| 6670 | - goto mainparse |
| 6671 | - } |
| 6672 | - |
| 6673 | - case 'I': |
| 6674 | - |
| 6675 | - if bytes.Equal(ffj_key_SmallPayload_Ip, kn) { |
| 6676 | - currentKey = ffj_t_SmallPayload_Ip |
| 6677 | - state = fflib.FFParse_want_colon |
| 6678 | - goto mainparse |
| 6679 | - } |
| 6680 | - |
| 6681 | - case 'S': |
| 6682 | - |
| 6683 | - if bytes.Equal(ffj_key_SmallPayload_St, kn) { |
| 6684 | - currentKey = ffj_t_SmallPayload_St |
| 6685 | - state = fflib.FFParse_want_colon |
| 6686 | - goto mainparse |
| 6687 | - |
| 6688 | - } else if bytes.Equal(ffj_key_SmallPayload_Sid, kn) { |
| 6689 | - currentKey = ffj_t_SmallPayload_Sid |
| 6690 | - state = fflib.FFParse_want_colon |
| 6691 | - goto mainparse |
| 6692 | - } |
| 6693 | - |
| 6694 | - case 'T': |
| 6695 | - |
| 6696 | - if bytes.Equal(ffj_key_SmallPayload_Tt, kn) { |
| 6697 | - currentKey = ffj_t_SmallPayload_Tt |
| 6698 | - state = fflib.FFParse_want_colon |
| 6699 | - goto mainparse |
| 6700 | - |
| 6701 | - } else if bytes.Equal(ffj_key_SmallPayload_Tz, kn) { |
| 6702 | - currentKey = ffj_t_SmallPayload_Tz |
| 6703 | - state = fflib.FFParse_want_colon |
| 6704 | - goto mainparse |
| 6705 | - } |
| 6706 | - |
| 6707 | - case 'U': |
| 6708 | - |
| 6709 | - if bytes.Equal(ffj_key_SmallPayload_Uuid, kn) { |
| 6710 | - currentKey = ffj_t_SmallPayload_Uuid |
| 6711 | - state = fflib.FFParse_want_colon |
| 6712 | - goto mainparse |
| 6713 | - |
| 6714 | - } else if bytes.Equal(ffj_key_SmallPayload_Ua, kn) { |
| 6715 | - currentKey = ffj_t_SmallPayload_Ua |
| 6716 | - state = fflib.FFParse_want_colon |
| 6717 | - goto mainparse |
| 6718 | - } |
| 6719 | - |
| 6720 | - case 'V': |
| 6721 | - |
| 6722 | - if bytes.Equal(ffj_key_SmallPayload_V, kn) { |
| 6723 | - currentKey = ffj_t_SmallPayload_V |
| 6724 | - state = fflib.FFParse_want_colon |
| 6725 | - goto mainparse |
| 6726 | - } |
| 6727 | - |
| 6728 | - } |
| 6729 | - |
| 6730 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_V, kn) { |
| 6731 | - currentKey = ffj_t_SmallPayload_V |
| 6732 | - state = fflib.FFParse_want_colon |
| 6733 | - goto mainparse |
| 6734 | - } |
| 6735 | - |
| 6736 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_Tz, kn) { |
| 6737 | - currentKey = ffj_t_SmallPayload_Tz |
| 6738 | - state = fflib.FFParse_want_colon |
| 6739 | - goto mainparse |
| 6740 | - } |
| 6741 | - |
| 6742 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_Ua, kn) { |
| 6743 | - currentKey = ffj_t_SmallPayload_Ua |
| 6744 | - state = fflib.FFParse_want_colon |
| 6745 | - goto mainparse |
| 6746 | - } |
| 6747 | - |
| 6748 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_Ip, kn) { |
| 6749 | - currentKey = ffj_t_SmallPayload_Ip |
| 6750 | - state = fflib.FFParse_want_colon |
| 6751 | - goto mainparse |
| 6752 | - } |
| 6753 | - |
| 6754 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_Uuid, kn) { |
| 6755 | - currentKey = ffj_t_SmallPayload_Uuid |
| 6756 | - state = fflib.FFParse_want_colon |
| 6757 | - goto mainparse |
| 6758 | - } |
| 6759 | - |
| 6760 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_Gr, kn) { |
| 6761 | - currentKey = ffj_t_SmallPayload_Gr |
| 6762 | - state = fflib.FFParse_want_colon |
| 6763 | - goto mainparse |
| 6764 | - } |
| 6765 | - |
| 6766 | - if fflib.SimpleLetterEqualFold(ffj_key_SmallPayload_Tt, kn) { |
| 6767 | - currentKey = ffj_t_SmallPayload_Tt |
| 6768 | - state = fflib.FFParse_want_colon |
| 6769 | - goto mainparse |
| 6770 | - } |
| 6771 | - |
| 6772 | - if fflib.EqualFoldRight(ffj_key_SmallPayload_Sid, kn) { |
| 6773 | - currentKey = ffj_t_SmallPayload_Sid |
| 6774 | - state = fflib.FFParse_want_colon |
| 6775 | - goto mainparse |
| 6776 | - } |
| 6777 | - |
| 6778 | - if fflib.EqualFoldRight(ffj_key_SmallPayload_St, kn) { |
| 6779 | - currentKey = ffj_t_SmallPayload_St |
| 6780 | - state = fflib.FFParse_want_colon |
| 6781 | - goto mainparse |
| 6782 | - } |
| 6783 | - |
| 6784 | - currentKey = ffj_t_SmallPayloadno_such_key |
| 6785 | - state = fflib.FFParse_want_colon |
| 6786 | - goto mainparse |
| 6787 | - } |
| 6788 | - |
| 6789 | - case fflib.FFParse_want_colon: |
| 6790 | - if tok != fflib.FFTok_colon { |
| 6791 | - wantedTok = fflib.FFTok_colon |
| 6792 | - goto wrongtokenerror |
| 6793 | - } |
| 6794 | - state = fflib.FFParse_want_value |
| 6795 | - continue |
| 6796 | - case fflib.FFParse_want_value: |
| 6797 | - |
| 6798 | - if tok == fflib.FFTok_left_brace || tok == fflib.FFTok_left_bracket || tok == fflib.FFTok_integer || tok == fflib.FFTok_double || tok == fflib.FFTok_string || tok == fflib.FFTok_bool || tok == fflib.FFTok_null { |
| 6799 | - switch currentKey { |
| 6800 | - |
| 6801 | - case ffj_t_SmallPayload_St: |
| 6802 | - goto handle_St |
| 6803 | - |
| 6804 | - case ffj_t_SmallPayload_Sid: |
| 6805 | - goto handle_Sid |
| 6806 | - |
| 6807 | - case ffj_t_SmallPayload_Tt: |
| 6808 | - goto handle_Tt |
| 6809 | - |
| 6810 | - case ffj_t_SmallPayload_Gr: |
| 6811 | - goto handle_Gr |
| 6812 | - |
| 6813 | - case ffj_t_SmallPayload_Uuid: |
| 6814 | - goto handle_Uuid |
| 6815 | - |
| 6816 | - case ffj_t_SmallPayload_Ip: |
| 6817 | - goto handle_Ip |
| 6818 | - |
| 6819 | - case ffj_t_SmallPayload_Ua: |
| 6820 | - goto handle_Ua |
| 6821 | - |
| 6822 | - case ffj_t_SmallPayload_Tz: |
| 6823 | - goto handle_Tz |
| 6824 | - |
| 6825 | - case ffj_t_SmallPayload_V: |
| 6826 | - goto handle_V |
| 6827 | - |
| 6828 | - case ffj_t_SmallPayloadno_such_key: |
| 6829 | - err = fs.SkipField(tok) |
| 6830 | - if err != nil { |
| 6831 | - return fs.WrapErr(err) |
| 6832 | - } |
| 6833 | - state = fflib.FFParse_after_value |
| 6834 | - goto mainparse |
| 6835 | - } |
| 6836 | - } else { |
| 6837 | - goto wantedvalue |
| 6838 | - } |
| 6839 | - } |
| 6840 | - } |
| 6841 | - |
| 6842 | -handle_St: |
| 6843 | - |
| 6844 | - /* handler: uj.St type=int kind=int quoted=false*/ |
| 6845 | - |
| 6846 | - { |
| 6847 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 6848 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 6849 | - } |
| 6850 | - } |
| 6851 | - |
| 6852 | - { |
| 6853 | - |
| 6854 | - if tok == fflib.FFTok_null { |
| 6855 | - |
| 6856 | - } else { |
| 6857 | - |
| 6858 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 6859 | - |
| 6860 | - if err != nil { |
| 6861 | - return fs.WrapErr(err) |
| 6862 | - } |
| 6863 | - |
| 6864 | - uj.St = int(tval) |
| 6865 | - |
| 6866 | - } |
| 6867 | - } |
| 6868 | - |
| 6869 | - state = fflib.FFParse_after_value |
| 6870 | - goto mainparse |
| 6871 | - |
| 6872 | -handle_Sid: |
| 6873 | - |
| 6874 | - /* handler: uj.Sid type=int kind=int quoted=false*/ |
| 6875 | - |
| 6876 | - { |
| 6877 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 6878 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 6879 | - } |
| 6880 | - } |
| 6881 | - |
| 6882 | - { |
| 6883 | - |
| 6884 | - if tok == fflib.FFTok_null { |
| 6885 | - |
| 6886 | - } else { |
| 6887 | - |
| 6888 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 6889 | - |
| 6890 | - if err != nil { |
| 6891 | - return fs.WrapErr(err) |
| 6892 | - } |
| 6893 | - |
| 6894 | - uj.Sid = int(tval) |
| 6895 | - |
| 6896 | - } |
| 6897 | - } |
| 6898 | - |
| 6899 | - state = fflib.FFParse_after_value |
| 6900 | - goto mainparse |
| 6901 | - |
| 6902 | -handle_Tt: |
| 6903 | - |
| 6904 | - /* handler: uj.Tt type=string kind=string quoted=false*/ |
| 6905 | - |
| 6906 | - { |
| 6907 | - |
| 6908 | - { |
| 6909 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 6910 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 6911 | - } |
| 6912 | - } |
| 6913 | - |
| 6914 | - if tok == fflib.FFTok_null { |
| 6915 | - |
| 6916 | - } else { |
| 6917 | - |
| 6918 | - outBuf := fs.Output.Bytes() |
| 6919 | - |
| 6920 | - uj.Tt = string(string(outBuf)) |
| 6921 | - |
| 6922 | - } |
| 6923 | - } |
| 6924 | - |
| 6925 | - state = fflib.FFParse_after_value |
| 6926 | - goto mainparse |
| 6927 | - |
| 6928 | -handle_Gr: |
| 6929 | - |
| 6930 | - /* handler: uj.Gr type=int kind=int quoted=false*/ |
| 6931 | - |
| 6932 | - { |
| 6933 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 6934 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 6935 | - } |
| 6936 | - } |
| 6937 | - |
| 6938 | - { |
| 6939 | - |
| 6940 | - if tok == fflib.FFTok_null { |
| 6941 | - |
| 6942 | - } else { |
| 6943 | - |
| 6944 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 6945 | - |
| 6946 | - if err != nil { |
| 6947 | - return fs.WrapErr(err) |
| 6948 | - } |
| 6949 | - |
| 6950 | - uj.Gr = int(tval) |
| 6951 | - |
| 6952 | - } |
| 6953 | - } |
| 6954 | - |
| 6955 | - state = fflib.FFParse_after_value |
| 6956 | - goto mainparse |
| 6957 | - |
| 6958 | -handle_Uuid: |
| 6959 | - |
| 6960 | - /* handler: uj.Uuid type=string kind=string quoted=false*/ |
| 6961 | - |
| 6962 | - { |
| 6963 | - |
| 6964 | - { |
| 6965 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 6966 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 6967 | - } |
| 6968 | - } |
| 6969 | - |
| 6970 | - if tok == fflib.FFTok_null { |
| 6971 | - |
| 6972 | - } else { |
| 6973 | - |
| 6974 | - outBuf := fs.Output.Bytes() |
| 6975 | - |
| 6976 | - uj.Uuid = string(string(outBuf)) |
| 6977 | - |
| 6978 | - } |
| 6979 | - } |
| 6980 | - |
| 6981 | - state = fflib.FFParse_after_value |
| 6982 | - goto mainparse |
| 6983 | - |
| 6984 | -handle_Ip: |
| 6985 | - |
| 6986 | - /* handler: uj.Ip type=string kind=string quoted=false*/ |
| 6987 | - |
| 6988 | - { |
| 6989 | - |
| 6990 | - { |
| 6991 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 6992 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 6993 | - } |
| 6994 | - } |
| 6995 | - |
| 6996 | - if tok == fflib.FFTok_null { |
| 6997 | - |
| 6998 | - } else { |
| 6999 | - |
| 7000 | - outBuf := fs.Output.Bytes() |
| 7001 | - |
| 7002 | - uj.Ip = string(string(outBuf)) |
| 7003 | - |
| 7004 | - } |
| 7005 | - } |
| 7006 | - |
| 7007 | - state = fflib.FFParse_after_value |
| 7008 | - goto mainparse |
| 7009 | - |
| 7010 | -handle_Ua: |
| 7011 | - |
| 7012 | - /* handler: uj.Ua type=string kind=string quoted=false*/ |
| 7013 | - |
| 7014 | - { |
| 7015 | - |
| 7016 | - { |
| 7017 | - if tok != fflib.FFTok_string && tok != fflib.FFTok_null { |
| 7018 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for string", tok)) |
| 7019 | - } |
| 7020 | - } |
| 7021 | - |
| 7022 | - if tok == fflib.FFTok_null { |
| 7023 | - |
| 7024 | - } else { |
| 7025 | - |
| 7026 | - outBuf := fs.Output.Bytes() |
| 7027 | - |
| 7028 | - uj.Ua = string(string(outBuf)) |
| 7029 | - |
| 7030 | - } |
| 7031 | - } |
| 7032 | - |
| 7033 | - state = fflib.FFParse_after_value |
| 7034 | - goto mainparse |
| 7035 | - |
| 7036 | -handle_Tz: |
| 7037 | - |
| 7038 | - /* handler: uj.Tz type=int kind=int quoted=false*/ |
| 7039 | - |
| 7040 | - { |
| 7041 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 7042 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 7043 | - } |
| 7044 | - } |
| 7045 | - |
| 7046 | - { |
| 7047 | - |
| 7048 | - if tok == fflib.FFTok_null { |
| 7049 | - |
| 7050 | - } else { |
| 7051 | - |
| 7052 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 7053 | - |
| 7054 | - if err != nil { |
| 7055 | - return fs.WrapErr(err) |
| 7056 | - } |
| 7057 | - |
| 7058 | - uj.Tz = int(tval) |
| 7059 | - |
| 7060 | - } |
| 7061 | - } |
| 7062 | - |
| 7063 | - state = fflib.FFParse_after_value |
| 7064 | - goto mainparse |
| 7065 | - |
| 7066 | -handle_V: |
| 7067 | - |
| 7068 | - /* handler: uj.V type=int kind=int quoted=false*/ |
| 7069 | - |
| 7070 | - { |
| 7071 | - if tok != fflib.FFTok_integer && tok != fflib.FFTok_null { |
| 7072 | - return fs.WrapErr(fmt.Errorf("cannot unmarshal %s into Go value for int", tok)) |
| 7073 | - } |
| 7074 | - } |
| 7075 | - |
| 7076 | - { |
| 7077 | - |
| 7078 | - if tok == fflib.FFTok_null { |
| 7079 | - |
| 7080 | - } else { |
| 7081 | - |
| 7082 | - tval, err := fflib.ParseInt(fs.Output.Bytes(), 10, 64) |
| 7083 | - |
| 7084 | - if err != nil { |
| 7085 | - return fs.WrapErr(err) |
| 7086 | - } |
| 7087 | - |
| 7088 | - uj.V = int(tval) |
| 7089 | - |
| 7090 | - } |
| 7091 | - } |
| 7092 | - |
| 7093 | - state = fflib.FFParse_after_value |
| 7094 | - goto mainparse |
| 7095 | - |
| 7096 | -wantedvalue: |
| 7097 | - return fs.WrapErr(fmt.Errorf("wanted value token, but got token: %v", tok)) |
| 7098 | -wrongtokenerror: |
| 7099 | - return fs.WrapErr(fmt.Errorf("ffjson: wanted token: %v, but got token: %v output=%s", wantedTok, tok, fs.Output.String())) |
| 7100 | -tokerror: |
| 7101 | - if fs.BigError != nil { |
| 7102 | - return fs.WrapErr(fs.BigError) |
| 7103 | - } |
| 7104 | - err = fs.Error.ToError() |
| 7105 | - if err != nil { |
| 7106 | - return fs.WrapErr(err) |
| 7107 | - } |
| 7108 | - panic("ffjson-generated: unreachable, please report bug.") |
| 7109 | -done: |
| 7110 | - return nil |
| 7111 | -} |
| 7112 | --- a/benchmark/benchmark_large_payload_test.go |
| 7113 | +++ /dev/null |
| 7114 | @@ -1,166 +0,0 @@ |
| 7115 | -/* |
| 7116 | -Each test should process 24kb json record (based on Discourse API) |
| 7117 | -It should read 2 arrays, and for each item in array get few fields. |
| 7118 | -Basically it means processing full JSON file. |
| 7119 | -*/ |
| 7120 | -package benchmark |
| 7121 | - |
| 7122 | -import ( |
| 7123 | - "github.com/buger/jsonparser" |
| 7124 | - "testing" |
| 7125 | - // "github.com/Jeffail/gabs" |
| 7126 | - // "github.com/bitly/go-simplejson" |
| 7127 | - "encoding/json" |
| 7128 | - "github.com/a8m/djson" |
| 7129 | - jlexer "github.com/mailru/easyjson/jlexer" |
| 7130 | - "github.com/pquerna/ffjson/ffjson" |
| 7131 | - // "github.com/antonholmquist/jason" |
| 7132 | - // "fmt" |
| 7133 | -) |
| 7134 | - |
| 7135 | -/* |
| 7136 | - github.com/buger/jsonparser |
| 7137 | -*/ |
| 7138 | -// Verifies: STK-REQ-001 |
| 7139 | -// MCDC STK-REQ-001: N/A |
| 7140 | -// Verifies: STK-REQ-003 |
| 7141 | -// MCDC STK-REQ-003: N/A |
| 7142 | -// Verifies: STK-REQ-004 |
| 7143 | -// MCDC STK-REQ-004: N/A |
| 7144 | -func BenchmarkJsonParserLarge(b *testing.B) { |
| 7145 | - for i := 0; i < b.N; i++ { |
| 7146 | - jsonparser.ArrayEach(largeFixture, func(value []byte, dataType jsonparser.ValueType, offset int, err error) { |
| 7147 | - jsonparser.Get(value, "username") |
| 7148 | - nothing() |
| 7149 | - }, "users") |
| 7150 | - |
| 7151 | - jsonparser.ArrayEach(largeFixture, func(value []byte, dataType jsonparser.ValueType, offset int, err error) { |
| 7152 | - jsonparser.GetInt(value, "id") |
| 7153 | - jsonparser.Get(value, "slug") |
| 7154 | - nothing() |
| 7155 | - }, "topics", "topics") |
| 7156 | - } |
| 7157 | -} |
| 7158 | - |
| 7159 | -/* |
| 7160 | - encoding/json |
| 7161 | -*/ |
| 7162 | -// Verifies: STK-REQ-001 |
| 7163 | -// MCDC STK-REQ-001: N/A |
| 7164 | -// Verifies: STK-REQ-003 |
| 7165 | -// MCDC STK-REQ-003: N/A |
| 7166 | -// Verifies: STK-REQ-004 |
| 7167 | -// MCDC STK-REQ-004: N/A |
| 7168 | -func BenchmarkEncodingJsonStructLarge(b *testing.B) { |
| 7169 | - for i := 0; i < b.N; i++ { |
| 7170 | - var data LargePayload |
| 7171 | - json.Unmarshal(largeFixture, &data) |
| 7172 | - |
| 7173 | - for _, u := range data.Users { |
| 7174 | - nothing(u.Username) |
| 7175 | - } |
| 7176 | - |
| 7177 | - for _, t := range data.Topics.Topics { |
| 7178 | - nothing(t.Id, t.Slug) |
| 7179 | - } |
| 7180 | - } |
| 7181 | -} |
| 7182 | - |
| 7183 | -// Verifies: STK-REQ-001 |
| 7184 | -// MCDC STK-REQ-001: N/A |
| 7185 | -// Verifies: STK-REQ-003 |
| 7186 | -// MCDC STK-REQ-003: N/A |
| 7187 | -// Verifies: STK-REQ-004 |
| 7188 | -// MCDC STK-REQ-004: N/A |
| 7189 | -func BenchmarkEncodingJsonInterfaceLarge(b *testing.B) { |
| 7190 | - for i := 0; i < b.N; i++ { |
| 7191 | - var data interface{} |
| 7192 | - json.Unmarshal(largeFixture, &data) |
| 7193 | - m := data.(map[string]interface{}) |
| 7194 | - |
| 7195 | - users := m["users"].([]interface{}) |
| 7196 | - for _, u := range users { |
| 7197 | - nothing(u.(map[string]interface{})["username"].(string)) |
| 7198 | - } |
| 7199 | - |
| 7200 | - topics := m["topics"].(map[string]interface{})["topics"].([]interface{}) |
| 7201 | - for _, t := range topics { |
| 7202 | - tI := t.(map[string]interface{}) |
| 7203 | - nothing(tI["id"].(float64), tI["slug"].(string)) |
| 7204 | - } |
| 7205 | - } |
| 7206 | -} |
| 7207 | - |
| 7208 | -/* |
| 7209 | - github.com/pquerna/ffjson |
| 7210 | -*/ |
| 7211 | -// Verifies: STK-REQ-001 |
| 7212 | -// MCDC STK-REQ-001: N/A |
| 7213 | -// Verifies: STK-REQ-003 |
| 7214 | -// MCDC STK-REQ-003: N/A |
| 7215 | -// Verifies: STK-REQ-004 |
| 7216 | -// MCDC STK-REQ-004: N/A |
| 7217 | -func BenchmarkFFJsonLarge(b *testing.B) { |
| 7218 | - for i := 0; i < b.N; i++ { |
| 7219 | - var data LargePayload |
| 7220 | - ffjson.Unmarshal(largeFixture, &data) |
| 7221 | - |
| 7222 | - for _, u := range data.Users { |
| 7223 | - nothing(u.Username) |
| 7224 | - } |
| 7225 | - |
| 7226 | - for _, t := range data.Topics.Topics { |
| 7227 | - nothing(t.Id, t.Slug) |
| 7228 | - } |
| 7229 | - } |
| 7230 | -} |
| 7231 | - |
| 7232 | -/* |
| 7233 | - github.com/mailru/easyjson |
| 7234 | -*/ |
| 7235 | -// Verifies: STK-REQ-001 |
| 7236 | -// MCDC STK-REQ-001: N/A |
| 7237 | -// Verifies: STK-REQ-003 |
| 7238 | -// MCDC STK-REQ-003: N/A |
| 7239 | -// Verifies: STK-REQ-004 |
| 7240 | -// MCDC STK-REQ-004: N/A |
| 7241 | -func BenchmarkEasyJsonLarge(b *testing.B) { |
| 7242 | - for i := 0; i < b.N; i++ { |
| 7243 | - lexer := &jlexer.Lexer{Data: largeFixture} |
| 7244 | - data := new(LargePayload) |
| 7245 | - data.UnmarshalEasyJSON(lexer) |
| 7246 | - |
| 7247 | - for _, u := range data.Users { |
| 7248 | - nothing(u.Username) |
| 7249 | - } |
| 7250 | - |
| 7251 | - for _, t := range data.Topics.Topics { |
| 7252 | - nothing(t.Id, t.Slug) |
| 7253 | - } |
| 7254 | - } |
| 7255 | -} |
| 7256 | - |
| 7257 | -/* |
| 7258 | - github.com/a8m/djson |
| 7259 | -*/ |
| 7260 | -// Verifies: STK-REQ-001 |
| 7261 | -// MCDC STK-REQ-001: N/A |
| 7262 | -// Verifies: STK-REQ-003 |
| 7263 | -// MCDC STK-REQ-003: N/A |
| 7264 | -// Verifies: STK-REQ-004 |
| 7265 | -// MCDC STK-REQ-004: N/A |
| 7266 | -func BenchmarkDjsonLarge(b *testing.B) { |
| 7267 | - for i := 0; i < b.N; i++ { |
| 7268 | - m, _ := djson.DecodeObject(largeFixture) |
| 7269 | - users := m["users"].([]interface{}) |
| 7270 | - for _, u := range users { |
| 7271 | - nothing(u.(map[string]interface{})["username"].(string)) |
| 7272 | - } |
| 7273 | - |
| 7274 | - topics := m["topics"].(map[string]interface{})["topics"].([]interface{}) |
| 7275 | - for _, t := range topics { |
| 7276 | - tI := t.(map[string]interface{}) |
| 7277 | - nothing(tI["id"].(float64), tI["slug"].(string)) |
| 7278 | - } |
| 7279 | - } |
| 7280 | -} |
| 7281 | --- a/benchmark/benchmark_medium_payload_test.go |
| 7282 | +++ /dev/null |
| 7283 | @@ -1,500 +0,0 @@ |
| 7284 | -/* |
| 7285 | -Each test should process 2.4kb json record (based on Clearbit API) |
| 7286 | -It should read multiple nested fields and 1 array |
| 7287 | -*/ |
| 7288 | -package benchmark |
| 7289 | - |
| 7290 | -import ( |
| 7291 | - "encoding/json" |
| 7292 | - "testing" |
| 7293 | - |
| 7294 | - "github.com/Jeffail/gabs" |
| 7295 | - "github.com/a8m/djson" |
| 7296 | - "github.com/antonholmquist/jason" |
| 7297 | - "github.com/bitly/go-simplejson" |
| 7298 | - "github.com/buger/jsonparser" |
| 7299 | - jlexer "github.com/mailru/easyjson/jlexer" |
| 7300 | - "github.com/mreiferson/go-ujson" |
| 7301 | - "github.com/pquerna/ffjson/ffjson" |
| 7302 | - "github.com/ugorji/go/codec" |
| 7303 | - // "fmt" |
| 7304 | - "bytes" |
| 7305 | - "errors" |
| 7306 | -) |
| 7307 | - |
| 7308 | -/* |
| 7309 | - github.com/buger/jsonparser |
| 7310 | -*/ |
| 7311 | -// Verifies: STK-REQ-001 |
| 7312 | -// MCDC STK-REQ-001: N/A |
| 7313 | -// Verifies: STK-REQ-003 |
| 7314 | -// MCDC STK-REQ-003: N/A |
| 7315 | -// Verifies: STK-REQ-004 |
| 7316 | -// MCDC STK-REQ-004: N/A |
| 7317 | -// Verifies: STK-REQ-005 |
| 7318 | -// MCDC STK-REQ-005: N/A |
| 7319 | -// Verifies: STK-REQ-007 |
| 7320 | -// MCDC STK-REQ-007: N/A |
| 7321 | -func BenchmarkJsonParserMedium(b *testing.B) { |
| 7322 | - for i := 0; i < b.N; i++ { |
| 7323 | - jsonparser.Get(mediumFixture, "person", "name", "fullName") |
| 7324 | - jsonparser.GetInt(mediumFixture, "person", "github", "followers") |
| 7325 | - jsonparser.Get(mediumFixture, "company") |
| 7326 | - |
| 7327 | - jsonparser.ArrayEach(mediumFixture, func(value []byte, dataType jsonparser.ValueType, offset int, err error) { |
| 7328 | - jsonparser.Get(value, "url") |
| 7329 | - nothing() |
| 7330 | - }, "person", "gravatar", "avatars") |
| 7331 | - } |
| 7332 | -} |
| 7333 | - |
| 7334 | -// Verifies: STK-REQ-001 |
| 7335 | -// MCDC STK-REQ-001: N/A |
| 7336 | -// Verifies: STK-REQ-003 |
| 7337 | -// MCDC STK-REQ-003: N/A |
| 7338 | -// Verifies: STK-REQ-004 |
| 7339 | -// MCDC STK-REQ-004: N/A |
| 7340 | -// Verifies: STK-REQ-005 |
| 7341 | -// MCDC STK-REQ-005: N/A |
| 7342 | -// Verifies: STK-REQ-007 |
| 7343 | -// MCDC STK-REQ-007: N/A |
| 7344 | -func BenchmarkJsonParserDeleteMedium(b *testing.B) { |
| 7345 | - fixture := make([]byte, 0, len(mediumFixture)) |
| 7346 | - b.ResetTimer() |
| 7347 | - for i := 0; i < b.N; i++ { |
| 7348 | - fixture = append(fixture[:0], mediumFixture...) |
| 7349 | - fixture = jsonparser.Delete(fixture, "person", "name", "fullName") |
| 7350 | - fixture = jsonparser.Delete(fixture, "person", "github", "followers") |
| 7351 | - fixture = jsonparser.Delete(fixture, "company") |
| 7352 | - |
| 7353 | - nothing() |
| 7354 | - } |
| 7355 | -} |
| 7356 | - |
| 7357 | -// Verifies: STK-REQ-001 |
| 7358 | -// MCDC STK-REQ-001: N/A |
| 7359 | -// Verifies: STK-REQ-003 |
| 7360 | -// MCDC STK-REQ-003: N/A |
| 7361 | -// Verifies: STK-REQ-004 |
| 7362 | -// MCDC STK-REQ-004: N/A |
| 7363 | -// Verifies: STK-REQ-005 |
| 7364 | -// MCDC STK-REQ-005: N/A |
| 7365 | -// Verifies: STK-REQ-007 |
| 7366 | -// MCDC STK-REQ-007: N/A |
| 7367 | -func BenchmarkJsonParserEachKeyManualMedium(b *testing.B) { |
| 7368 | - paths := [][]string{ |
| 7369 | - []string{"person", "name", "fullName"}, |
| 7370 | - []string{"person", "github", "followers"}, |
| 7371 | - []string{"company"}, |
| 7372 | - []string{"person", "gravatar", "avatars"}, |
| 7373 | - } |
| 7374 | - |
| 7375 | - for i := 0; i < b.N; i++ { |
| 7376 | - jsonparser.EachKey(mediumFixture, func(idx int, value []byte, vt jsonparser.ValueType, err error) { |
| 7377 | - switch idx { |
| 7378 | - case 0: |
| 7379 | - // jsonparser.ParseString(value) |
| 7380 | - case 1: |
| 7381 | - jsonparser.ParseInt(value) |
| 7382 | - case 2: |
| 7383 | - // jsonparser.ParseString(value) |
| 7384 | - case 3: |
| 7385 | - jsonparser.ArrayEach(value, func(avalue []byte, dataType jsonparser.ValueType, offset int, err error) { |
| 7386 | - jsonparser.Get(avalue, "url") |
| 7387 | - }) |
| 7388 | - } |
| 7389 | - }, paths...) |
| 7390 | - } |
| 7391 | -} |
| 7392 | - |
| 7393 | -// Verifies: STK-REQ-001 |
| 7394 | -// MCDC STK-REQ-001: N/A |
| 7395 | -// Verifies: STK-REQ-003 |
| 7396 | -// MCDC STK-REQ-003: N/A |
| 7397 | -// Verifies: STK-REQ-004 |
| 7398 | -// MCDC STK-REQ-004: N/A |
| 7399 | -// Verifies: STK-REQ-005 |
| 7400 | -// MCDC STK-REQ-005: N/A |
| 7401 | -// Verifies: STK-REQ-007 |
| 7402 | -// MCDC STK-REQ-007: N/A |
| 7403 | -func BenchmarkJsonParserEachKeyStructMedium(b *testing.B) { |
| 7404 | - paths := [][]string{ |
| 7405 | - []string{"person", "name", "fullName"}, |
| 7406 | - []string{"person", "github", "followers"}, |
| 7407 | - []string{"company"}, |
| 7408 | - []string{"person", "gravatar", "avatars"}, |
| 7409 | - } |
| 7410 | - |
| 7411 | - for i := 0; i < b.N; i++ { |
| 7412 | - data := MediumPayload{ |
| 7413 | - Person: &CBPerson{ |
| 7414 | - Name: &CBName{}, |
| 7415 | - Github: &CBGithub{}, |
| 7416 | - Gravatar: &CBGravatar{}, |
| 7417 | - }, |
| 7418 | - } |
| 7419 | - |
| 7420 | - jsonparser.EachKey(mediumFixture, func(idx int, value []byte, vt jsonparser.ValueType, err error) { |
| 7421 | - switch idx { |
| 7422 | - case 0: |
| 7423 | - data.Person.Name.FullName, _ = jsonparser.ParseString(value) |
| 7424 | - case 1: |
| 7425 | - v, _ := jsonparser.ParseInt(value) |
| 7426 | - data.Person.Github.Followers = int(v) |
| 7427 | - case 2: |
| 7428 | - json.Unmarshal(value, &data.Company) // we don't have a JSON -> map[string]interface{} function yet, so use standard encoding/json here |
| 7429 | - case 3: |
| 7430 | - var avatars []*CBAvatar |
| 7431 | - jsonparser.ArrayEach(value, func(avalue []byte, dataType jsonparser.ValueType, offset int, err error) { |
| 7432 | - url, _ := jsonparser.ParseString(avalue) |
| 7433 | - avatars = append(avatars, &CBAvatar{Url: url}) |
| 7434 | - }) |
| 7435 | - data.Person.Gravatar.Avatars = avatars |
| 7436 | - } |
| 7437 | - }, paths...) |
| 7438 | - } |
| 7439 | -} |
| 7440 | - |
| 7441 | -// Verifies: STK-REQ-001 |
| 7442 | -// MCDC STK-REQ-001: N/A |
| 7443 | -// Verifies: STK-REQ-003 |
| 7444 | -// MCDC STK-REQ-003: N/A |
| 7445 | -// Verifies: STK-REQ-004 |
| 7446 | -// MCDC STK-REQ-004: N/A |
| 7447 | -// Verifies: STK-REQ-005 |
| 7448 | -// MCDC STK-REQ-005: N/A |
| 7449 | -// Verifies: STK-REQ-007 |
| 7450 | -// MCDC STK-REQ-007: N/A |
| 7451 | -func BenchmarkJsonParserObjectEachStructMedium(b *testing.B) { |
| 7452 | - nameKey, githubKey, gravatarKey := []byte("name"), []byte("github"), []byte("gravatar") |
| 7453 | - errStop := errors.New("stop") |
| 7454 | - |
| 7455 | - for i := 0; i < b.N; i++ { |
| 7456 | - data := MediumPayload{ |
| 7457 | - Person: &CBPerson{ |
| 7458 | - Name: &CBName{}, |
| 7459 | - Github: &CBGithub{}, |
| 7460 | - Gravatar: &CBGravatar{}, |
| 7461 | - }, |
| 7462 | - } |
| 7463 | - |
| 7464 | - missing := 3 |
| 7465 | - |
| 7466 | - jsonparser.ObjectEach(mediumFixture, func(k, v []byte, vt jsonparser.ValueType, o int) error { |
| 7467 | - switch { |
| 7468 | - case bytes.Equal(k, nameKey): |
| 7469 | - data.Person.Name.FullName, _ = jsonparser.GetString(v, "fullName") |
| 7470 | - missing-- |
| 7471 | - case bytes.Equal(k, githubKey): |
| 7472 | - x, _ := jsonparser.GetInt(v, "followers") |
| 7473 | - data.Person.Github.Followers = int(x) |
| 7474 | - missing-- |
| 7475 | - case bytes.Equal(k, gravatarKey): |
| 7476 | - var avatars []*CBAvatar |
| 7477 | - jsonparser.ArrayEach(v, func(avalue []byte, dataType jsonparser.ValueType, offset int, err error) { |
| 7478 | - url, _ := jsonparser.ParseString(avalue) |
| 7479 | - avatars = append(avatars, &CBAvatar{Url: url}) |
| 7480 | - }, "avatars") |
| 7481 | - data.Person.Gravatar.Avatars = avatars |
| 7482 | - missing-- |
| 7483 | - } |
| 7484 | - |
| 7485 | - if missing == 0 { |
| 7486 | - return errStop |
| 7487 | - } else { |
| 7488 | - return nil |
| 7489 | - } |
| 7490 | - }, "person") |
| 7491 | - |
| 7492 | - cv, _, _, _ := jsonparser.Get(mediumFixture, "company") |
| 7493 | - json.Unmarshal(cv, &data.Company) |
| 7494 | - } |
| 7495 | -} |
| 7496 | - |
| 7497 | -/* |
| 7498 | - encoding/json |
| 7499 | -*/ |
| 7500 | -// Verifies: STK-REQ-001 |
| 7501 | -// MCDC STK-REQ-001: N/A |
| 7502 | -// Verifies: STK-REQ-003 |
| 7503 | -// MCDC STK-REQ-003: N/A |
| 7504 | -// Verifies: STK-REQ-004 |
| 7505 | -// MCDC STK-REQ-004: N/A |
| 7506 | -// Verifies: STK-REQ-005 |
| 7507 | -// MCDC STK-REQ-005: N/A |
| 7508 | -// Verifies: STK-REQ-007 |
| 7509 | -// MCDC STK-REQ-007: N/A |
| 7510 | -func BenchmarkEncodingJsonStructMedium(b *testing.B) { |
| 7511 | - for i := 0; i < b.N; i++ { |
| 7512 | - var data MediumPayload |
| 7513 | - json.Unmarshal(mediumFixture, &data) |
| 7514 | - |
| 7515 | - nothing(data.Person.Name.FullName, data.Person.Github.Followers, data.Company) |
| 7516 | - |
| 7517 | - for _, el := range data.Person.Gravatar.Avatars { |
| 7518 | - nothing(el.Url) |
| 7519 | - } |
| 7520 | - } |
| 7521 | -} |
| 7522 | - |
| 7523 | -// Verifies: STK-REQ-001 |
| 7524 | -// MCDC STK-REQ-001: N/A |
| 7525 | -// Verifies: STK-REQ-003 |
| 7526 | -// MCDC STK-REQ-003: N/A |
| 7527 | -// Verifies: STK-REQ-004 |
| 7528 | -// MCDC STK-REQ-004: N/A |
| 7529 | -// Verifies: STK-REQ-005 |
| 7530 | -// MCDC STK-REQ-005: N/A |
| 7531 | -// Verifies: STK-REQ-007 |
| 7532 | -// MCDC STK-REQ-007: N/A |
| 7533 | -func BenchmarkEncodingJsonInterfaceMedium(b *testing.B) { |
| 7534 | - for i := 0; i < b.N; i++ { |
| 7535 | - var data interface{} |
| 7536 | - json.Unmarshal(mediumFixture, &data) |
| 7537 | - m := data.(map[string]interface{}) |
| 7538 | - |
| 7539 | - person := m["person"].(map[string]interface{}) |
| 7540 | - name := person["name"].(map[string]interface{}) |
| 7541 | - github := person["github"].(map[string]interface{}) |
| 7542 | - company := m["company"] |
| 7543 | - gravatar := person["gravatar"].(map[string]interface{}) |
| 7544 | - avatars := gravatar["avatars"].([]interface{}) |
| 7545 | - |
| 7546 | - nothing(name["fullName"].(string), github["followers"].(float64), company) |
| 7547 | - for _, a := range avatars { |
| 7548 | - nothing(a.(map[string]interface{})["url"]) |
| 7549 | - } |
| 7550 | - } |
| 7551 | -} |
| 7552 | - |
| 7553 | -/* |
| 7554 | - github.com/Jeffail/gabs |
| 7555 | -*/ |
| 7556 | -// Verifies: STK-REQ-001 |
| 7557 | -// MCDC STK-REQ-001: N/A |
| 7558 | -// Verifies: STK-REQ-003 |
| 7559 | -// MCDC STK-REQ-003: N/A |
| 7560 | -// Verifies: STK-REQ-004 |
| 7561 | -// MCDC STK-REQ-004: N/A |
| 7562 | -// Verifies: STK-REQ-005 |
| 7563 | -// MCDC STK-REQ-005: N/A |
| 7564 | -// Verifies: STK-REQ-007 |
| 7565 | -// MCDC STK-REQ-007: N/A |
| 7566 | -func BenchmarkGabsMedium(b *testing.B) { |
| 7567 | - for i := 0; i < b.N; i++ { |
| 7568 | - json, _ := gabs.ParseJSON(mediumFixture) |
| 7569 | - person := json.Path("person") |
| 7570 | - nothing( |
| 7571 | - person.Path("name.fullName").Data().(string), |
| 7572 | - person.Path("github.followers").Data().(float64), |
| 7573 | - ) |
| 7574 | - |
| 7575 | - json.Path("company").ChildrenMap() |
| 7576 | - |
| 7577 | - arr, _ := person.Path("gravatar.avatars.url").Children() |
| 7578 | - for _, el := range arr { |
| 7579 | - nothing(el.String()) |
| 7580 | - } |
| 7581 | - } |
| 7582 | -} |
| 7583 | - |
| 7584 | -/* |
| 7585 | - github.com/bitly/go-simplejson |
| 7586 | -*/ |
| 7587 | -// Verifies: STK-REQ-001 |
| 7588 | -// MCDC STK-REQ-001: N/A |
| 7589 | -// Verifies: STK-REQ-003 |
| 7590 | -// MCDC STK-REQ-003: N/A |
| 7591 | -// Verifies: STK-REQ-004 |
| 7592 | -// MCDC STK-REQ-004: N/A |
| 7593 | -// Verifies: STK-REQ-005 |
| 7594 | -// MCDC STK-REQ-005: N/A |
| 7595 | -// Verifies: STK-REQ-007 |
| 7596 | -// MCDC STK-REQ-007: N/A |
| 7597 | -func BenchmarkGoSimpleJsonMedium(b *testing.B) { |
| 7598 | - for i := 0; i < b.N; i++ { |
| 7599 | - json, _ := simplejson.NewJson(mediumFixture) |
| 7600 | - person := json.Get("person") |
| 7601 | - person.Get("name").Get("fullName").String() |
| 7602 | - person.Get("github").Get("followers").Float64() |
| 7603 | - json.Get("company") |
| 7604 | - arr, _ := person.Get("gravatar").Get("avatars").Array() |
| 7605 | - |
| 7606 | - for _, el := range arr { |
| 7607 | - nothing(el.(map[string]interface{})["url"]) |
| 7608 | - } |
| 7609 | - } |
| 7610 | -} |
| 7611 | - |
| 7612 | -/* |
| 7613 | - github.com/pquerna/ffjson |
| 7614 | -*/ |
| 7615 | -// Verifies: STK-REQ-001 |
| 7616 | -// MCDC STK-REQ-001: N/A |
| 7617 | -// Verifies: STK-REQ-003 |
| 7618 | -// MCDC STK-REQ-003: N/A |
| 7619 | -// Verifies: STK-REQ-004 |
| 7620 | -// MCDC STK-REQ-004: N/A |
| 7621 | -// Verifies: STK-REQ-005 |
| 7622 | -// MCDC STK-REQ-005: N/A |
| 7623 | -// Verifies: STK-REQ-007 |
| 7624 | -// MCDC STK-REQ-007: N/A |
| 7625 | -func BenchmarkFFJsonMedium(b *testing.B) { |
| 7626 | - for i := 0; i < b.N; i++ { |
| 7627 | - var data MediumPayload |
| 7628 | - ffjson.Unmarshal(mediumFixture, &data) |
| 7629 | - |
| 7630 | - nothing(data.Person.Name.FullName, data.Person.Github.Followers, data.Company) |
| 7631 | - |
| 7632 | - for _, el := range data.Person.Gravatar.Avatars { |
| 7633 | - nothing(el.Url) |
| 7634 | - } |
| 7635 | - } |
| 7636 | -} |
| 7637 | - |
| 7638 | -/* |
| 7639 | - github.com/bitly/go-simplejson |
| 7640 | -*/ |
| 7641 | -// Verifies: STK-REQ-001 |
| 7642 | -// MCDC STK-REQ-001: N/A |
| 7643 | -// Verifies: STK-REQ-003 |
| 7644 | -// MCDC STK-REQ-003: N/A |
| 7645 | -// Verifies: STK-REQ-004 |
| 7646 | -// MCDC STK-REQ-004: N/A |
| 7647 | -// Verifies: STK-REQ-005 |
| 7648 | -// MCDC STK-REQ-005: N/A |
| 7649 | -// Verifies: STK-REQ-007 |
| 7650 | -// MCDC STK-REQ-007: N/A |
| 7651 | -func BenchmarkJasonMedium(b *testing.B) { |
| 7652 | - for i := 0; i < b.N; i++ { |
| 7653 | - json, _ := jason.NewObjectFromBytes(mediumFixture) |
| 7654 | - |
| 7655 | - json.GetString("person.name.fullName") |
| 7656 | - json.GetFloat64("person.github.followers") |
| 7657 | - json.GetObject("company") |
| 7658 | - arr, _ := json.GetObjectArray("person.gravatar.avatars") |
| 7659 | - |
| 7660 | - for _, el := range arr { |
| 7661 | - el.GetString("url") |
| 7662 | - } |
| 7663 | - |
| 7664 | - nothing() |
| 7665 | - } |
| 7666 | -} |
| 7667 | - |
| 7668 | -/* |
| 7669 | - github.com/mreiferson/go-ujson |
| 7670 | -*/ |
| 7671 | -// Verifies: STK-REQ-001 |
| 7672 | -// MCDC STK-REQ-001: N/A |
| 7673 | -// Verifies: STK-REQ-003 |
| 7674 | -// MCDC STK-REQ-003: N/A |
| 7675 | -// Verifies: STK-REQ-004 |
| 7676 | -// MCDC STK-REQ-004: N/A |
| 7677 | -// Verifies: STK-REQ-005 |
| 7678 | -// MCDC STK-REQ-005: N/A |
| 7679 | -// Verifies: STK-REQ-007 |
| 7680 | -// MCDC STK-REQ-007: N/A |
| 7681 | -func BenchmarkUjsonMedium(b *testing.B) { |
| 7682 | - for i := 0; i < b.N; i++ { |
| 7683 | - json, _ := ujson.NewFromBytes(mediumFixture) |
| 7684 | - |
| 7685 | - person := json.Get("person") |
| 7686 | - |
| 7687 | - person.Get("name").Get("fullName").String() |
| 7688 | - person.Get("github").Get("followers").Float64() |
| 7689 | - json.Get("company").String() |
| 7690 | - |
| 7691 | - arr := person.Get("gravatar").Get("avatars").Array() |
| 7692 | - for _, el := range arr { |
| 7693 | - el.Get("url").String() |
| 7694 | - } |
| 7695 | - |
| 7696 | - nothing() |
| 7697 | - } |
| 7698 | -} |
| 7699 | - |
| 7700 | -/* |
| 7701 | - github.com/a8m/djson |
| 7702 | -*/ |
| 7703 | -// Verifies: STK-REQ-001 |
| 7704 | -// MCDC STK-REQ-001: N/A |
| 7705 | -// Verifies: STK-REQ-003 |
| 7706 | -// MCDC STK-REQ-003: N/A |
| 7707 | -// Verifies: STK-REQ-004 |
| 7708 | -// MCDC STK-REQ-004: N/A |
| 7709 | -// Verifies: STK-REQ-005 |
| 7710 | -// MCDC STK-REQ-005: N/A |
| 7711 | -// Verifies: STK-REQ-007 |
| 7712 | -// MCDC STK-REQ-007: N/A |
| 7713 | -func BenchmarkDjsonMedium(b *testing.B) { |
| 7714 | - for i := 0; i < b.N; i++ { |
| 7715 | - m, _ := djson.DecodeObject(mediumFixture) |
| 7716 | - person := m["person"].(map[string]interface{}) |
| 7717 | - name := person["name"].(map[string]interface{}) |
| 7718 | - github := person["github"].(map[string]interface{}) |
| 7719 | - company := m["company"] |
| 7720 | - gravatar := person["gravatar"].(map[string]interface{}) |
| 7721 | - avatars := gravatar["avatars"].([]interface{}) |
| 7722 | - |
| 7723 | - nothing(name["fullName"].(string), github["followers"].(float64), company) |
| 7724 | - for _, a := range avatars { |
| 7725 | - nothing(a.(map[string]interface{})["url"]) |
| 7726 | - } |
| 7727 | - } |
| 7728 | -} |
| 7729 | - |
| 7730 | -/* |
| 7731 | - github.com/ugorji/go/codec |
| 7732 | -*/ |
| 7733 | -// Verifies: STK-REQ-001 |
| 7734 | -// MCDC STK-REQ-001: N/A |
| 7735 | -// Verifies: STK-REQ-003 |
| 7736 | -// MCDC STK-REQ-003: N/A |
| 7737 | -// Verifies: STK-REQ-004 |
| 7738 | -// MCDC STK-REQ-004: N/A |
| 7739 | -// Verifies: STK-REQ-005 |
| 7740 | -// MCDC STK-REQ-005: N/A |
| 7741 | -// Verifies: STK-REQ-007 |
| 7742 | -// MCDC STK-REQ-007: N/A |
| 7743 | -func BenchmarkUgirjiMedium(b *testing.B) { |
| 7744 | - for i := 0; i < b.N; i++ { |
| 7745 | - decoder := codec.NewDecoderBytes(mediumFixture, new(codec.JsonHandle)) |
| 7746 | - data := new(MediumPayload) |
| 7747 | - json.Unmarshal(mediumFixture, &data) |
| 7748 | - data.CodecDecodeSelf(decoder) |
| 7749 | - |
| 7750 | - nothing(data.Person.Name.FullName, data.Person.Github.Followers, data.Company) |
| 7751 | - |
| 7752 | - for _, el := range data.Person.Gravatar.Avatars { |
| 7753 | - nothing(el.Url) |
| 7754 | - } |
| 7755 | - } |
| 7756 | -} |
| 7757 | - |
| 7758 | -/* |
| 7759 | - github.com/mailru/easyjson |
| 7760 | -*/ |
| 7761 | -// Verifies: STK-REQ-001 |
| 7762 | -// MCDC STK-REQ-001: N/A |
| 7763 | -// Verifies: STK-REQ-003 |
| 7764 | -// MCDC STK-REQ-003: N/A |
| 7765 | -// Verifies: STK-REQ-004 |
| 7766 | -// MCDC STK-REQ-004: N/A |
| 7767 | -// Verifies: STK-REQ-005 |
| 7768 | -// MCDC STK-REQ-005: N/A |
| 7769 | -// Verifies: STK-REQ-007 |
| 7770 | -// MCDC STK-REQ-007: N/A |
| 7771 | -func BenchmarkEasyJsonMedium(b *testing.B) { |
| 7772 | - for i := 0; i < b.N; i++ { |
| 7773 | - lexer := &jlexer.Lexer{Data: mediumFixture} |
| 7774 | - data := new(MediumPayload) |
| 7775 | - data.UnmarshalEasyJSON(lexer) |
| 7776 | - |
| 7777 | - nothing(data.Person.Name.FullName, data.Person.Github.Followers, data.Company) |
| 7778 | - |
| 7779 | - for _, el := range data.Person.Gravatar.Avatars { |
| 7780 | - nothing(el.Url) |
| 7781 | - } |
| 7782 | - } |
| 7783 | -} |
| 7784 | --- a/benchmark/benchmark_small_payload_test.go |
| 7785 | +++ /dev/null |
| 7786 | @@ -1,475 +0,0 @@ |
| 7787 | -/* |
| 7788 | -Each test should process 190 byte http log like json record |
| 7789 | -It should read multiple fields |
| 7790 | -*/ |
| 7791 | -package benchmark |
| 7792 | - |
| 7793 | -import ( |
| 7794 | - "encoding/json" |
| 7795 | - "testing" |
| 7796 | - |
| 7797 | - "github.com/Jeffail/gabs" |
| 7798 | - "github.com/a8m/djson" |
| 7799 | - "github.com/antonholmquist/jason" |
| 7800 | - "github.com/bitly/go-simplejson" |
| 7801 | - "github.com/buger/jsonparser" |
| 7802 | - jlexer "github.com/mailru/easyjson/jlexer" |
| 7803 | - "github.com/mreiferson/go-ujson" |
| 7804 | - "github.com/pquerna/ffjson/ffjson" |
| 7805 | - "github.com/ugorji/go/codec" |
| 7806 | - // "fmt" |
| 7807 | - "bytes" |
| 7808 | - "errors" |
| 7809 | -) |
| 7810 | - |
| 7811 | -// Just for emulating field access, so it will not throw "evaluated but not used" |
| 7812 | -// Benchmark helper for STK-REQ-001, STK-REQ-003, STK-REQ-004, STK-REQ-005, and STK-REQ-007. |
| 7813 | -func nothing(_ ...interface{}) {} |
| 7814 | - |
| 7815 | -/* |
| 7816 | - github.com/buger/jsonparser |
| 7817 | -*/ |
| 7818 | -// Verifies: STK-REQ-001 |
| 7819 | -// MCDC STK-REQ-001: N/A |
| 7820 | -// Verifies: STK-REQ-003 |
| 7821 | -// MCDC STK-REQ-003: N/A |
| 7822 | -// Verifies: STK-REQ-004 |
| 7823 | -// MCDC STK-REQ-004: N/A |
| 7824 | -// Verifies: STK-REQ-005 |
| 7825 | -// MCDC STK-REQ-005: N/A |
| 7826 | -// Verifies: STK-REQ-007 |
| 7827 | -// MCDC STK-REQ-007: N/A |
| 7828 | -func BenchmarkJsonParserSmall(b *testing.B) { |
| 7829 | - for i := 0; i < b.N; i++ { |
| 7830 | - jsonparser.Get(smallFixture, "uuid") |
| 7831 | - jsonparser.GetInt(smallFixture, "tz") |
| 7832 | - jsonparser.Get(smallFixture, "ua") |
| 7833 | - jsonparser.GetInt(smallFixture, "st") |
| 7834 | - |
| 7835 | - nothing() |
| 7836 | - } |
| 7837 | -} |
| 7838 | - |
| 7839 | -// Verifies: STK-REQ-001 |
| 7840 | -// MCDC STK-REQ-001: N/A |
| 7841 | -// Verifies: STK-REQ-003 |
| 7842 | -// MCDC STK-REQ-003: N/A |
| 7843 | -// Verifies: STK-REQ-004 |
| 7844 | -// MCDC STK-REQ-004: N/A |
| 7845 | -// Verifies: STK-REQ-005 |
| 7846 | -// MCDC STK-REQ-005: N/A |
| 7847 | -// Verifies: STK-REQ-007 |
| 7848 | -// MCDC STK-REQ-007: N/A |
| 7849 | -func BenchmarkJsonParserEachKeyManualSmall(b *testing.B) { |
| 7850 | - paths := [][]string{ |
| 7851 | - []string{"uuid"}, |
| 7852 | - []string{"tz"}, |
| 7853 | - []string{"ua"}, |
| 7854 | - []string{"st"}, |
| 7855 | - } |
| 7856 | - |
| 7857 | - for i := 0; i < b.N; i++ { |
| 7858 | - jsonparser.EachKey(smallFixture, func(idx int, value []byte, vt jsonparser.ValueType, err error) { |
| 7859 | - switch idx { |
| 7860 | - case 0: |
| 7861 | - // jsonparser.ParseString(value) |
| 7862 | - case 1: |
| 7863 | - jsonparser.ParseInt(value) |
| 7864 | - case 2: |
| 7865 | - // jsonparser.ParseString(value) |
| 7866 | - case 3: |
| 7867 | - jsonparser.ParseInt(value) |
| 7868 | - } |
| 7869 | - }, paths...) |
| 7870 | - } |
| 7871 | -} |
| 7872 | - |
| 7873 | -// Verifies: STK-REQ-001 |
| 7874 | -// MCDC STK-REQ-001: N/A |
| 7875 | -// Verifies: STK-REQ-003 |
| 7876 | -// MCDC STK-REQ-003: N/A |
| 7877 | -// Verifies: STK-REQ-004 |
| 7878 | -// MCDC STK-REQ-004: N/A |
| 7879 | -// Verifies: STK-REQ-005 |
| 7880 | -// MCDC STK-REQ-005: N/A |
| 7881 | -// Verifies: STK-REQ-007 |
| 7882 | -// MCDC STK-REQ-007: N/A |
| 7883 | -func BenchmarkJsonParserEachKeyStructSmall(b *testing.B) { |
| 7884 | - paths := [][]string{ |
| 7885 | - []string{"uuid"}, |
| 7886 | - []string{"tz"}, |
| 7887 | - []string{"ua"}, |
| 7888 | - []string{"st"}, |
| 7889 | - } |
| 7890 | - |
| 7891 | - for i := 0; i < b.N; i++ { |
| 7892 | - var data SmallPayload |
| 7893 | - |
| 7894 | - jsonparser.EachKey(smallFixture, func(idx int, value []byte, vt jsonparser.ValueType, err error) { |
| 7895 | - switch idx { |
| 7896 | - case 0: |
| 7897 | - data.Uuid, _ = jsonparser.ParseString(value) |
| 7898 | - case 1: |
| 7899 | - v, _ := jsonparser.ParseInt(value) |
| 7900 | - data.Tz = int(v) |
| 7901 | - case 2: |
| 7902 | - data.Ua, _ = jsonparser.ParseString(value) |
| 7903 | - case 3: |
| 7904 | - v, _ := jsonparser.ParseInt(value) |
| 7905 | - data.St = int(v) |
| 7906 | - } |
| 7907 | - }, paths...) |
| 7908 | - |
| 7909 | - nothing(data.Uuid, data.Tz, data.Ua, data.St) |
| 7910 | - } |
| 7911 | -} |
| 7912 | - |
| 7913 | -// Verifies: STK-REQ-001 |
| 7914 | -// MCDC STK-REQ-001: N/A |
| 7915 | -// Verifies: STK-REQ-003 |
| 7916 | -// MCDC STK-REQ-003: N/A |
| 7917 | -// Verifies: STK-REQ-004 |
| 7918 | -// MCDC STK-REQ-004: N/A |
| 7919 | -// Verifies: STK-REQ-005 |
| 7920 | -// MCDC STK-REQ-005: N/A |
| 7921 | -// Verifies: STK-REQ-007 |
| 7922 | -// MCDC STK-REQ-007: N/A |
| 7923 | -func BenchmarkJsonParserObjectEachStructSmall(b *testing.B) { |
| 7924 | - uuidKey, tzKey, uaKey, stKey := []byte("uuid"), []byte("tz"), []byte("ua"), []byte("st") |
| 7925 | - errStop := errors.New("stop") |
| 7926 | - |
| 7927 | - for i := 0; i < b.N; i++ { |
| 7928 | - var data SmallPayload |
| 7929 | - |
| 7930 | - missing := 4 |
| 7931 | - |
| 7932 | - jsonparser.ObjectEach(smallFixture, func(key, value []byte, vt jsonparser.ValueType, off int) error { |
| 7933 | - switch { |
| 7934 | - case bytes.Equal(key, uuidKey): |
| 7935 | - data.Uuid, _ = jsonparser.ParseString(value) |
| 7936 | - missing-- |
| 7937 | - case bytes.Equal(key, tzKey): |
| 7938 | - v, _ := jsonparser.ParseInt(value) |
| 7939 | - data.Tz = int(v) |
| 7940 | - missing-- |
| 7941 | - case bytes.Equal(key, uaKey): |
| 7942 | - data.Ua, _ = jsonparser.ParseString(value) |
| 7943 | - missing-- |
| 7944 | - case bytes.Equal(key, stKey): |
| 7945 | - v, _ := jsonparser.ParseInt(value) |
| 7946 | - data.St = int(v) |
| 7947 | - missing-- |
| 7948 | - } |
| 7949 | - |
| 7950 | - if missing == 0 { |
| 7951 | - return errStop |
| 7952 | - } else { |
| 7953 | - return nil |
| 7954 | - } |
| 7955 | - }) |
| 7956 | - |
| 7957 | - nothing(data.Uuid, data.Tz, data.Ua, data.St) |
| 7958 | - } |
| 7959 | -} |
| 7960 | - |
| 7961 | -// Verifies: STK-REQ-001 |
| 7962 | -// MCDC STK-REQ-001: N/A |
| 7963 | -// Verifies: STK-REQ-003 |
| 7964 | -// MCDC STK-REQ-003: N/A |
| 7965 | -// Verifies: STK-REQ-004 |
| 7966 | -// MCDC STK-REQ-004: N/A |
| 7967 | -// Verifies: STK-REQ-005 |
| 7968 | -// MCDC STK-REQ-005: N/A |
| 7969 | -// Verifies: STK-REQ-007 |
| 7970 | -// MCDC STK-REQ-007: N/A |
| 7971 | -func BenchmarkJsonParserSetSmall(b *testing.B) { |
| 7972 | - for i := 0; i < b.N; i++ { |
| 7973 | - jsonparser.Set(smallFixture, []byte(`"c90927dd-1588-4fe7-a14f-8a8950cfcbd8"`), "uuid") |
| 7974 | - jsonparser.Set(smallFixture, []byte("-3"), "tz") |
| 7975 | - jsonparser.Set(smallFixture, []byte(`"server_agent"`), "ua") |
| 7976 | - jsonparser.Set(smallFixture, []byte("3"), "st") |
| 7977 | - |
| 7978 | - nothing() |
| 7979 | - } |
| 7980 | -} |
| 7981 | - |
| 7982 | -// Verifies: STK-REQ-001 |
| 7983 | -// MCDC STK-REQ-001: N/A |
| 7984 | -// Verifies: STK-REQ-003 |
| 7985 | -// MCDC STK-REQ-003: N/A |
| 7986 | -// Verifies: STK-REQ-004 |
| 7987 | -// MCDC STK-REQ-004: N/A |
| 7988 | -// Verifies: STK-REQ-005 |
| 7989 | -// MCDC STK-REQ-005: N/A |
| 7990 | -// Verifies: STK-REQ-007 |
| 7991 | -// MCDC STK-REQ-007: N/A |
| 7992 | -func BenchmarkJsonParserDelSmall(b *testing.B) { |
| 7993 | - fixture := make([]byte, 0, len(smallFixture)) |
| 7994 | - b.ResetTimer() |
| 7995 | - for i := 0; i < b.N; i++ { |
| 7996 | - fixture = append(fixture[:0], smallFixture...) |
| 7997 | - fixture = jsonparser.Delete(fixture, "uuid") |
| 7998 | - fixture = jsonparser.Delete(fixture, "tz") |
| 7999 | - fixture = jsonparser.Delete(fixture, "ua") |
| 8000 | - fixture = jsonparser.Delete(fixture, "stt") |
| 8001 | - |
| 8002 | - nothing() |
| 8003 | - } |
| 8004 | -} |
| 8005 | - |
| 8006 | -/* |
| 8007 | - encoding/json |
| 8008 | -*/ |
| 8009 | -// Verifies: STK-REQ-001 |
| 8010 | -// MCDC STK-REQ-001: N/A |
| 8011 | -// Verifies: STK-REQ-003 |
| 8012 | -// MCDC STK-REQ-003: N/A |
| 8013 | -// Verifies: STK-REQ-004 |
| 8014 | -// MCDC STK-REQ-004: N/A |
| 8015 | -// Verifies: STK-REQ-005 |
| 8016 | -// MCDC STK-REQ-005: N/A |
| 8017 | -// Verifies: STK-REQ-007 |
| 8018 | -// MCDC STK-REQ-007: N/A |
| 8019 | -func BenchmarkEncodingJsonStructSmall(b *testing.B) { |
| 8020 | - for i := 0; i < b.N; i++ { |
| 8021 | - var data SmallPayload |
| 8022 | - json.Unmarshal(smallFixture, &data) |
| 8023 | - |
| 8024 | - nothing(data.Uuid, data.Tz, data.Ua, data.St) |
| 8025 | - } |
| 8026 | -} |
| 8027 | - |
| 8028 | -// Verifies: STK-REQ-001 |
| 8029 | -// MCDC STK-REQ-001: N/A |
| 8030 | -// Verifies: STK-REQ-003 |
| 8031 | -// MCDC STK-REQ-003: N/A |
| 8032 | -// Verifies: STK-REQ-004 |
| 8033 | -// MCDC STK-REQ-004: N/A |
| 8034 | -// Verifies: STK-REQ-005 |
| 8035 | -// MCDC STK-REQ-005: N/A |
| 8036 | -// Verifies: STK-REQ-007 |
| 8037 | -// MCDC STK-REQ-007: N/A |
| 8038 | -func BenchmarkEncodingJsonInterfaceSmall(b *testing.B) { |
| 8039 | - for i := 0; i < b.N; i++ { |
| 8040 | - var data interface{} |
| 8041 | - json.Unmarshal(smallFixture, &data) |
| 8042 | - m := data.(map[string]interface{}) |
| 8043 | - |
| 8044 | - nothing(m["uuid"].(string), m["tz"].(float64), m["ua"].(string), m["st"].(float64)) |
| 8045 | - } |
| 8046 | -} |
| 8047 | - |
| 8048 | -/* |
| 8049 | - github.com/Jeffail/gabs |
| 8050 | -*/ |
| 8051 | -// Verifies: STK-REQ-001 |
| 8052 | -// MCDC STK-REQ-001: N/A |
| 8053 | -// Verifies: STK-REQ-003 |
| 8054 | -// MCDC STK-REQ-003: N/A |
| 8055 | -// Verifies: STK-REQ-004 |
| 8056 | -// MCDC STK-REQ-004: N/A |
| 8057 | -// Verifies: STK-REQ-005 |
| 8058 | -// MCDC STK-REQ-005: N/A |
| 8059 | -// Verifies: STK-REQ-007 |
| 8060 | -// MCDC STK-REQ-007: N/A |
| 8061 | -func BenchmarkGabsSmall(b *testing.B) { |
| 8062 | - for i := 0; i < b.N; i++ { |
| 8063 | - json, _ := gabs.ParseJSON(smallFixture) |
| 8064 | - |
| 8065 | - nothing( |
| 8066 | - json.Path("uuid").Data().(string), |
| 8067 | - json.Path("tz").Data().(float64), |
| 8068 | - json.Path("ua").Data().(string), |
| 8069 | - json.Path("st").Data().(float64), |
| 8070 | - ) |
| 8071 | - } |
| 8072 | -} |
| 8073 | - |
| 8074 | -/* |
| 8075 | - github.com/bitly/go-simplejson |
| 8076 | -*/ |
| 8077 | -// Verifies: STK-REQ-001 |
| 8078 | -// MCDC STK-REQ-001: N/A |
| 8079 | -// Verifies: STK-REQ-003 |
| 8080 | -// MCDC STK-REQ-003: N/A |
| 8081 | -// Verifies: STK-REQ-004 |
| 8082 | -// MCDC STK-REQ-004: N/A |
| 8083 | -// Verifies: STK-REQ-005 |
| 8084 | -// MCDC STK-REQ-005: N/A |
| 8085 | -// Verifies: STK-REQ-007 |
| 8086 | -// MCDC STK-REQ-007: N/A |
| 8087 | -func BenchmarkGoSimplejsonSmall(b *testing.B) { |
| 8088 | - for i := 0; i < b.N; i++ { |
| 8089 | - json, _ := simplejson.NewJson(smallFixture) |
| 8090 | - |
| 8091 | - json.Get("uuid").String() |
| 8092 | - json.Get("tz").Float64() |
| 8093 | - json.Get("ua").String() |
| 8094 | - json.Get("st").Float64() |
| 8095 | - |
| 8096 | - nothing() |
| 8097 | - } |
| 8098 | -} |
| 8099 | - |
| 8100 | -// Verifies: STK-REQ-001 |
| 8101 | -// MCDC STK-REQ-001: N/A |
| 8102 | -// Verifies: STK-REQ-003 |
| 8103 | -// MCDC STK-REQ-003: N/A |
| 8104 | -// Verifies: STK-REQ-004 |
| 8105 | -// MCDC STK-REQ-004: N/A |
| 8106 | -// Verifies: STK-REQ-005 |
| 8107 | -// MCDC STK-REQ-005: N/A |
| 8108 | -// Verifies: STK-REQ-007 |
| 8109 | -// MCDC STK-REQ-007: N/A |
| 8110 | -func BenchmarkGoSimplejsonSetSmall(b *testing.B) { |
| 8111 | - for i := 0; i < b.N; i++ { |
| 8112 | - json, _ := simplejson.NewJson(smallFixture) |
| 8113 | - |
| 8114 | - json.SetPath([]string{"uuid"}, "c90927dd-1588-4fe7-a14f-8a8950cfcbd8") |
| 8115 | - json.SetPath([]string{"tz"}, -3) |
| 8116 | - json.SetPath([]string{"ua"}, "server_agent") |
| 8117 | - json.SetPath([]string{"st"}, 3) |
| 8118 | - |
| 8119 | - nothing() |
| 8120 | - } |
| 8121 | -} |
| 8122 | - |
| 8123 | -/* |
| 8124 | - github.com/pquerna/ffjson |
| 8125 | -*/ |
| 8126 | -// Verifies: STK-REQ-001 |
| 8127 | -// MCDC STK-REQ-001: N/A |
| 8128 | -// Verifies: STK-REQ-003 |
| 8129 | -// MCDC STK-REQ-003: N/A |
| 8130 | -// Verifies: STK-REQ-004 |
| 8131 | -// MCDC STK-REQ-004: N/A |
| 8132 | -// Verifies: STK-REQ-005 |
| 8133 | -// MCDC STK-REQ-005: N/A |
| 8134 | -// Verifies: STK-REQ-007 |
| 8135 | -// MCDC STK-REQ-007: N/A |
| 8136 | -func BenchmarkFFJsonSmall(b *testing.B) { |
| 8137 | - for i := 0; i < b.N; i++ { |
| 8138 | - var data SmallPayload |
| 8139 | - ffjson.Unmarshal(smallFixture, &data) |
| 8140 | - |
| 8141 | - nothing(data.Uuid, data.Tz, data.Ua, data.St) |
| 8142 | - } |
| 8143 | -} |
| 8144 | - |
| 8145 | -/* |
| 8146 | - github.com/bitly/go-simplejson |
| 8147 | -*/ |
| 8148 | -// Verifies: STK-REQ-001 |
| 8149 | -// MCDC STK-REQ-001: N/A |
| 8150 | -// Verifies: STK-REQ-003 |
| 8151 | -// MCDC STK-REQ-003: N/A |
| 8152 | -// Verifies: STK-REQ-004 |
| 8153 | -// MCDC STK-REQ-004: N/A |
| 8154 | -// Verifies: STK-REQ-005 |
| 8155 | -// MCDC STK-REQ-005: N/A |
| 8156 | -// Verifies: STK-REQ-007 |
| 8157 | -// MCDC STK-REQ-007: N/A |
| 8158 | -func BenchmarkJasonSmall(b *testing.B) { |
| 8159 | - for i := 0; i < b.N; i++ { |
| 8160 | - json, _ := jason.NewObjectFromBytes(smallFixture) |
| 8161 | - |
| 8162 | - json.GetString("uuid") |
| 8163 | - json.GetFloat64("tz") |
| 8164 | - json.GetString("ua") |
| 8165 | - json.GetFloat64("st") |
| 8166 | - |
| 8167 | - nothing() |
| 8168 | - } |
| 8169 | -} |
| 8170 | - |
| 8171 | -/* |
| 8172 | - github.com/mreiferson/go-ujson |
| 8173 | -*/ |
| 8174 | -// Verifies: STK-REQ-001 |
| 8175 | -// MCDC STK-REQ-001: N/A |
| 8176 | -// Verifies: STK-REQ-003 |
| 8177 | -// MCDC STK-REQ-003: N/A |
| 8178 | -// Verifies: STK-REQ-004 |
| 8179 | -// MCDC STK-REQ-004: N/A |
| 8180 | -// Verifies: STK-REQ-005 |
| 8181 | -// MCDC STK-REQ-005: N/A |
| 8182 | -// Verifies: STK-REQ-007 |
| 8183 | -// MCDC STK-REQ-007: N/A |
| 8184 | -func BenchmarkUjsonSmall(b *testing.B) { |
| 8185 | - for i := 0; i < b.N; i++ { |
| 8186 | - json, _ := ujson.NewFromBytes(smallFixture) |
| 8187 | - |
| 8188 | - json.Get("uuid").String() |
| 8189 | - json.Get("tz").Float64() |
| 8190 | - json.Get("ua").String() |
| 8191 | - json.Get("st").Float64() |
| 8192 | - |
| 8193 | - nothing() |
| 8194 | - } |
| 8195 | -} |
| 8196 | - |
| 8197 | -/* |
| 8198 | - github.com/a8m/djson |
| 8199 | -*/ |
| 8200 | -// Verifies: STK-REQ-001 |
| 8201 | -// MCDC STK-REQ-001: N/A |
| 8202 | -// Verifies: STK-REQ-003 |
| 8203 | -// MCDC STK-REQ-003: N/A |
| 8204 | -// Verifies: STK-REQ-004 |
| 8205 | -// MCDC STK-REQ-004: N/A |
| 8206 | -// Verifies: STK-REQ-005 |
| 8207 | -// MCDC STK-REQ-005: N/A |
| 8208 | -// Verifies: STK-REQ-007 |
| 8209 | -// MCDC STK-REQ-007: N/A |
| 8210 | -func BenchmarkDjsonSmall(b *testing.B) { |
| 8211 | - for i := 0; i < b.N; i++ { |
| 8212 | - m, _ := djson.DecodeObject(smallFixture) |
| 8213 | - nothing(m["uuid"].(string), m["tz"].(float64), m["ua"].(string), m["st"].(float64)) |
| 8214 | - } |
| 8215 | -} |
| 8216 | - |
| 8217 | -/* |
| 8218 | - github.com/ugorji/go/codec |
| 8219 | -*/ |
| 8220 | -// Verifies: STK-REQ-001 |
| 8221 | -// MCDC STK-REQ-001: N/A |
| 8222 | -// Verifies: STK-REQ-003 |
| 8223 | -// MCDC STK-REQ-003: N/A |
| 8224 | -// Verifies: STK-REQ-004 |
| 8225 | -// MCDC STK-REQ-004: N/A |
| 8226 | -// Verifies: STK-REQ-005 |
| 8227 | -// MCDC STK-REQ-005: N/A |
| 8228 | -// Verifies: STK-REQ-007 |
| 8229 | -// MCDC STK-REQ-007: N/A |
| 8230 | -func BenchmarkUgirjiSmall(b *testing.B) { |
| 8231 | - for i := 0; i < b.N; i++ { |
| 8232 | - decoder := codec.NewDecoderBytes(smallFixture, new(codec.JsonHandle)) |
| 8233 | - data := new(SmallPayload) |
| 8234 | - data.CodecDecodeSelf(decoder) |
| 8235 | - |
| 8236 | - nothing(data.Uuid, data.Tz, data.Ua, data.St) |
| 8237 | - } |
| 8238 | -} |
| 8239 | - |
| 8240 | -/* |
| 8241 | - github.com/mailru/easyjson |
| 8242 | -*/ |
| 8243 | -// Verifies: STK-REQ-001 |
| 8244 | -// MCDC STK-REQ-001: N/A |
| 8245 | -// Verifies: STK-REQ-003 |
| 8246 | -// MCDC STK-REQ-003: N/A |
| 8247 | -// Verifies: STK-REQ-004 |
| 8248 | -// MCDC STK-REQ-004: N/A |
| 8249 | -// Verifies: STK-REQ-005 |
| 8250 | -// MCDC STK-REQ-005: N/A |
| 8251 | -// Verifies: STK-REQ-007 |
| 8252 | -// MCDC STK-REQ-007: N/A |
| 8253 | -func BenchmarkEasyJsonSmall(b *testing.B) { |
| 8254 | - for i := 0; i < b.N; i++ { |
| 8255 | - lexer := &jlexer.Lexer{Data: smallFixture} |
| 8256 | - data := new(SmallPayload) |
| 8257 | - data.UnmarshalEasyJSON(lexer) |
| 8258 | - |
| 8259 | - nothing(data.Uuid, data.Tz, data.Ua, data.St) |
| 8260 | - } |
| 8261 | -} |
| 8262 | --- a/benchmark/benchmark_delete_test.go |
| 8263 | +++ /dev/null |
| 8264 | @@ -1,40 +0,0 @@ |
| 8265 | -package benchmark |
| 8266 | - |
| 8267 | -import ( |
| 8268 | - "testing" |
| 8269 | - |
| 8270 | - "github.com/buger/jsonparser" |
| 8271 | -) |
| 8272 | - |
| 8273 | -// Verifies: STK-REQ-005 |
| 8274 | -// MCDC STK-REQ-005: N/A |
| 8275 | -func BenchmarkDeleteSmall(b *testing.B) { |
| 8276 | - b.ReportAllocs() |
| 8277 | - b.ResetTimer() |
| 8278 | - for i := 0; i < b.N; i++ { |
| 8279 | - data1 := []byte(`{ "instanceId": 1, "ip": "10.10.10.10", "services": [ { "id": 1, "name": "srv1" } ] }`) |
| 8280 | - _ = jsonparser.Delete(data1, "services") |
| 8281 | - } |
| 8282 | -} |
| 8283 | - |
| 8284 | -// Verifies: STK-REQ-005 |
| 8285 | -// MCDC STK-REQ-005: N/A |
| 8286 | -func BenchmarkDeleteNested(b *testing.B) { |
| 8287 | - b.ReportAllocs() |
| 8288 | - b.ResetTimer() |
| 8289 | - for i := 0; i < b.N; i++ { |
| 8290 | - data1 := []byte(`{ "instanceId": 1, "ip": "10.10.10.10", "services": [ { "id": 1, "name": "srv1" } ] }`) |
| 8291 | - _ = jsonparser.Delete(data1, "services", "id") |
| 8292 | - } |
| 8293 | -} |
| 8294 | - |
| 8295 | -// Verifies: STK-REQ-005 |
| 8296 | -// MCDC STK-REQ-005: N/A |
| 8297 | -func BenchmarkDeleteLarge(b *testing.B) { |
| 8298 | - b.ReportAllocs() |
| 8299 | - b.ResetTimer() |
| 8300 | - for i := 0; i < b.N; i++ { |
| 8301 | - data1 := []byte(`{"adsEnabled":true,"assetGroup":{"id":"4131","logoURL":"https://www.gannett-cdn.com/sites/usatoday/images/blogs/talkingtech/logo_front_v2.png","name":"talkingtech","siteCode":"USAT","siteId":"1","siteName":"USA TODAY","sstsId":"c67ad92a-3c9b-4817-9030-9357a9c2a86e","type":"blog","URL":"/tech/talkingtech"},"authoringBehavior":"text","authoringTypeCode":"blog","awsPath":"tech/talkingtech","backfillDate":"2018-10-30T14:56:31.522Z","byline":"Mike Snider","contentProtectionState":"free","contentSourceCode":"USAT","contributors":[{"id":"1071","name":"Mike Snider"}],"createDate":"2018-10-30T13:58:41.194Z","createSystem":"Presto Next","createUser":"msnider","eventDate":"2018-10-30T15:09:50.43Z","excludeFromMobile":false,"fronts":[{"id":"206","name":"tech","recommendedDate":"2018-10-30T15:09:50.399Z","type":"section-front"},{"id":"1012186","name":"tech_talkingtech","recommendedDate":"2018-10-30T15:09:50.399Z","type":"section-front"},{"id":"196","name":"money","recommendedDate":"2018-10-30T15:09:50.399Z","type":"section-front"},{"id":"156","name":"home","recommendedDate":"2018-10-30T15:09:50.399Z","type":"section-front"},{"id":"156","name":"home","recommendedDate":"2018-10-30T15:09:50.399Z","type":"section-front"}],"geoTag":{"attributes":{"lat":"","long":""},"id":""},"headline":"'Red Dead Redemption 2' rakes in $725M for Rockstar Games in blockbuster weekend debut","id":"1817435002","initialPublishDate":"2018-10-30T14:56:31.522Z","isEvergreen":false,"links":{"assets":[{"id":"1763879002","overrides":{},"position":1,"relationshipTypeFlags":"PromoImage"},{"id":"1764652002","overrides":{},"position":2,"relationshipTypeFlags":"Undefined"},{"id":"1765924002","overrides":{},"position":3,"relationshipTypeFlags":"Undefined"}],"photoId":"1763879002"},"pageURL":{"long":"http://www.usatoday.com/story/tech/talkingtech/2018/10/30/red-dead-redemption-2-makes-725-million-debut-rockstar-games/1817435002/","short":"http://www.usatoday.com/story/tech/talkingtech/2018/10/30/red-dead-redemption-2-makes-725-million-debut-rockstar-games/1817435002/"},"promoBrief":"Video game \"Red Dead Redemption 2\" corralled blockbuster sales of $725 million in its first three days, according to publisher Rockstar Games.","propertyDisplayName":"USA TODAY","propertyId":"1","propertyName":"USATODAY","publication":"USA TODAY","publishDate":"2018-10-30T15:09:50.399Z","publishSystem":"authoring","publishUser":"geronimo-publish-handler","readerCommentsEnabled":false,"schemaVersion":"0.11.20","shortHeadline":"'Red Dead Redemption 2' corrals $725M in sales","source":"USA TODAY","ssts":{"leafName":"talkingtech","path":"tech/talkingtech","section":"tech","subsection":"talkingtech","taxonomyEntityDisplayName":"Talking Tech","topic":"","subtopic":""},"statusName":"published","tags":[{"id":"855b0686-b2d8-4d98-b5f4-fcacf713047b","isPrimary":true,"name":"Talking Tech","path":"USAT TOPICS/USAT Science and technology/Talking Tech","taggingStatus":"UserTagged","vocabulary":"Topics"},{"id":"5dd5b5f2-9594-4aae-83c8-1ebb8aa50767","name":"Rockstar Games","path":"Candidates/Rockstar Games","taggingStatus":"UserTagged","vocabulary":"Companies"},{"id":"ceff0ffa-451d-46ae-8c4f-f958264b165e","name":"Video Games","path":"Consumer Products/Video Games","taggingStatus":"UserTagged","vocabulary":"Subjects"},{"id":"d59ddfbc-2afe-40e3-a9a2-5debe530dc5f","name":"Redemption","path":"Religious Organizations/Redemption","taggingStatus":"AutoTagged","vocabulary":"Organizations"},{"id":"09f4e1a7-50e7-4fc5-b318-d300acc4718f","name":"Success","path":"Emotions/Success","taggingStatus":"AutoTagged","vocabulary":"SubjectCodes"},{"id":"7095bb07-b172-434b-a4eb-8856263ad949","name":"Overall Positive","path":"Emotions/Overall Positive","taggingStatus":"AutoTagged","vocabulary":"SubjectCodes"},{"id":"d2cb2465-3a24-4104-8569-31785b515f62","name":"Sony","path":"Corporations/Sony","taggingStatus":"AutoTagged","vocabulary":"Companies"},{"id":"9b993d1c-2a6d-4279-acb3-ecac95d77320","name":"Amusement","path":"Emotions/Amusement","taggingStatus":"AutoTagged","vocabulary":"SubjectCodes"}],"title":"Red Dead Redemption 2 makes $725 million in debut for Rockstar Games","updateDate":"2018-10-30T15:09:50.43Z","updateUser":"mhayes","aggregateId":"acba765c-c573-42af-929f-26ea5920b932","body":{"desktop":[{"type":"asset","value":"1763879002"},{"type":"text","value":"<p>Rockstar Games has another hard-boiled hit on its hands.</p>"},{"type":"text","value":"<p>Old West adventure game "Red Dead Redemption 2," which landed Friday, lassoed $725 million in sales worldwide in its first three days.</p>"},{"type":"text","value":"<p>That places the massive explorable open-world game as the No. 2 game out of the gate, just behind Rockstar's "Grand Theft Auto V," the biggest seller of all time, which took in $1 billion in its first three days when it launched on Sept. 17, 2013.</p>"},{"type":"text","value":"<p>"GTA V" has gone on to make more money than any other single game title, selling nearly 100 million copies and reaping $6 billion in revenue, according to <a href=\"https://www.marketwatch.com/story/this-violent-videogame-has-made-more-money-than-any-movie-ever-2018-04-06\">MarketWatch</a>.</p>"},{"type":"text","value":"<p>The three-day start makes "Red Dead Redemption 2" the single-biggest opening weekend in "the history of entertainment," Rockstar said in a press release detailing the game's achievements. That means the three-day sales for the game, prices of which start at $59.99 (rated Mature for those 17-up), surpasses opening weekends for blockbuster movies such as "Avengers: Infinity War" and "Star Wars: The Force Awakens."</p>"},{"type":"text","value":"<p><span class=\"exclude-from-newsgate\"><strong style=\"margin-right:3px;\">More: </strong><a href=\"http://www.usatoday.com/story/tech/gaming/2018/10/26/red-dead-redemption-2-rockstar-games-western-classic/1650295002/\">'Red Dead Redemption 2': First impressions from once upon a time in the West</a></span><br/>\n<br/>\n<span class=\"exclude-from-newsgate\"><strong style=\"margin-right:3px;\">More: </strong><a href=\"http://www.usatoday.com/story/tech/talkingtech/2018/10/30/sony-playstation-classic-games-list/1816900002/\">Sony lists the 20 games coming to PlayStation Classic retro video game console</a></span></p>"},{"type":"text","value":"<p>"Red Dead Redemption 2" also tallied the biggest full game sales marks for one and for three days on Sony's PlayStation Network, Rockstar said. It was also the most preordered game on Sony's online network.</p>"},{"type":"text","value":"<p>Reviews for the game have rated it among the best ever. It earned a 97 on Metacritic, earning it a tie for No. 6 all-time, along with games such as "Super Mario Galaxy" and "GTA V." </p>"},{"type":"text","value":"<p>Piper Jaffray & Co. senior research analyst Michael Olson estimated Rockstar sold about 11 million copies in its first three days. That means Olson's initial estimate of Rockstar selling 15.5 million copies of "Red Dead 2" in its fiscal year, which ends in March 2019, "appears conservative," he said in a note to investors Tuesday.</p>"},{"type":"text","value":"<p>"Clearly, with RDR2 first weekend sell-through exceeding CoD: Black Ops 4, it now appears RDR2 estimates may have been overly conservative," Olson wrote.</p>"},{"type":"text","value":"<p>Shares of Rockstar’s parent company Take-Two Interactive (<a href=\"https://www.usatoday.com/money/lookup/stocks/TTWO/\">TTWO</a>) rose about 8 percent in early trading Tuesday to $120.55.</p>"},{"type":"asset","value":"1765924002"},{"type":"text","value":"<p><em>Follow USA TODAY reporter Mike Snider on Twitter: <a href=\"http://twitter.com/MikeSnider\">@MikeSnider</a>.</em></p>"}],"mobile":[{"type":"asset","value":"1763879002"},{"type":"text","value":"<p>Rockstar Games has another hard-boiled hit on its hands.</p>"},{"type":"text","value":"<p>Old West adventure game "Red Dead Redemption 2," which landed Friday, lassoed $725 million in sales worldwide in its first three days.</p>"},{"type":"text","value":"<p>That places the massive explorable open-world game as the No. 2 game out of the gate, just behind Rockstar's "Grand Theft Auto V," the biggest seller of all time, which took in $1 billion in its first three days when it launched on Sept. 17, 2013.</p>"},{"type":"text","value":"<p>"GTA V" has gone on to make more money than any other single game title, selling nearly 100 million copies and reaping $6 billion in revenue, according to <a href=\"https://www.marketwatch.com/story/this-violent-videogame-has-made-more-money-than-any-movie-ever-2018-04-06\">MarketWatch</a>.</p>"},{"type":"text","value":"<p>The three-day start makes "Red Dead Redemption 2" the single-biggest opening weekend in "the history of entertainment," Rockstar said in a press release detailing the game's achievements. That means the three-day sales for the game, prices of which start at $59.99 (rated Mature for those 17-up), surpasses opening weekends for blockbuster movies such as "Avengers: Infinity War" and "Star Wars: The Force Awakens."</p>"},{"type":"text","value":"<p><span class=\"exclude-from-newsgate\"><strong style=\"margin-right:3px;\">More: </strong><a href=\"http://www.usatoday.com/story/tech/gaming/2018/10/26/red-dead-redemption-2-rockstar-games-western-classic/1650295002/\">'Red Dead Redemption 2': First impressions from once upon a time in the West</a></span><br/>\n<br/>\n<span class=\"exclude-from-newsgate\"><strong style=\"margin-right:3px;\">More: </strong><a href=\"http://www.usatoday.com/story/tech/talkingtech/2018/10/30/sony-playstation-classic-games-list/1816900002/\">Sony lists the 20 games coming to PlayStation Classic retro video game console</a></span></p>"},{"type":"text","value":"<p>"Red Dead Redemption 2" also tallied the biggest full game sales marks for one and for three days on Sony's PlayStation Network, Rockstar said. It was also the most preordered game on Sony's online network.</p>"},{"type":"text","value":"<p>Reviews for the game have rated it among the best ever. It earned a 97 on Metacritic, earning it a tie for No. 6 all-time, along with games such as "Super Mario Galaxy" and "GTA V." </p>"},{"type":"text","value":"<p>Piper Jaffray & Co. senior research analyst Michael Olson estimated Rockstar sold about 11 million copies in its first three days. That means Olson's initial estimate of Rockstar selling 15.5 million copies of "Red Dead 2" in its fiscal year, which ends in March 2019, "appears conservative," he said in a note to investors Tuesday.</p>"},{"type":"text","value":"<p>"Clearly, with RDR2 first weekend sell-through exceeding CoD: Black Ops 4, it now appears RDR2 estimates may have been overly conservative," Olson wrote.</p>"},{"type":"text","value":"<p>Shares of Rockstar’s parent company Take-Two Interactive (<a href=\"https://www.usatoday.com/money/lookup/stocks/TTWO/\">TTWO</a>) rose about 8 percent in early trading Tuesday to $120.55.</p>"},{"type":"asset","value":"1765924002"},{"type":"text","value":"<p><em>Follow USA TODAY reporter Mike Snider on Twitter: <a href=\"http://twitter.com/MikeSnider\">@MikeSnider</a>.</em></p>"}]},"fullText":"<p><img assetid=\"1763879002\" assettype=\"image\"/></p>\n\n<p>Rockstar Games has another hard-boiled hit on its hands.</p>\n\n<p>Old West adventure game "Red Dead Redemption 2," which landed Friday, lassoed $725 million in sales worldwide in its first three days.</p>\n\n<p>That places the massive explorable open-world game as the No. 2 game out of the gate, just behind Rockstar's "Grand Theft Auto V," the biggest seller of all time, which took in $1 billion in its first three days when it launched on Sept. 17, 2013.</p>\n\n<p>"GTA V" has gone on to make more money than any other single game title, selling nearly 100 million copies and reaping $6 billion in revenue, according to <a href=\"https://www.marketwatch.com/story/this-violent-videogame-has-made-more-money-than-any-movie-ever-2018-04-06\">MarketWatch</a>.</p>\n\n<p>The three-day start makes "Red Dead Redemption 2" the single-biggest opening weekend in "the history of entertainment," Rockstar said in a press release detailing the game's achievements. That means the three-day sales for the game, prices of which start at $59.99 (rated Mature for those 17-up), surpasses opening weekends for blockbuster movies such as "Avengers: Infinity War" and "Star Wars: The Force Awakens."</p>\n\n<p><span class=\"exclude-from-newsgate\"><strong style=\"margin-right:3px;\">More: </strong><a href=\"http://www.usatoday.com/story/tech/gaming/2018/10/26/red-dead-redemption-2-rockstar-games-western-classic/1650295002/\">'Red Dead Redemption 2': First impressions from once upon a time in the West</a></span><br/>\n<br/>\n<span class=\"exclude-from-newsgate\"><strong style=\"margin-right:3px;\">More: </strong><a href=\"http://www.usatoday.com/story/tech/talkingtech/2018/10/30/sony-playstation-classic-games-list/1816900002/\">Sony lists the 20 games coming to PlayStation Classic retro video game console</a></span></p>\n\n<p>"Red Dead Redemption 2" also tallied the biggest full game sales marks for one and for three days on Sony's PlayStation Network, Rockstar said. It was also the most preordered game on Sony's online network.</p>\n\n<p>Reviews for the game have rated it among the best ever. It earned a 97 on Metacritic, earning it a tie for No. 6 all-time, along with games such as "Super Mario Galaxy" and "GTA V." </p>\n\n<p>Piper Jaffray & Co. senior research analyst Michael Olson estimated Rockstar sold about 11 million copies in its first three days. That means Olson's initial estimate of Rockstar selling 15.5 million copies of "Red Dead 2" in its fiscal year, which ends in March 2019, "appears conservative," he said in a note to investors Tuesday.</p>\n\n<p>"Clearly, with RDR2 first weekend sell-through exceeding CoD: Black Ops 4, it now appears RDR2 estimates may have been overly conservative," Olson wrote.</p>\n\n<p>Shares of Rockstar’s parent company Take-Two Interactive (<a href=\"https://www.usatoday.com/money/lookup/stocks/TTWO/\">TTWO</a>) rose about 8 percent in early trading Tuesday to $120.55.</p>\n\n<p><img assetid=\"1765924002\" assettype=\"embed\"/></p>\n\n<p><em>Follow USA TODAY reporter Mike Snider on Twitter: <a href=\"http://twitter.com/MikeSnider\">@MikeSnider</a>.</em></p>\n","layoutPriorityAssetId":"1763879002","seoTitle":"Red Dead Redemption 2 makes $725 million in debut for Rockstar Games","type":"text","versionHash":"fe60306b2e7574a8d65e690753deb666"}`) |
| 8302 | - _ = jsonparser.Delete(data1, "body") |
| 8303 | - } |
| 8304 | -} |
| 8305 | --- a/benchmark/benchmark_set_test.go |
| 8306 | +++ /dev/null |
| 8307 | @@ -1,22 +0,0 @@ |
| 8308 | -package benchmark |
| 8309 | - |
| 8310 | -import ( |
| 8311 | - "github.com/buger/jsonparser" |
| 8312 | - "strconv" |
| 8313 | - "testing" |
| 8314 | -) |
| 8315 | - |
| 8316 | -// Verifies: STK-REQ-005 |
| 8317 | -// MCDC STK-REQ-005: N/A |
| 8318 | -func BenchmarkSetLarge(b *testing.B) { |
| 8319 | - b.ReportAllocs() |
| 8320 | - |
| 8321 | - keyPath := make([]string, 20000) |
| 8322 | - for i := range keyPath { |
| 8323 | - keyPath[i] = "keyPath" + strconv.Itoa(i) |
| 8324 | - } |
| 8325 | - b.ResetTimer() |
| 8326 | - for i := 0; i < b.N; i++ { |
| 8327 | - _, _ = jsonparser.Set(largeFixture, largeFixture, keyPath...) |
| 8328 | - } |
| 8329 | -} |