{"id":16985785,"url":"https://github.com/melonedo/singledispatcharrays.jl","last_synced_at":"2025-03-22T01:27:27.021Z","repository":{"id":126985072,"uuid":"384103217","full_name":"melonedo/SingleDispatchArrays.jl","owner":"melonedo","description":"Fast single dispatch for arrays of non-homogeneous elements.","archived":false,"fork":false,"pushed_at":"2021-07-08T15:36:07.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-26T19:37:14.261Z","etag":null,"topics":["julia","performance"],"latest_commit_sha":null,"homepage":"","language":"Julia","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/melonedo.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":"2021-07-08T11:35:13.000Z","updated_at":"2024-01-08T15:06:08.000Z","dependencies_parsed_at":"2023-06-19T14:20:59.966Z","dependency_job_id":null,"html_url":"https://github.com/melonedo/SingleDispatchArrays.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melonedo%2FSingleDispatchArrays.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melonedo%2FSingleDispatchArrays.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melonedo%2FSingleDispatchArrays.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melonedo%2FSingleDispatchArrays.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melonedo","download_url":"https://codeload.github.com/melonedo/SingleDispatchArrays.jl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244892307,"owners_count":20527424,"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","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":["julia","performance"],"created_at":"2024-10-14T02:44:11.298Z","updated_at":"2025-03-22T01:27:27.016Z","avatar_url":"https://github.com/melonedo.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SingleDispatchArrays.jl\nFast single dispatch for an array of non-homogeneous elements.\n\nSee discussions at [Union splitting vs C++](https://discourse.julialang.org/t/union-splitting-vs-c/61772/20). Because dynamic dispatch is a complicated search in Julia, where it is only a function pointer in C++, Julia has very bad performance with non-homogeneous array relative to C++. This performance drawback can be addressed by either manual or automatic union splitting or \"switch-case\", equivalently. SingleDispatchArrays.jl implements union splitting with generated function, with manual bookkeeping of possible subtypes.\n\nBenchmark on x86 cloud server:\n\n```\n\u003e cd benchmark\n\u003e g++ -o lines -O3 -march=native -W -Wall  lines.cpp \u0026\u0026 ./lines\nn = 1000000 \ndynamic dispatch : 0.012808 us per iteration (12.808000 ms total) [500006.610053]\n\n\u003e julia --project=.. lines.jl \nresult = 500261.127245642\n with runtime dispatch:   153.494 ms (2000000 allocations: 30.52 MiB)\n with splitting:   8.007 ms (0 allocations: 0 bytes)\n with SingleDispatchArrays.jl:   9.075 ms (2 allocations: 32 bytes)\n```\n\nThe result is common among my x86 machines, but on my Raspberry Pi 4B, the result is 10ms for splitting, 20ms for SingleDispatchArrays.jl and C++.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelonedo%2Fsingledispatcharrays.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelonedo%2Fsingledispatcharrays.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelonedo%2Fsingledispatcharrays.jl/lists"}