{"id":13745022,"url":"https://github.com/manuelbua/as3-profiler","last_synced_at":"2026-01-17T17:26:28.023Z","repository":{"id":10817603,"uuid":"13093021","full_name":"manuelbua/as3-profiler","owner":"manuelbua","description":"A simple, easy-to-use ActionScript 3 profiler","archived":false,"fork":false,"pushed_at":"2013-09-25T12:44:54.000Z","size":136,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-04T05:05:34.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"ActionScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manuelbua.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":"2013-09-25T12:27:41.000Z","updated_at":"2014-11-27T07:09:49.000Z","dependencies_parsed_at":"2022-09-02T13:50:52.485Z","dependency_job_id":null,"html_url":"https://github.com/manuelbua/as3-profiler","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/manuelbua%2Fas3-profiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelbua%2Fas3-profiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelbua%2Fas3-profiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelbua%2Fas3-profiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manuelbua","download_url":"https://codeload.github.com/manuelbua/as3-profiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224819750,"owners_count":17375321,"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-08-03T05:01:20.599Z","updated_at":"2026-01-17T17:26:28.001Z","avatar_url":"https://github.com/manuelbua.png","language":"ActionScript","funding_links":[],"categories":["Unsorted"],"sub_categories":["Other API"],"readme":"## An ActionScript profiler\n\nWhen i was working on a proof-of-concept project i needed to know more about my code performances and googling for an AS3 profiler just pointed to ASProf, an AS2 profiler.\n\nSo i decided to write one, porting my other C++-based profiler belonging to another project: originally inspired by an article of [Steve Rabin](http://www.aiwisdom.com/) in the [Game Programming Gems #1](http://gameprogramminggems.com/) book.\n\nIt's always wise to remember that if you are serious about code profiling, you are better off to search for some professional tools: in the C++ arena my choice would have been Compuware's DevStudio, but [GlowCode](http://www.glowcode.com/) is an interesting alternative.\n\nAt the time i was writing ActionScript code, however, i didn't find any really usable tool for the job, so i thought to release it under a zlib/png license and some hints on how it works here.\n\n### Usage\n\nOnce you included/imported/copied/referenced the package in your project, add the profiler's output (a Sprite) to your local render queue, and then set it up with some basic configuration:\n\n\tProfilerConfig.Width = stage.stageWidth;\n\tProfilerConfig.ShowMinMax = true;\n\tprof = new Profiler( 32 );\n\taddChild( prof );\n\nNow let's fake some work and feed the profiler with some data:\n\n\tvar i: int = 0;\n\tvar it: int = 1000000;\n\n\tprof.beginProfiling();\n\n\ti = it;\n\tprof.begin( \"fadd\" );\n\twhile( i-- ) { fRes += 1.; }\n\tprof.end( \"fadd\" );\n\n\ti = it;\n\tprof.begin( \"iadd\" );\n\twhile( i-- ) { iRes += 1; }\n\tprof.end( \"iadd\" );\n\n\ti = it;\n\tprof.begin( \"fsub\" );\n\twhile( i-- ) { fRes -= 1.; }\n\tprof.end( \"fsub\" );\n\n\ti = it;\n\tprof.begin( \"isub\" );\n\twhile( i-- ) { iRes -= 1; }\n\tprof.end( \"isub\" );\n\n\tprof.endProfiling();\n\nThe profiler should show some signs of life, like the following screenshots:\n\n![profiler_in_action](http://i.imgur.com/fEP51aj.png \"The profiler in action\")\n\nAnd this is it!\nAnother useful thing the profiler can do is *grouping*, so that you can group different code fragments belonging to your most logical schema, by wrapping the same ProfileNode around the various different code fragments: here i'm grouping math operations by their type, just to keep things organized a bit:\n\n\tvar i: int = 0;\n\tvar it: int = 1000000;\n\n\tprof.beginProfiling();\n\n\ti = it;\n\tprof.begin( \"float\", true );\n\tprof.begin( \"fadd\" );\n\twhile( i-- ) { fRes += 1.; }\n\tprof.end( \"fadd\" );\n\tprof.end( \"float\" );\n\n\ti = it;\n\tprof.begin( \"int\", true );\n\tprof.begin( \"iadd\" );\n\twhile( i-- ) { iRes += 1; }\n\tprof.end( \"iadd\" );\n\tprof.end( \"int\" );\n\n\ti = it;\n\tprof.begin( \"float\", true );\n\tprof.begin( \"fsub\" );\n\twhile( i-- ) { fRes -= 1.; }\n\tprof.end( \"fsub\" );\n\tprof.end( \"float\" );\n\n\ti = it;\n\tprof.begin( \"int\", true );\n\tprof.begin( \"isub\" );\n\twhile( i-- ) { iRes -= 1; }\n\tprof.end( \"isub\" );\n\tprof.end( \"int\" );\n\n\tprof.endProfiling();\n\nNow the graph should look somewhat better:\n\n![profiler_grouped_calls](http://i.imgur.com/YaReT3y.png \"Grouped calls\")\n\nThat's all there is to it, hope it will be useful!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelbua%2Fas3-profiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanuelbua%2Fas3-profiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelbua%2Fas3-profiler/lists"}