{"id":15710582,"url":"https://github.com/ivanhuay/micron-object-assign","last_synced_at":"2025-10-19T15:27:36.906Z","repository":{"id":44130506,"uuid":"191395040","full_name":"ivanhuay/micron-object-assign","owner":"ivanhuay","description":"Benchmark test between Object.Assign method and a custom Hiroki internal function","archived":false,"fork":false,"pushed_at":"2022-02-12T01:52:30.000Z","size":220,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-05T18:24:36.952Z","etag":null,"topics":["benchmark","hiroki","micron"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ivanhuay.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":"2019-06-11T15:01:29.000Z","updated_at":"2019-10-09T19:14:59.000Z","dependencies_parsed_at":"2022-09-03T16:12:22.991Z","dependency_job_id":null,"html_url":"https://github.com/ivanhuay/micron-object-assign","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/ivanhuay%2Fmicron-object-assign","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanhuay%2Fmicron-object-assign/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanhuay%2Fmicron-object-assign/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanhuay%2Fmicron-object-assign/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanhuay","download_url":"https://codeload.github.com/ivanhuay/micron-object-assign/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246345863,"owners_count":20762465,"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":["benchmark","hiroki","micron"],"created_at":"2024-10-03T21:08:43.941Z","updated_at":"2025-10-19T15:27:31.855Z","avatar_url":"https://github.com/ivanhuay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Micron Benchmark Object Assign vs Hiroki Assign\nThis is a benchmark for analize posible performance issues with a [Hiroki](https://github.com/ivanhuay/hiroki) internal method.\n\n## Motivation\nIn this benchmark we measure the time of this custom assign function:\n\n```javascript\nfunction assign(obj, set) {\n    Object.keys(set).forEach((key) =\u003e {\n        if(set[key].hasOwnProperty('$pull')) {\n            obj[key] = obj[key].filter((subitem) =\u003e set[key].$pull.indexOf(subitem) === -1);\n        } else if(set[key].hasOwnProperty('$push')) {\n            obj[key] = obj[key].concat(set[key].$push);\n        } else{\n            obj[key] = set[key];\n        }\n    });\n}\n```\n\nthis function will be used to add the `$pull` and `$push` methods from update to a simple save method.\n\nAlso save and update has difference performace, you can check this difference [here](https://github.com/ivanhuay/micron-mongoose-update-vs-save).\n\n## Results\n\nUsing that function with the `$push` is the worst performance with 3x times than just doing a `Object.Assign` but the times are equal to small for consider that a problem. We have to make 90000 perations to see a diference of 20ms.\n\n[view results HERE](https://ivanhuay.github.io/micron-object-assign/)\n![Alt image](./img/img-2.png)\n\n## Conclusion\nUsing this custom function will not significantly affect the performance of [Hiroki](https://github.com/ivanhuay/hiroki).\n\n\n## run the test\n\n```\ngit clone https://github.com/ivanhuay/micron-object-assign.git\n\ncd micron-object-assign\n\nnpm i\n\nnpm run test\n```\n\nafter running that the results should be on the docs folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanhuay%2Fmicron-object-assign","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanhuay%2Fmicron-object-assign","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanhuay%2Fmicron-object-assign/lists"}