{"id":50871288,"url":"https://github.com/nsmkhn/rtbench","last_synced_at":"2026-06-15T05:30:45.339Z","repository":{"id":357025157,"uuid":"1228917548","full_name":"nsmkhn/rtbench","owner":"nsmkhn","description":"Companion source for the \"Go JSON Performance in AdTech: Profiling OpenRTB Bid Request Parsing\" blog post","archived":false,"fork":false,"pushed_at":"2026-05-11T00:32:33.000Z","size":2605,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-11T02:20:54.969Z","etag":null,"topics":["adtech","go","openrtb","performance"],"latest_commit_sha":null,"homepage":"https://tokarevxvi.dev/blog/go-json-performance-openrtb/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nsmkhn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-04T14:08:13.000Z","updated_at":"2026-05-11T00:32:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/nsmkhn/rtbench","commit_stats":null,"previous_names":["nsmkhn/rtbench"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/nsmkhn/rtbench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsmkhn%2Frtbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsmkhn%2Frtbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsmkhn%2Frtbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsmkhn%2Frtbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nsmkhn","download_url":"https://codeload.github.com/nsmkhn/rtbench/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nsmkhn%2Frtbench/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34349925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adtech","go","openrtb","performance"],"created_at":"2026-06-15T05:30:44.633Z","updated_at":"2026-06-15T05:30:45.333Z","avatar_url":"https://github.com/nsmkhn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rtbench [![CI](https://github.com/nsmkhn/rtbench/actions/workflows/ci.yml/badge.svg)](https://github.com/nsmkhn/rtbench/actions/workflows/ci.yml)\n\nOpenRTB 2.6 bid request parsing benchmarks in Go — comparing JSON library performance, profiling with pprof, and building a hand-written decoder with arm64 NEON and arena allocation.\n\nCompanion source for the blog series:\n- **[Go JSON Performance in AdTech: Profiling OpenRTB Bid Request Parsing](https://tokarevxvi.dev/blog/go-json-performance-openrtb/)** — profiling `encoding/json`, comparing `json-iterator` and `goccy/go-json`\n- **[Hand-Writing an OpenRTB JSON Decoder in Go](https://tokarevxvi.dev/blog/go-json-handwritten-openrtb/)** — lexer, `parseIntBytes`, NEON string scanning, arena allocation\n\n## Results\n\nApple M2 Pro, Go 1.26.2, `-bench=. -benchmem -count=5`, 804-byte banner bid request:\n\n| Implementation         | ns/op | B/op  | allocs/op |\n| ---------------------- | ----- | ----- | --------- |\n| `encoding/json`        | 7,685 | 1,840 | 49        |\n| `json-iterator`        | 2,185 | 1,456 | 48        |\n| `goccy/go-json`        | 1,590 | 1,963 | 23        |\n| `goccy/go-json` + pool | 1,514 | 1,804 | 22        |\n| `ParseFast`            | 1,360 | 968   | 19        |\n| `ParseFastArena`       | 1,245 | 392   | 14        |\n\nParallel throughput (10 goroutines):\n\n| Implementation         | ns/op |\n| ---------------------- | ----- |\n| `goccy/go-json` + pool | 876   |\n| `ParseFastArena`       | 348   |\n\n## Run\n\n**Benchmark suite:**\n\n```bash\ngo test -bench=. -benchmem -count=5 ./openrtb/\n```\n\n**CPU profile (stdlib):**\n\n```bash\ngo run ./cmd/profile\ngo tool pprof -top cpu.prof\n```\n\n**CPU profile (goccy/go-json):**\n\n```bash\ngo run ./cmd/profile -impl gojson\ngo tool pprof -top cpu.prof\n```\n\n## Structure\n\n```\nrtbench/\n├── openrtb/\n│   ├── types.go               # OpenRTB 2.6 struct definitions\n│   ├── parse.go               # Parse(), ParseFast(), ParseFastArena(), ReleaseArena()\n│   ├── lexer.go               # JSON lexer (zero-copy string scanning)\n│   ├── decoder.go             # Hand-written field decoder\n│   ├── arena.go               # Arena struct and pool management\n│   ├── indexstop_arm64.go     # indexStopByte stub (arm64)\n│   ├── indexstop_arm64.s      # NEON implementation\n│   ├── indexstop_generic.go   # Scalar fallback (!arm64)\n│   ├── parse_test.go          # Correctness tests\n│   ├── parse_bench_test.go    # Benchmark suite\n│   ├── decoder_test.go        # Decoder unit tests\n│   └── lexer_test.go          # Lexer unit tests\n├── cmd/\n│   └── profile/\n│       └── main.go            # pprof CPU profiler (200k iterations)\n└── testdata/\n    ├── valid_banner.json\n    └── valid_video.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsmkhn%2Frtbench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnsmkhn%2Frtbench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnsmkhn%2Frtbench/lists"}