{"action":"created","issue":{"url":"https://api.github.com/repos/munificent/wren/issues/236","labels_url":"https://api.github.com/repos/munificent/wren/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/munificent/wren/issues/236/comments","events_url":"https://api.github.com/repos/munificent/wren/issues/236/events","html_url":"https://github.com/munificent/wren/pull/236","id":64635816,"number":236,"title":"Add script creating an amalgamation","user":{"login":"lluchs","id":516527,"avatar_url":"https://avatars.githubusercontent.com/u/516527?v=3","gravatar_id":"","url":"https://api.github.com/users/lluchs","html_url":"https://github.com/lluchs","followers_url":"https://api.github.com/users/lluchs/followers","following_url":"https://api.github.com/users/lluchs/following{/other_user}","gists_url":"https://api.github.com/users/lluchs/gists{/gist_id}","starred_url":"https://api.github.com/users/lluchs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lluchs/subscriptions","organizations_url":"https://api.github.com/users/lluchs/orgs","repos_url":"https://api.github.com/users/lluchs/repos","events_url":"https://api.github.com/users/lluchs/events{/privacy}","received_events_url":"https://api.github.com/users/lluchs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-26T21:14:23Z","updated_at":"2015-03-31T13:59:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/munificent/wren/pulls/236","html_url":"https://github.com/munificent/wren/pull/236","diff_url":"https://github.com/munificent/wren/pull/236.diff","patch_url":"https://github.com/munificent/wren/pull/236.patch"},"body":"I.e. it combines everything in a single wren.c file for super easy embedding. See [SQLite](https://www.sqlite.org/amalgamation.html).\r\n\r\nThe Python script is as simple as possible and makes a lot of assumptions:\r\n\r\n - All static variables and functions are unique across all files.\r\n - Macros need to be `#undef`ed before they are redefined in a different file (there was only a single case here which could also be renamed).\r\n - All header files (except wren.h) are in the same directory.\r\n\r\nBuilding the CLI is then possible like this:\r\n\r\n```sh\r\nmake wren.c\r\ngcc -Os -std=c99 -Isrc/include wren.c src/cli/*.c -o bin/wren -lm \r\n```\r\n\r\nThe benchmark results are curious - apparently, some very different optimizations happen with the single file (comparing plain `make` and the build resulting from the two lines above):\r\n```\r\nbinary_trees - wren            .......... 0.41s 0.0017 111.40% relative to baseline\r\ndelta_blue - wren              .......... 0.20s 0.0007  98.85% relative to baseline\r\nfib - wren                     .......... 0.65s 0.0061  87.50% relative to baseline\r\nfor - wren                     .......... 0.23s 0.0019 106.27% relative to baseline\r\nmethod_call - wren             .......... 0.33s 0.0011 101.85% relative to baseline\r\nmap_numeric - wren             .......... 0.77s 0.0019  99.19% relative to baseline\r\nmap_string - wren              .......... 0.18s 0.0012 104.65% relative to baseline\r\nstring_equals - wren           .......... 0.51s 0.0047 101.89% relative to baseline\r\n```"},"comment":{"url":"https://api.github.com/repos/munificent/wren/issues/comments/88097817","html_url":"https://github.com/munificent/wren/pull/236#issuecomment-88097817","issue_url":"https://api.github.com/repos/munificent/wren/issues/236","id":88097817,"user":{"login":"munificent","id":46275,"avatar_url":"https://avatars.githubusercontent.com/u/46275?v=3","gravatar_id":"","url":"https://api.github.com/users/munificent","html_url":"https://github.com/munificent","followers_url":"https://api.github.com/users/munificent/followers","following_url":"https://api.github.com/users/munificent/following{/other_user}","gists_url":"https://api.github.com/users/munificent/gists{/gist_id}","starred_url":"https://api.github.com/users/munificent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munificent/subscriptions","organizations_url":"https://api.github.com/users/munificent/orgs","repos_url":"https://api.github.com/users/munificent/repos","events_url":"https://api.github.com/users/munificent/events{/privacy}","received_events_url":"https://api.github.com/users/munificent/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T13:59:02Z","updated_at":"2015-03-31T13:59:02Z","body":"Oh, crap. Sorry it took so long for me to get to this. In the meantime, I merged in another patch that broke this. :(\r\n\r\nFrom the benchmark results, it isn't a clear win in performance. (But it's really cool that you implemented this so we can *know* that!)\r\n\r\nGiven that, do you think it's worth landing? We'd have to maintain it henceforth and forever, so I want to make sure it will provide enough value for end users. If so, any chance you could update it to work with the new opcode header?"}}