{"action":"created","comment":{"url":"https://api.github.com/repos/mustache/mustache/pulls/comments/52244689","id":52244689,"diff_hunk":"@@ -496,6 +496,24 @@ def test_sections_returning_lambdas_get_called_with_text\n     assert_equal 1, view.calls\n   end\n \n+  def test_sections_returning_lambdas_get_called_dynamically_with_text\n+    view = Mustache.new\n+    view.template       = '{{name}}'\n+    view[:name]         = lambda { '{{dynamic_name}}' }","path":"test/mustache_test.rb","position":16,"original_position":16,"commit_id":"71c1c3d6fc54f36d1a35e181bc4e6cd6803d64fe","original_commit_id":"71c1c3d6fc54f36d1a35e181bc4e6cd6803d64fe","user":{"login":"locks","id":32344,"avatar_url":"https://avatars.githubusercontent.com/u/32344?v=3","gravatar_id":"","url":"https://api.github.com/users/locks","html_url":"https://github.com/locks","followers_url":"https://api.github.com/users/locks/followers","following_url":"https://api.github.com/users/locks/following{/other_user}","gists_url":"https://api.github.com/users/locks/gists{/gist_id}","starred_url":"https://api.github.com/users/locks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/locks/subscriptions","organizations_url":"https://api.github.com/users/locks/orgs","repos_url":"https://api.github.com/users/locks/repos","events_url":"https://api.github.com/users/locks/events{/privacy}","received_events_url":"https://api.github.com/users/locks/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/versioned/images/favicon.png) Issue found: [Use the new lambda literal syntax `-> {...}`.](https://www.codacy.com/app/rokusu/mustache/file/2000951366/issues/source?bid=2903613&fileBranchId=3121922#l502)","created_at":"2016-02-08T23:24:30Z","updated_at":"2016-02-08T23:24:30Z","html_url":"https://github.com/mustache/mustache/pull/220#discussion_r52244689","pull_request_url":"https://api.github.com/repos/mustache/mustache/pulls/220","_links":{"self":{"href":"https://api.github.com/repos/mustache/mustache/pulls/comments/52244689"},"html":{"href":"https://github.com/mustache/mustache/pull/220#discussion_r52244689"},"pull_request":{"href":"https://api.github.com/repos/mustache/mustache/pulls/220"}}},"pull_request":{"url":"https://api.github.com/repos/mustache/mustache/pulls/220","id":58618638,"html_url":"https://github.com/mustache/mustache/pull/220","diff_url":"https://github.com/mustache/mustache/pull/220.diff","patch_url":"https://github.com/mustache/mustache/pull/220.patch","issue_url":"https://api.github.com/repos/mustache/mustache/issues/220","number":220,"state":"open","locked":false,"title":"Option to interpret lambdas \"statically\"","user":{"login":"MarkusHarmsen","id":1562282,"avatar_url":"https://avatars.githubusercontent.com/u/1562282?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkusHarmsen","html_url":"https://github.com/MarkusHarmsen","followers_url":"https://api.github.com/users/MarkusHarmsen/followers","following_url":"https://api.github.com/users/MarkusHarmsen/following{/other_user}","gists_url":"https://api.github.com/users/MarkusHarmsen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkusHarmsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkusHarmsen/subscriptions","organizations_url":"https://api.github.com/users/MarkusHarmsen/orgs","repos_url":"https://api.github.com/users/MarkusHarmsen/repos","events_url":"https://api.github.com/users/MarkusHarmsen/events{/privacy}","received_events_url":"https://api.github.com/users/MarkusHarmsen/received_events","type":"User","site_admin":false},"body":"We are using mustache in different projects (all along rails) and having quite a few performance issues caused by mustache.\r\n\r\nOne major problem is the dynamic interpretation of lambdas. Assume the following mustache source:\r\n`{{#greeting}}John{{/greeting}}`\r\nwith the view:\r\n`greeting = lambda {|text| \"Hey ho #{text}, want's up?!\"}`\r\n\r\nThe issue is here, that mustache creates a complete new mustache object for the string \"Hey ho John, what's up?!\" which is compiled and rendered at every request on runtime. This pull request contains an option which allows to disable this behavior.\r\n\r\n**So you are changing the mustache behavior, what will be broken?**\r\nThat's a good question! The following example will no longer work if `:static_lambdas` is explicitly set to true (see tests). Assume the following setup:\r\n```\r\nview = Mustache.new :static_lambdas => STATIC\r\nview.template = '{{name}}'\r\nview[:name] = lambda { '{{dynamic_name}}' }\r\nview[:dynamic_name] = 'Chris'\r\n\r\nresult = view.render\r\n```\r\n\r\n**Before (e.g. STATIC = false)**:\r\n`Chris`\r\n\r\n**After (e.g. STATIC = true)**:\r\n`{{dynamic_name}}`\r\n\r\nWe did not have a single line in one of our projects, which requires such a behavior. I even had to add a dedicated test (`test_sections_returning_lambdas_get_called_dynamically_with_text`) to create a failing one ;).\r\n\r\n**What's the speedup?**\r\nFor a few pages, which are using relatively many lambdas as asset helpers, we were able to cut the rendering time by 50%.","created_at":"2016-02-08T14:50:55Z","updated_at":"2016-02-08T23:24:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76d80c4894b70e96c4c9cfaf5ad90972498c1d95","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mustache/mustache/pulls/220/commits","review_comments_url":"https://api.github.com/repos/mustache/mustache/pulls/220/comments","review_comment_url":"https://api.github.com/repos/mustache/mustache/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mustache/mustache/issues/220/comments","statuses_url":"https://api.github.com/repos/mustache/mustache/statuses/71c1c3d6fc54f36d1a35e181bc4e6cd6803d64fe","head":{"label":"MarkusHarmsen:master","ref":"master","sha":"71c1c3d6fc54f36d1a35e181bc4e6cd6803d64fe","user":{"login":"MarkusHarmsen","id":1562282,"avatar_url":"https://avatars.githubusercontent.com/u/1562282?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkusHarmsen","html_url":"https://github.com/MarkusHarmsen","followers_url":"https://api.github.com/users/MarkusHarmsen/followers","following_url":"https://api.github.com/users/MarkusHarmsen/following{/other_user}","gists_url":"https://api.github.com/users/MarkusHarmsen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkusHarmsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkusHarmsen/subscriptions","organizations_url":"https://api.github.com/users/MarkusHarmsen/orgs","repos_url":"https://api.github.com/users/MarkusHarmsen/repos","events_url":"https://api.github.com/users/MarkusHarmsen/events{/privacy}","received_events_url":"https://api.github.com/users/MarkusHarmsen/received_events","type":"User","site_admin":false},"repo":{"id":51148782,"name":"mustache","full_name":"MarkusHarmsen/mustache","owner":{"login":"MarkusHarmsen","id":1562282,"avatar_url":"https://avatars.githubusercontent.com/u/1562282?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkusHarmsen","html_url":"https://github.com/MarkusHarmsen","followers_url":"https://api.github.com/users/MarkusHarmsen/followers","following_url":"https://api.github.com/users/MarkusHarmsen/following{/other_user}","gists_url":"https://api.github.com/users/MarkusHarmsen/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkusHarmsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkusHarmsen/subscriptions","organizations_url":"https://api.github.com/users/MarkusHarmsen/orgs","repos_url":"https://api.github.com/users/MarkusHarmsen/repos","events_url":"https://api.github.com/users/MarkusHarmsen/events{/privacy}","received_events_url":"https://api.github.com/users/MarkusHarmsen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MarkusHarmsen/mustache","description":"Logic-less Ruby templates.","fork":true,"url":"https://api.github.com/repos/MarkusHarmsen/mustache","forks_url":"https://api.github.com/repos/MarkusHarmsen/mustache/forks","keys_url":"https://api.github.com/repos/MarkusHarmsen/mustache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MarkusHarmsen/mustache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MarkusHarmsen/mustache/teams","hooks_url":"https://api.github.com/repos/MarkusHarmsen/mustache/hooks","issue_events_url":"https://api.github.com/repos/MarkusHarmsen/mustache/issues/events{/number}","events_url":"https://api.github.com/repos/MarkusHarmsen/mustache/events","assignees_url":"https://api.github.com/repos/MarkusHarmsen/mustache/assignees{/user}","branches_url":"https://api.github.com/repos/MarkusHarmsen/mustache/branches{/branch}","tags_url":"https://api.github.com/repos/MarkusHarmsen/mustache/tags","blobs_url":"https://api.github.com/repos/MarkusHarmsen/mustache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MarkusHarmsen/mustache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MarkusHarmsen/mustache/git/refs{/sha}","trees_url":"https://api.github.com/repos/MarkusHarmsen/mustache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MarkusHarmsen/mustache/statuses/{sha}","languages_url":"https://api.github.com/repos/MarkusHarmsen/mustache/languages","stargazers_url":"https://api.github.com/repos/MarkusHarmsen/mustache/stargazers","contributors_url":"https://api.github.com/repos/MarkusHarmsen/mustache/contributors","subscribers_url":"https://api.github.com/repos/MarkusHarmsen/mustache/subscribers","subscription_url":"https://api.github.com/repos/MarkusHarmsen/mustache/subscription","commits_url":"https://api.github.com/repos/MarkusHarmsen/mustache/commits{/sha}","git_commits_url":"https://api.github.com/repos/MarkusHarmsen/mustache/git/commits{/sha}","comments_url":"https://api.github.com/repos/MarkusHarmsen/mustache/comments{/number}","issue_comment_url":"https://api.github.com/repos/MarkusHarmsen/mustache/issues/comments{/number}","contents_url":"https://api.github.com/repos/MarkusHarmsen/mustache/contents/{+path}","compare_url":"https://api.github.com/repos/MarkusHarmsen/mustache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MarkusHarmsen/mustache/merges","archive_url":"https://api.github.com/repos/MarkusHarmsen/mustache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MarkusHarmsen/mustache/downloads","issues_url":"https://api.github.com/repos/MarkusHarmsen/mustache/issues{/number}","pulls_url":"https://api.github.com/repos/MarkusHarmsen/mustache/pulls{/number}","milestones_url":"https://api.github.com/repos/MarkusHarmsen/mustache/milestones{/number}","notifications_url":"https://api.github.com/repos/MarkusHarmsen/mustache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MarkusHarmsen/mustache/labels{/name}","releases_url":"https://api.github.com/repos/MarkusHarmsen/mustache/releases{/id}","deployments_url":"https://api.github.com/repos/MarkusHarmsen/mustache/deployments","created_at":"2016-02-05T13:42:08Z","updated_at":"2016-02-05T13:42:09Z","pushed_at":"2016-02-08T16:32:55Z","git_url":"git://github.com/MarkusHarmsen/mustache.git","ssh_url":"git@github.com:MarkusHarmsen/mustache.git","clone_url":"https://github.com/MarkusHarmsen/mustache.git","svn_url":"https://github.com/MarkusHarmsen/mustache","homepage":"http://mustache.github.io/","size":1231,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mustache:master","ref":"master","sha":"f52a6b1a899e982103c7fb3dc9902d6e43526e5e","user":{"login":"mustache","id":197655,"avatar_url":"https://avatars.githubusercontent.com/u/197655?v=3","gravatar_id":"","url":"https://api.github.com/users/mustache","html_url":"https://github.com/mustache","followers_url":"https://api.github.com/users/mustache/followers","following_url":"https://api.github.com/users/mustache/following{/other_user}","gists_url":"https://api.github.com/users/mustache/gists{/gist_id}","starred_url":"https://api.github.com/users/mustache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustache/subscriptions","organizations_url":"https://api.github.com/users/mustache/orgs","repos_url":"https://api.github.com/users/mustache/repos","events_url":"https://api.github.com/users/mustache/events{/privacy}","received_events_url":"https://api.github.com/users/mustache/received_events","type":"Organization","site_admin":false},"repo":{"id":316198,"name":"mustache","full_name":"mustache/mustache","owner":{"login":"mustache","id":197655,"avatar_url":"https://avatars.githubusercontent.com/u/197655?v=3","gravatar_id":"","url":"https://api.github.com/users/mustache","html_url":"https://github.com/mustache","followers_url":"https://api.github.com/users/mustache/followers","following_url":"https://api.github.com/users/mustache/following{/other_user}","gists_url":"https://api.github.com/users/mustache/gists{/gist_id}","starred_url":"https://api.github.com/users/mustache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustache/subscriptions","organizations_url":"https://api.github.com/users/mustache/orgs","repos_url":"https://api.github.com/users/mustache/repos","events_url":"https://api.github.com/users/mustache/events{/privacy}","received_events_url":"https://api.github.com/users/mustache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mustache/mustache","description":"Logic-less Ruby templates.","fork":false,"url":"https://api.github.com/repos/mustache/mustache","forks_url":"https://api.github.com/repos/mustache/mustache/forks","keys_url":"https://api.github.com/repos/mustache/mustache/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mustache/mustache/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mustache/mustache/teams","hooks_url":"https://api.github.com/repos/mustache/mustache/hooks","issue_events_url":"https://api.github.com/repos/mustache/mustache/issues/events{/number}","events_url":"https://api.github.com/repos/mustache/mustache/events","assignees_url":"https://api.github.com/repos/mustache/mustache/assignees{/user}","branches_url":"https://api.github.com/repos/mustache/mustache/branches{/branch}","tags_url":"https://api.github.com/repos/mustache/mustache/tags","blobs_url":"https://api.github.com/repos/mustache/mustache/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mustache/mustache/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mustache/mustache/git/refs{/sha}","trees_url":"https://api.github.com/repos/mustache/mustache/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mustache/mustache/statuses/{sha}","languages_url":"https://api.github.com/repos/mustache/mustache/languages","stargazers_url":"https://api.github.com/repos/mustache/mustache/stargazers","contributors_url":"https://api.github.com/repos/mustache/mustache/contributors","subscribers_url":"https://api.github.com/repos/mustache/mustache/subscribers","subscription_url":"https://api.github.com/repos/mustache/mustache/subscription","commits_url":"https://api.github.com/repos/mustache/mustache/commits{/sha}","git_commits_url":"https://api.github.com/repos/mustache/mustache/git/commits{/sha}","comments_url":"https://api.github.com/repos/mustache/mustache/comments{/number}","issue_comment_url":"https://api.github.com/repos/mustache/mustache/issues/comments{/number}","contents_url":"https://api.github.com/repos/mustache/mustache/contents/{+path}","compare_url":"https://api.github.com/repos/mustache/mustache/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mustache/mustache/merges","archive_url":"https://api.github.com/repos/mustache/mustache/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mustache/mustache/downloads","issues_url":"https://api.github.com/repos/mustache/mustache/issues{/number}","pulls_url":"https://api.github.com/repos/mustache/mustache/pulls{/number}","milestones_url":"https://api.github.com/repos/mustache/mustache/milestones{/number}","notifications_url":"https://api.github.com/repos/mustache/mustache/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mustache/mustache/labels{/name}","releases_url":"https://api.github.com/repos/mustache/mustache/releases{/id}","deployments_url":"https://api.github.com/repos/mustache/mustache/deployments","created_at":"2009-09-24T08:20:21Z","updated_at":"2016-02-08T05:32:14Z","pushed_at":"2016-02-08T16:33:20Z","git_url":"git://github.com/mustache/mustache.git","ssh_url":"git@github.com:mustache/mustache.git","clone_url":"https://github.com/mustache/mustache.git","svn_url":"https://github.com/mustache/mustache","homepage":"http://mustache.github.io/","size":1553,"stargazers_count":2124,"watchers_count":2124,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":194,"mirror_url":null,"open_issues_count":19,"forks":194,"open_issues":19,"watchers":2124,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mustache/mustache/pulls/220"},"html":{"href":"https://github.com/mustache/mustache/pull/220"},"issue":{"href":"https://api.github.com/repos/mustache/mustache/issues/220"},"comments":{"href":"https://api.github.com/repos/mustache/mustache/issues/220/comments"},"review_comments":{"href":"https://api.github.com/repos/mustache/mustache/pulls/220/comments"},"review_comment":{"href":"https://api.github.com/repos/mustache/mustache/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mustache/mustache/pulls/220/commits"},"statuses":{"href":"https://api.github.com/repos/mustache/mustache/statuses/71c1c3d6fc54f36d1a35e181bc4e6cd6803d64fe"}}}}