{"id":13830216,"url":"https://github.com/dyu/ffi-overhead","last_synced_at":"2025-04-04T10:07:33.836Z","repository":{"id":10771777,"uuid":"13036773","full_name":"dyu/ffi-overhead","owner":"dyu","description":"comparing the c ffi (foreign function interface) overhead on various programming languages","archived":false,"fork":false,"pushed_at":"2023-07-12T14:43:22.000Z","size":91,"stargazers_count":657,"open_issues_count":12,"forks_count":40,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-10-14T00:08:23.092Z","etag":null,"topics":["benchmark","c","ffi"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dyu.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}},"created_at":"2013-09-23T13:40:03.000Z","updated_at":"2024-09-14T23:22:19.000Z","dependencies_parsed_at":"2024-01-13T16:24:52.343Z","dependency_job_id":null,"html_url":"https://github.com/dyu/ffi-overhead","commit_stats":{"total_commits":93,"total_committers":11,"mean_commits":8.454545454545455,"dds":"0.11827956989247312","last_synced_commit":"c0f176f5e116b617477cf7e3213f5487c02b9469"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyu%2Fffi-overhead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyu%2Fffi-overhead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyu%2Fffi-overhead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dyu%2Fffi-overhead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dyu","download_url":"https://codeload.github.com/dyu/ffi-overhead/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157274,"owners_count":20893219,"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","c","ffi"],"created_at":"2024-08-04T10:00:57.385Z","updated_at":"2025-04-04T10:07:33.816Z","avatar_url":"https://github.com/dyu.png","language":"C","readme":"ffi-overhead\n============\n\ncomparing the c ffi overhead on various programming languages\n\nRequirements:\n- gcc\n- tup\n- zig\n- nim\n- v\n- java7\n- java8\n- go\n- rust\n- d (dmd and ldc2)\n- haskell (ghc)\n- ocaml\n- csharp (mono)\n- luajit\n- julia\n- node\n- dart\n- wren\n- elixir\n\nMy environment:\n```\n- Intel i7-3630QM laptop (4cores, HT) with 16g ram\n- Ubuntu 14.04 x64\n- gcc/g++ 5.4.1\n- tup 0.7.4\n- zig 0.2.0\n- nim 0.14.3\n- v 0.2.2 aebb551\n- java 1.7.0_72 and 1.8.0_91\n- go 1.8.0\n- rust 1.17.0-nightly (c0b7112ba 2017-03-02)\n- dmd 2.0.71.1\n- ldc2 1.9.0\n- ghc 7.10.3 (at /opt/ghc)\n- ocaml 4.06.1\n- mono 5.12.0.226\n# dynamic languages \n- luajit 2.0.4\n- julia 0.6.3\n- node 6.9.0 (at /opt/node)\n- dart 1.22.0 (at /usr/lib/dart)\n- wren 0.1.0\n- elixir 1.6.5 (Erlang/OTP 20)\n```\n\n### Initialize\n```sh\ntup init\n```\n\n### Compile\n```sh\n./compile-all.sh\n```\n\nCompile opts:\n- -O2 (gcc - applies to c/jni/nim)\n- -C opt-level=2 (rust)\n\n### Run\n```sh\n./run-all.sh 1000000\n```\n\nMeasurement:\n- call the c function \"plusone\" x number of times and print out the elapsed time in millis.\n ```c\nint x = 0;\nwhile (x \u003c count) x = plusone(x);\n ```\n\n- 2 samples/runs\n\n## Results (500M calls)\n```\n./run-all.sh 500000000\nThe results are elapsed time in milliseconds\n============================================\n\nluajit:\n891\n905\n\njulia:\n894\n889\n\nc:\n1182\n1182\n\ncpp:\n1182\n1183\n\nzig:\n1191\n1190\n\nnim:\n1330\n1330\n\nv:\n1779\n1781\n\nrust:\n1193\n1196\n\nd:\n1330\n1330\n\nd ldc2:\n1191\n1189\n\nhaskell:\n1197\n1198\n\nocamlopt:\n1634\n1634\n\nocamlc:\n4299\n4302\n\ncsharp mono:\n2697\n2690\n\njava7:\n4469\n4472\n\njava8:\n4505\n4472\n\nnode:\n9163\n9194\n\nnode scoped:\n15425\n15409\n\ngo:\n37975\n37879\n\ndart:\n31265\n31282\n\ndart scoped:\n61906\n69043\n\nwren:\n14519\n14514\n\nelixir:\n23852\n23752\n```\n\n","funding_links":[],"categories":["C","Engineering \u0026 Performance"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdyu%2Fffi-overhead","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdyu%2Fffi-overhead","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdyu%2Fffi-overhead/lists"}