{"id":30138234,"url":"https://github.com/nickscha/perf","last_synced_at":"2025-08-11T01:03:35.895Z","repository":{"id":309055667,"uuid":"1035025047","full_name":"nickscha/perf","owner":"nickscha","description":"C89, single header, nostdlib simple performance profiler","archived":false,"fork":false,"pushed_at":"2025-08-09T14:09:48.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-09T16:06:46.859Z","etag":null,"topics":["c89","nostdlib","performance-metrics","performance-profiling","single-header"],"latest_commit_sha":null,"homepage":"","language":"C","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/nickscha.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-09T13:51:29.000Z","updated_at":"2025-08-09T14:09:51.000Z","dependencies_parsed_at":"2025-08-09T16:06:49.574Z","dependency_job_id":"6fa3f35e-707c-4e78-94f3-11c0e0c6a036","html_url":"https://github.com/nickscha/perf","commit_stats":null,"previous_names":["nickscha/perf"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/nickscha/perf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fperf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fperf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fperf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fperf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickscha","download_url":"https://codeload.github.com/nickscha/perf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickscha%2Fperf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269814341,"owners_count":24479363,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["c89","nostdlib","performance-metrics","performance-profiling","single-header"],"created_at":"2025-08-11T01:02:43.097Z","updated_at":"2025-08-11T01:03:35.844Z","avatar_url":"https://github.com/nickscha.png","language":"C","readme":"# perf\nA C89 standard compliant, single header, nostdlib (no C Standard Library) simple performance profiler.\n\nFor more information please look at the \"perf.h\" file or take a look at the \"examples\" or \"tests\" folder.\n\n\u003e [!WARNING]\n\u003e THIS PROJECT IS A WORK IN PROGRESS! ANYTHING CAN CHANGE AT ANY MOMENT WITHOUT ANY NOTICE! USE THIS PROJECT AT YOUR OWN RISK!\n\n## Quick Start\n\nDownload or clone perf.h and include it in your project.\n\n```C\n#include \"perf.h\" /* Performance Profiler */\n\n/* Just an example function that does some operations */\nvoid test_function(double a, double b)\n{\n  int i;\n  for (i = 0; i \u003c 100; ++i)\n  {\n    a += a + b;\n  }\n}\n\nint main() {\n\n    /* Simply wrap your function or void block in a PERF_PROFILE call */\n    PERF_PROFILE(test_function(5.0, 2.23));\n\n    /* In this example we also profile the perf function calls themselv and give it a name */\n    PERF_PROFILE_WITH_NAME(\n        {\n            PERF_PROFILE(test_function(1.0, 3.0));\n            PERF_PROFILE_WITH_NAME(test_function(1.0, 3.0), \"custom_name\");\n        },\n        \"profile_perf_calls\");\n\n    return 0;\n}\n```\n\nThe profiling results are then printed out like this:\n\n```txt\nperf_test.c:27 [perf]           51 cycles,     0.000001 ms, \"test_function(5.0, 2.23)\"\nperf_test.c:31 [perf]           49 cycles,     0.000000 ms, \"test_function(1.0, 3.0)\"\nperf_test.c:32 [perf]           82 cycles,     0.000003 ms, \"custom_name\"\nperf_test.c:29 [perf]      1985457 cycles,     0.707300 ms, \"profile_perf_calls\"\n```\n\n### Disable Performance Profiling\nIf you placed the PERF_ calls in your code base but want to switch off the functionality without loosing any performance you can specify -DPERF_DISABLE or #define it like the following example.\n\n```C\n#define PERF_DISABLE\n#include \"perf.h\"\n```\n\n## Run Example: nostdlib, freestsanding\n\nIn this repo you will find the \"examples/perf_win32_nostdlib.c\" with the corresponding \"build.bat\" file which\ncreates an executable only linked to \"kernel32\" and is not using the C standard library and executes the program afterwards.\n\n## \"nostdlib\" Motivation \u0026 Purpose\n\nnostdlib is a lightweight, minimalistic approach to C development that removes dependencies on the standard library. The motivation behind this project is to provide developers with greater control over their code by eliminating unnecessary overhead, reducing binary size, and enabling deployment in resource-constrained environments.\n\nMany modern development environments rely heavily on the standard library, which, while convenient, introduces unnecessary bloat, security risks, and unpredictable dependencies. nostdlib aims to give developers fine-grained control over memory management, execution flow, and system calls by working directly with the underlying platform.\n\n### Benefits\n\n#### Minimal overhead\nBy removing the standard library, nostdlib significantly reduces runtime overhead, allowing for faster execution and smaller binary sizes.\n\n#### Increased security\nStandard libraries often include unnecessary functions that increase the attack surface of an application. nostdlib mitigates security risks by removing unused and potentially vulnerable components.\n\n#### Reduced binary size\nWithout linking to the standard library, binaries are smaller, making them ideal for embedded systems, bootloaders, and operating systems where storage is limited.\n\n#### Enhanced performance\nDirect control over system calls and memory management leads to performance gains by eliminating abstraction layers imposed by standard libraries.\n\n#### Better portability\nBy relying only on fundamental system interfaces, nostdlib allows for easier porting across different platforms without worrying about standard library availability.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickscha%2Fperf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickscha%2Fperf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickscha%2Fperf/lists"}