{"id":18286184,"url":"https://github.com/azrafe7/simpleprofiler","last_synced_at":"2025-04-09T06:23:03.783Z","repository":{"id":8284431,"uuid":"9821795","full_name":"azrafe7/SimpleProfiler","owner":"azrafe7","description":"A simpler profiler for Python functions.","archived":false,"fork":false,"pushed_at":"2013-05-02T20:49:12.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T00:43:30.261Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/azrafe7.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":"2013-05-02T20:18:06.000Z","updated_at":"2013-12-05T22:54:02.000Z","dependencies_parsed_at":"2022-08-07T01:01:11.098Z","dependency_job_id":null,"html_url":"https://github.com/azrafe7/SimpleProfiler","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/azrafe7%2FSimpleProfiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrafe7%2FSimpleProfiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrafe7%2FSimpleProfiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrafe7%2FSimpleProfiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azrafe7","download_url":"https://codeload.github.com/azrafe7/SimpleProfiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247988403,"owners_count":21029102,"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-11-05T13:19:11.263Z","updated_at":"2025-04-09T06:23:03.764Z","avatar_url":"https://github.com/azrafe7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"SimpleProfiler\n==============\n\nA simpler profiler for Python functions.\n\nDescription\n-----------\nIt works as a function decorator and writes out simple stats on standard output when the program terminates.\n\nUsage\n-----------\nImport `profile` from `SimpleProfiler` and use it to decorate the functions that you want to profile/time.\n\nExample\n-----------\n\ntest.py:\n\n\tfrom SimpleProfiler import profile\n\t\n\tITERATIONS = 100000\n\t\n\t@profile\n\tdef doSomething():\n\t\tfor _ in range(ITERATIONS):\n\t\t\tpass\n\t\n\t@profile\n\tdef doMath(x):\n\t\tsum = 0\n\t\tfor i in range(ITERATIONS):\n\t\t\tsum += x * x * i\n\t\treturn sum\n\t\n\tdef notProfiled(x, y):\n\t\tsum = 0\n\t\tfor _ in range(ITERATIONS):\n\t\t\tsum += x * y\n\t\treturn sum\n\t\n\t\t\n\tif __name__ == \"__main__\":\n\t\tfor _ in range(10):\n\t\t\tdoSomething()\n\t\t\tnotProfiled(123, 456)\n\t\t\tnotProfiled(321, 0)\n\t\t\tdoMath(3)\n\t\t\tdoMath(7**7)\n\t\t\tdoSomething()\n\t\t\tdoMath(666)\n\n\t\nOutput:\n\n              name      calls         total_time       average_time\n              ----      -----         ----------       ------------\n       doSomething         20             0.2290             0.0115\n            doMath         30             2.7212             0.0907\n\n\n\nPS: Change `range` to `xrange` in the test with Python \u003c 3.0. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazrafe7%2Fsimpleprofiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazrafe7%2Fsimpleprofiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazrafe7%2Fsimpleprofiler/lists"}