{"action":"created","issue":{"url":"https://api.github.com/repos/Shopify/liquid/issues/415","labels_url":"https://api.github.com/repos/Shopify/liquid/issues/415/labels{/name}","comments_url":"https://api.github.com/repos/Shopify/liquid/issues/415/comments","events_url":"https://api.github.com/repos/Shopify/liquid/issues/415/events","html_url":"https://github.com/Shopify/liquid/pull/415","id":40043991,"number":415,"title":"Implement the stack based interpreter from the leg_c branch.","user":{"login":"dylanahsmith","id":954402,"avatar_url":"https://avatars.githubusercontent.com/u/954402?v=3","gravatar_id":"","url":"https://api.github.com/users/dylanahsmith","html_url":"https://github.com/dylanahsmith","followers_url":"https://api.github.com/users/dylanahsmith/followers","following_url":"https://api.github.com/users/dylanahsmith/following{/other_user}","gists_url":"https://api.github.com/users/dylanahsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanahsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanahsmith/subscriptions","organizations_url":"https://api.github.com/users/dylanahsmith/orgs","repos_url":"https://api.github.com/users/dylanahsmith/repos","events_url":"https://api.github.com/users/dylanahsmith/events{/privacy}","received_events_url":"https://api.github.com/users/dylanahsmith/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Shopify/liquid/labels/Feature","name":"Feature","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-08-12T10:53:18Z","updated_at":"2015-04-17T21:13:23Z","closed_at":"2015-04-17T21:13:23Z","pull_request":{"url":"https://api.github.com/repos/Shopify/liquid/pulls/415","html_url":"https://github.com/Shopify/liquid/pull/415","diff_url":"https://github.com/Shopify/liquid/pull/415.diff","patch_url":"https://github.com/Shopify/liquid/pull/415.patch"},"body":"cc @tobi, @Shopify/liquid \r\n\r\nThis is a ruby port of the C expression parser from the [leg_c branch](https://github.com/Shopify/liquid/compare/leg_c) that parses the expression into a list of instructions for a stack based interpreter.\r\n\r\nHere is the reference implementation in the leg_c branch:\r\n* [stack based interpreter](https://github.com/Shopify/liquid/blob/0c6bc2b2a390f1c6815f17ff7645823a2e4329f4/lib/liquid/context.rb#L138-L171)\r\n* [parser definition](https://github.com/Shopify/liquid/blob/leg_c/ext/liquid/liquid_context.leg)\r\n\r\nNote that I removed a [test_descent_hash_descent test](https://github.com/Shopify/liquid/blob/0c6bc2b2a390f1c6815f17ff7645823a2e4329f4/test/liquid/parser_test.rb#L86-L87) for parsing `variable1[test1[test2]]` since the Liquid::VariableParser regex will ignore the last close square bracket character, so this is an existing bug that I don't indent to fix here.\r\n\r\n## Benchmarks\r\n\r\nran twice on master\r\n\r\n```\r\n              parse:       27.1 (±11.1%) i/s -       1610 in  60.061666s\r\n        parse & run:       12.8 (±7.8%) i/s -        765 in  60.045125s\r\n\r\n              parse:       27.0 (±11.1%) i/s -       1602 in  60.035207s\r\n        parse & run:       12.5 (±8.0%) i/s -        745 in  60.052382s\r\n```\r\n\r\nran twice on this branch\r\n\r\n```\r\n              parse:       27.4 (±10.9%) i/s -       1630 in  60.046285s\r\n        parse & run:       12.2 (±8.2%) i/s -        728 in  60.081207s\r\n\r\n              parse:       27.0 (±11.1%) i/s -       1606 in  60.038852s\r\n        parse & run:       12.0 (±8.3%) i/s -        719 in  60.058928s\r\n```\r\n\r\nSo it looks like this does have a performance impact on rendering at the moment."},"comment":{"url":"https://api.github.com/repos/Shopify/liquid/issues/comments/94076727","html_url":"https://github.com/Shopify/liquid/pull/415#issuecomment-94076727","issue_url":"https://api.github.com/repos/Shopify/liquid/issues/415","id":94076727,"user":{"login":"dylanahsmith","id":954402,"avatar_url":"https://avatars.githubusercontent.com/u/954402?v=3","gravatar_id":"","url":"https://api.github.com/users/dylanahsmith","html_url":"https://github.com/dylanahsmith","followers_url":"https://api.github.com/users/dylanahsmith/followers","following_url":"https://api.github.com/users/dylanahsmith/following{/other_user}","gists_url":"https://api.github.com/users/dylanahsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanahsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanahsmith/subscriptions","organizations_url":"https://api.github.com/users/dylanahsmith/orgs","repos_url":"https://api.github.com/users/dylanahsmith/repos","events_url":"https://api.github.com/users/dylanahsmith/events{/privacy}","received_events_url":"https://api.github.com/users/dylanahsmith/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T21:13:23Z","updated_at":"2015-04-17T21:13:23Z","body":"Closing, since we didn't take this direction with liquid-c and it didn't prove beneficial for the ruby implementation."}}