{"id":17396833,"url":"https://github.com/faern/socketaddr-benchmark","last_synced_at":"2025-08-27T09:42:03.342Z","repository":{"id":90202606,"uuid":"310399823","full_name":"faern/socketaddr-benchmark","owner":"faern","description":"Benchmarks for different SocketAddr implementations https://internals.rust-lang.org/t/why-are-socketaddrv4-socketaddrv6-based-on-low-level-sockaddr-in-6/13321","archived":false,"fork":false,"pushed_at":"2020-11-06T19:37:07.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-17T15:44:40.408Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faern.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-11-05T19:38:53.000Z","updated_at":"2020-11-06T19:37:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"f05de68a-8e67-4e41-9856-4095b00715f3","html_url":"https://github.com/faern/socketaddr-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/faern/socketaddr-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faern%2Fsocketaddr-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faern%2Fsocketaddr-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faern%2Fsocketaddr-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faern%2Fsocketaddr-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faern","download_url":"https://codeload.github.com/faern/socketaddr-benchmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faern%2Fsocketaddr-benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272315574,"owners_count":24912600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"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":[],"created_at":"2024-10-16T13:13:25.404Z","updated_at":"2025-08-27T09:41:58.319Z","avatar_url":"https://github.com/faern.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SocketAddr representation and conversion benchmarks\n\nThis crate is for benchmarking the change in internal representation of `Ipv4Addr`, `Ipv6Addr`,\n`SocketAddrV4` and `SocketAddrV6` that is being discussed in [this internals thread].\n\n[this internals thread]: https://internals.rust-lang.org/t/why-are-socketaddrv4-socketaddrv6-based-on-low-level-sockaddr-in-6/13321\n\n## Usage\n\nTo print the memory usage of all the involved structs. So you can see how/if they change\nwith the other internal representation:\n\n```bash\ncargo run --bin print-mem\n```\n\nSpoiler: All sizes stay the same, except for `SocketAddrV4` that shrink from 16 to 6 bytes.\nAnd some alignments become lower.\n\nHow to run the Criterion benchmarks in [benches/socketaddr-benchmark.rs](benches/socketaddr-benchmark.rs):\n\n```bash\ncargo +the_toolchain bench\n```\n\nWhere `the_toolchain` is the Rust version you want to benchmark. I have built the latest master\nat the time of writing this and applied my patches on top of it, built it again and ran the\nbenchmarks again.\n\nBasically I did this:\n\n```bash\ncd $RUST_CHECKOUT\ngit checkout b1d9f31e043d0ba2782a4bb7416f18c4ba1c9044\n./x.py build --stage 2\nrustup toolchain link stage2 build/x86_64-unknown-linux-gnu/stage2\n\ncd $THIS_BENCHMARK_REPO\ncargo +stage2 bench\n\ncd $RUST_CHECKOUT\ngit checkout simplify-socketaddr\n./x.py build --stage 2\n\ncd $THIS_BENCHMARK_REPO\ncargo +stage2 bench\n```\n\nAnd then Criterion automatically shows regressions or performance improvements between runs.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaern%2Fsocketaddr-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaern%2Fsocketaddr-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaern%2Fsocketaddr-benchmark/lists"}