{"id":18048830,"url":"https://github.com/serima/hashee","last_synced_at":"2025-04-05T05:28:27.947Z","repository":{"id":62542623,"uuid":"44050271","full_name":"serima/Hashee","owner":"serima","description":"Very simple optimization using hash lookups to search an array","archived":false,"fork":false,"pushed_at":"2018-05-21T16:31:58.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T06:06:16.790Z","etag":null,"topics":["hash-lookups","optimization"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/serima.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}},"created_at":"2015-10-11T11:55:15.000Z","updated_at":"2018-05-21T16:31:59.000Z","dependencies_parsed_at":"2022-11-02T15:46:29.840Z","dependency_job_id":null,"html_url":"https://github.com/serima/Hashee","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serima%2FHashee","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serima%2FHashee/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serima%2FHashee/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serima%2FHashee/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serima","download_url":"https://codeload.github.com/serima/Hashee/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247292656,"owners_count":20915085,"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":["hash-lookups","optimization"],"created_at":"2024-10-30T20:15:33.667Z","updated_at":"2025-04-05T05:28:27.923Z","avatar_url":"https://github.com/serima.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hashee\n\n[![Build Status](https://travis-ci.org/serima/Hashee.svg)](https://travis-ci.org/serima/Hashee)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/serima/Hashee/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/serima/Hashee/?branch=master)\n\nVery simple optimization using hash lookups to search an array.\n\n## Installation\n\n```\ncomposer require serima/hashee\n```\n\n## Usage\n\n```php\n\u003c?php\n\nuse Serima\\Hashee\\Hashee;\n\n$hashForSearch = array();\nHashee::add($hashForSearch, 'super');\nHashee::add($hashForSearch, 'bad');\nHashee::add($hashForSearch, 'word');\n\nHashee::in('good', $hashForSearch); // false\nHashee::in('bad', $hashForSearch); // true\nHashee::release($hashForSearch);\n\n$bannedUserNames = array('Jim', 'Taro', 'Fred');\nHashee::addBulk($bannedUserNames);\nHashee::delete($bannedUserNames, 'Fred');\nHashee::in('Jim', $bannedUserNames); // true\nHashee::in('Fred', $bannedUserNames); // false\nHashee::release($bannedUserNames);\n\n```\n\n## Benchmark\n\nYou can see the benchmark script in `tests/Benchmark.php`\nGraphical here.\nhttps://docs.google.com/spreadsheets/d/11zw--aiHH33umh86y_ctiEx87XTsUIK7YMHqctZ_FzM/edit?usp=sharing\n\n```\n% php tests/Benchmark.php\n========================================\nelementNumber : 5\nin_array: 0.030714988708496\nhashee:   0.013134956359863\n========================================\n========================================\nelementNumber : 10\nin_array: 0.032805919647217\nhashee:   0.012555122375488\n========================================\n========================================\nelementNumber : 100\nin_array: 0.15763115882874\nhashee:   0.010236978530884\n========================================\n========================================\nelementNumber : 1000\nin_array: 1.3289721012115\nhashee:   0.010061025619507\n========================================\n========================================\nelementNumber : 10000\nin_array: 13.358424901962\nhashee:   0.0097849369049072\n========================================\n```\n\n## Thanks\n\nHashee is inspired by this entry written by [@mtdowling](https://github.com/mtdowling).\n\n[Favor Hash Lookups Over Array Searches](http://mtdowling.com/blog/2014/03/17/hash-lookups-over-array-search/)\n\nI coded benchmark script using example from it.\n\n## References\n\nhttp://stackoverflow.com/questions/2473989/list-of-big-o-for-php-functions\n\n## LICENSE\n\nMIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserima%2Fhashee","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserima%2Fhashee","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserima%2Fhashee/lists"}