{"id":16019658,"url":"https://github.com/iboard/compare_hash_and_tree","last_synced_at":"2025-04-05T03:25:14.107Z","repository":{"id":17548750,"uuid":"20351555","full_name":"iboard/compare_hash_and_tree","owner":"iboard","description":"Convert a list of strings into a nested hash and a Tree using RubyTree","archived":false,"fork":false,"pushed_at":"2014-05-31T07:44:33.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T08:08:48.304Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/iboard.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}},"created_at":"2014-05-31T07:44:18.000Z","updated_at":"2014-05-31T07:44:33.000Z","dependencies_parsed_at":"2022-09-11T01:00:43.248Z","dependency_job_id":null,"html_url":"https://github.com/iboard/compare_hash_and_tree","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/iboard%2Fcompare_hash_and_tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fcompare_hash_and_tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fcompare_hash_and_tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboard%2Fcompare_hash_and_tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboard","download_url":"https://codeload.github.com/iboard/compare_hash_and_tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247283489,"owners_count":20913583,"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":"2024-10-08T17:05:03.043Z","updated_at":"2025-04-05T03:25:14.085Z","avatar_url":"https://github.com/iboard.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"COMPARISON OF HASH AND TREE\n===========================\n\nUsage:\n\n  1. `bundle`\n  2. `ruby benchmark.rb`\n  3. `rspec render_list_hash.rb`\n  4. `rspec render_list_tree.rb`\n\n`render_list_hash` and `render_list_tree` does the same thing:\n\n    * Read input from a plain array containing strings\n      * 001\n      * 001.001\n      * 001.001.001\n      * 001.001.002\n      * 001.002\n      * 001.002.001\n      * ....\n    * Converts the input into a nested list\n      * 001\n      *   001\n      *     001\n      *     002\n      *   002\n      *     001\n\n`render_list_hash` converts the input into a nested hash:\n\n    { \"001\" =\u003e { \"001\" =\u003e { \"001\" =\u003e \"\", \"002\" =\u003e \"\" }, \"002\" =\u003e .... }\n\n`render_list_tree` uses the RubyTree-Gem and reads the input-array into a Tree\n\n                   ROOT\n                    001\n               001        002\n                        001\n\n\nThe Benchmark shows that plain hash-objects are a lot faster than using\na Tree.\n\n    ONE LEVEL HAS 1,000 ENTRIES\n    TWO LEVELS HAS 101,000 ENTRIES\n    THREE LEVELS HAS 1,101,000 ENTRIES\n                                                   user     system      total        real\n    Creation\n    1 Level creation Tree                      0.010000   0.000000   0.010000 (  0.010529)\n    1 Level creation Hash                      0.000000   0.000000   0.000000 (  0.002905)\n    2 Levels creation Tree                     1.490000   0.040000   1.530000 (  1.543189)\n    2 Levels creation Hash                     0.450000   0.020000   0.470000 (  0.460114)\n    3 Levels creation Tree                    34.280000   0.520000  34.800000 ( 34.962842)\n    3 Levels creation Hash                    10.300000   0.170000  10.470000 ( 10.522603)\n\n    Rendering\n    1 Level render Tree                        0.010000   0.000000   0.010000 (  0.003143)\n    1 Level render hash                        0.000000   0.000000   0.000000 (  0.000745)\n    2 Levels render Tree                       0.310000   0.000000   0.310000 (  0.316488)\n    2 Levels render hash                       0.960000   0.010000   0.970000 (  0.968256)\n    3 Levels render Tree                      11.850000   0.040000  11.890000 ( 11.948506)\n    3 Levels render hash                      10.890000   0.030000  10.920000 ( 10.974792)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Fcompare_hash_and_tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiboard%2Fcompare_hash_and_tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiboard%2Fcompare_hash_and_tree/lists"}