{"id":17724781,"url":"https://github.com/jibsen/spart-example","last_synced_at":"2026-05-01T15:32:23.082Z","repository":{"id":72895625,"uuid":"73195262","full_name":"jibsen/spart-example","owner":"jibsen","description":"Example code for Reordering Arguments blog post (www.hardtoc.com)","archived":false,"fork":false,"pushed_at":"2016-11-08T14:52:25.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-03T12:21:35.285Z","etag":null,"topics":["cpp","partitioning-algorithms"],"latest_commit_sha":null,"homepage":null,"language":"C","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/jibsen.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}},"created_at":"2016-11-08T14:44:35.000Z","updated_at":"2023-08-03T12:21:35.286Z","dependencies_parsed_at":null,"dependency_job_id":"8cc7830f-63db-45ee-a2e7-f7ab68cb0006","html_url":"https://github.com/jibsen/spart-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/jibsen/spart-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibsen%2Fspart-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibsen%2Fspart-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibsen%2Fspart-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibsen%2Fspart-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jibsen","download_url":"https://codeload.github.com/jibsen/spart-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jibsen%2Fspart-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32503075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["cpp","partitioning-algorithms"],"created_at":"2024-10-25T15:48:45.211Z","updated_at":"2026-05-01T15:32:23.055Z","avatar_url":"https://github.com/jibsen.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nStable Partitioning Examples\n============================\n\n`spart.hpp` contains example code in C++ for the stable partitioning algorithms\ndiscussed in the [Reordering Arguments][post] blog post.\n\n`spart_test` compares the output of the various partitioning functions to that\nof `std::stable_partition`.\n\n`spart_time` compares the execution time and number of predicate applications\nfor a vector of 1,000,000 elements. Here is the output from a MSVC compile,\noptimization turned on:\n\n    Timing all false:\n      std::stable_partition        11.13 ms (1000000 predicates)\n      stable_partition_recursive    7.49 ms (1000000 predicates)\n      stable_partition_bottomup     7.20 ms (1999998 predicates)\n      stable_partition_bsearch     13.33 ms (3999959 predicates)\n      stable_partition_natural      1.29 ms (1000000 predicates)\n\n    Timing all true:\n      std::stable_partition         2.09 ms (1000000 predicates)\n      stable_partition_recursive    7.93 ms (1000000 predicates)\n      stable_partition_bottomup    26.06 ms (19980544 predicates)\n      stable_partition_bsearch     13.54 ms (2999961 predicates)\n      stable_partition_natural      1.32 ms (1000000 predicates)\n\n    Timing first half false:\n      std::stable_partition         7.00 ms (1000000 predicates)\n      stable_partition_recursive   12.16 ms (1000000 predicates)\n      stable_partition_bottomup    21.66 ms (10980537 predicates)\n      stable_partition_bsearch     18.27 ms (3499955 predicates)\n      stable_partition_natural      6.13 ms (2000000 predicates)\n\n    Timing alternating false/true:\n      std::stable_partition         6.94 ms (1000000 predicates)\n      stable_partition_recursive   20.87 ms (1000000 predicates)\n      stable_partition_bottomup    37.17 ms (11490270 predicates)\n      stable_partition_bsearch     36.23 ms (3499961 predicates)\n      stable_partition_natural     41.18 ms (20000000 predicates)\n\n    Timing random:\n      std::stable_partition         9.53 ms (1000000 predicates)\n      stable_partition_recursive   30.10 ms (1000000 predicates)\n      stable_partition_bottomup    48.42 ms (11350257 predicates)\n      stable_partition_bsearch     45.86 ms (3457751 predicates)\n      stable_partition_natural     45.53 ms (19000000 predicates)\n\nSome observations from these results:\n\n  - bsearch uses between 3n and 4n predicate applications.\n  - bottomup and natural use worst-case around 20 million predicate\n    applications, which is n log n.\n  - natural expectedly performs well when few changes are needed.\n\n[post]: http://hardtoc.com/2016/11/07/reordering-arguments.html\n\n\nLicense\n-------\n\nThis projected is licensed under the terms of the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjibsen%2Fspart-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjibsen%2Fspart-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjibsen%2Fspart-example/lists"}