{"id":26272264,"url":"https://github.com/digitalinblue/priori","last_synced_at":"2025-05-05T16:30:13.200Z","repository":{"id":7540199,"uuid":"8892465","full_name":"DigitalInBlue/Priori","owner":"DigitalInBlue","description":"A fast C++ dynamic_cast\u003c\u003e alternative.","archived":false,"fork":false,"pushed_at":"2021-03-27T21:43:40.000Z","size":39,"stargazers_count":32,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T22:25:02.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.helleboreconsulting.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DigitalInBlue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-20T00:08:21.000Z","updated_at":"2024-11-25T21:50:22.000Z","dependencies_parsed_at":"2022-09-12T22:43:02.758Z","dependency_job_id":null,"html_url":"https://github.com/DigitalInBlue/Priori","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/DigitalInBlue%2FPriori","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalInBlue%2FPriori/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalInBlue%2FPriori/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DigitalInBlue%2FPriori/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DigitalInBlue","download_url":"https://codeload.github.com/DigitalInBlue/Priori/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252533626,"owners_count":21763624,"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":[],"created_at":"2025-03-14T07:18:00.729Z","updated_at":"2025-05-05T16:30:13.132Z","avatar_url":"https://github.com/DigitalInBlue.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Priori\n\n## C++ Fast dynamic_cast\u003c\u003e Alternative\n\nCopyright 2013-2021 John Farrier\nApache 2.0 License\n\n## Overview\n\nPriori is a special base class which facilitates a very fast `dynamic_cast\u003c\u003e` alternative when `dynamic_cast\u003c\u003e` itself has shown to be a bottleneck. Specifically in the case where `dynamic_cast\u003c\u003e` from a base class to a derived class is impacting performance.\n\nPriori is interesting, but not a wholesale replacement for `dynamic_cast`.  There are very specific use cases when Priori should be considered to relieve a quantified bottle-neck.  Benchmarking shows that the following scenarios show measurable improvements for non-threaded applications.  Review the benchmark tables below to see if there is a measurable performance improvement for your specific use case.  (There are several use cases which are slower than `dynamic_cast`, so consider this a highly-specialized micro-optimization.)\n\nPriori uses [CMake](https://github.com/Kitware/CMake) to provide cross-platform builds. It does require a modern compiler due to its use of C++11.\n\n## Benchmark\n\nGiven 10 levels of inheritance and benchmarked using [Celero](https://github.com/DigitalInBlue/Celero).  (Start by looking at the \"Baseline\" number.  Lower is better.)\n\nFor the non-thread-safe implementation:\n\n```\nCelero\nTimer resolution: 0.100000 us\n|     Group      |   Experiment    |   Prob. Space   |     Samples     |   Iterations    |    Baseline     |  us/Iteration   | Iterations/sec  |\n|:--------------:|:---------------:|:---------------:|:---------------:|:---------------:|:---------------:|:---------------:|:---------------:|\n|priori_deep_fro | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.01781 |     56143502.79 |\n|priori_wide_fro | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.01614 |     61973227.57 |\n|priori_deep_toB | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00464 |    215331610.68 |\n|priori_wide_toB | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00458 |    218150087.26 |\n|priori_deep_toS | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00498 |    200702458.61 |\n|priori_wide_toS | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00492 |    203417412.53 |\n|rttiCosts       | typeinfo        |            Null |             128 |         2000000 |         1.00000 |         0.00459 |    217983651.23 |\n|priori_deep_fro | priori_cast     |            Null |             128 |         2000000 |         0.78115 |         0.01391 |     71872641.68 |\n|priori_wide_fro | priori_cast     |            Null |             128 |         2000000 |         1.05311 |         0.01699 |     58847760.84 |\n|priori_deep_toB | priori_cast     |            Null |             128 |         2000000 |         0.97782 |         0.00454 |    220215811.50 |\n|priori_wide_toB | priori_cast     |            Null |             128 |         2000000 |         0.99247 |         0.00455 |    219804374.11 |\n|priori_deep_toS | priori_cast     |            Null |             128 |         2000000 |         0.91159 |         0.00454 |    220167327.17 |\n|priori_wide_toS | priori_cast     |            Null |             128 |         2000000 |         0.88314 |         0.00434 |    230335137.63 |\n|rttiCosts       | typeinfoHash    |            Null |             128 |         2000000 |         2.48262 |         0.01139 |     87804021.42 |\n|rttiCosts       | typeinfoName    |            Null |             128 |         2000000 |         1.39401 |         0.00639 |    156372165.75 |\n```\n\nFor the thread-safe implementation:\n\n```\nCelero\nTimer resolution: 0.100000 us\n|     Group      |   Experiment    |   Prob. Space   |     Samples     |   Iterations    |    Baseline     |  us/Iteration   | Iterations/sec  |\n|:--------------:|:---------------:|:---------------:|:---------------:|:---------------:|:---------------:|:---------------:|:---------------:|\n|priori_deep_fro | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.01781 |     56154537.29 |\n|priori_wide_fro | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.01612 |     62034739.45 |\n|priori_deep_toB | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00455 |    219973603.17 |\n|priori_wide_toB | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00457 |    219034059.80 |\n|priori_deep_toS | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00503 |    198925800.68 |\n|priori_wide_toS | dynamic_cast    |            Null |             128 |         2000000 |         1.00000 |         0.00488 |    204918032.79 |\n|rttiCosts       | typeinfo        |            Null |             128 |         2000000 |         1.00000 |         0.00454 |    220312844.24 |\n|priori_deep_fro | priori_cast     |            Null |             128 |         2000000 |         1.46114 |         0.02602 |     38431975.40 |\n|priori_wide_fro | priori_cast     |            Null |             128 |         2000000 |         1.94498 |         0.03135 |     31894874.49 |\n|priori_deep_toB | priori_cast     |            Null |             128 |         2000000 |         0.99890 |         0.00454 |    220215811.50 |\n|priori_wide_toB | priori_cast     |            Null |             128 |         2000000 |         0.99660 |         0.00455 |    219780219.78 |\n|priori_deep_toS | priori_cast     |            Null |             128 |         2000000 |         0.90302 |         0.00454 |    220288578.04 |\n|priori_wide_toS | priori_cast     |            Null |             128 |         2000000 |         0.88648 |         0.00433 |    231160425.34 |\n|rttiCosts       | typeinfoHash    |            Null |             128 |         2000000 |         2.49251 |         0.01131 |     88389976.58 |\n|rttiCosts       | typeinfoName    |            Null |             128 |         2000000 |         1.41683 |         0.00643 |    155496812.32 |\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalinblue%2Fpriori","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalinblue%2Fpriori","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalinblue%2Fpriori/lists"}