{"id":3152,"url":"https://github.com/WorldDownTown/Benchmark","last_synced_at":"2025-08-03T13:32:03.704Z","repository":{"id":56903603,"uuid":"59581583","full_name":"WorldDownTown/Benchmark","owner":"WorldDownTown","description":"The Benchmark⏲ module provides methods to measure and report the time used to execute Swift code.","archived":false,"fork":false,"pushed_at":"2017-05-05T01:41:04.000Z","size":13,"stargazers_count":86,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-13T18:54:54.044Z","etag":null,"topics":["benchmark","carthage","cocoapods","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/WorldDownTown.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-05-24T14:43:37.000Z","updated_at":"2024-08-22T13:50:32.000Z","dependencies_parsed_at":"2022-08-20T18:50:58.713Z","dependency_job_id":null,"html_url":"https://github.com/WorldDownTown/Benchmark","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldDownTown%2FBenchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldDownTown%2FBenchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldDownTown%2FBenchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldDownTown%2FBenchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorldDownTown","download_url":"https://codeload.github.com/WorldDownTown/Benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228548567,"owners_count":17935221,"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","carthage","cocoapods","swift"],"created_at":"2024-01-05T20:16:32.895Z","updated_at":"2024-12-07T01:30:37.462Z","avatar_url":"https://github.com/WorldDownTown.png","language":"Swift","funding_links":[],"categories":["Tools","WebSocket"],"sub_categories":["Web View","Other free courses"],"readme":"# Benchmark\nThe Benchmark⏲ module provides methods to measure and report the time used to execute Swift code.\n\n[![License](https://img.shields.io/:license-mit-blue.svg)](https://doge.mit-license.org)\n[![Language](https://img.shields.io/badge/language-swift-orange.svg?style=flat)](https://developer.apple.com/swift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/Benchmark.svg?style=flat)](http://cocoadocs.org/docsets/Benchmark/)\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/matteocrippa/awesome-swift#utility)\n\n## Installation\n### Carthage\n\n```\n// Cartfile\ngithub \"WorldDownTown/Benchmark\"\n```\n\n### CocoaPods\n\n```\n// Podfile\npod 'Benchmark'\n```\n\n## Usage\n### Simple measure\n\n```swift\nimport Benchmark\n\nBenchmark.measure() {\n    print(self) // don't have to set weak.\n    for _ in 0...10000000 { }\n}\n// Benchmark: 0.1690970063 sec.\n\n// Benchamrk can be set name.\nBenchmark.measure(\"Measure1\") {\n    for _ in 0...10000000 { }\n}\n// Measure1: 0.1690970063 sec.\n```\n\n### Multiple measure\n\n```swift\nimport Benchmark\n\nfunc heavyMethod() {\n    let outer = Benchmark(key: \"outer\")\n\n    let inner = Benchmark(key: \"inner\")\n\n    // some light processes\n    for _ in 0...10 { }\n\n    inner.finish()  // inner: 0.0002210140 sec.\n\n    // some heavy processes\n    for _ in 0...10000000 { }\n\n    outer.finish()  // outer: 0.1663100123 sec.\n}\n```\n\n### Through another Class (or Struct or file ...)\n\n```swift\nimport Benchmark\n\nclass Foo {\n    func execute() {\n        Benchmark.start()\n    }\n}\n\nclass Bar {\n    func execute() {\n        Benchmark.finish()\n    }\n}\n\nFoo().execute()\n\nBar().execute()  // Benchmark: 0.0001509786 sec.\n```\n\n### Using operator\n\n```swift\nimport Benchmark\n\n// same as Benchmark.measure {}\n⏲{\n    for _ in 0...10000000 { }\n}\n// Benchmark: 0.1653281017 sec.\n```\n\n## Contributing\nContributions are more than welcome! If you have an improvement or a feature you wish to have added to `Benchmark`, then please don't hesitate to send a pull request!\n\n## Author\nWorldDownTown @ gmail.com\n\n## License\n`Benchmark` is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWorldDownTown%2FBenchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWorldDownTown%2FBenchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWorldDownTown%2FBenchmark/lists"}