{"action":"created","issue":{"url":"https://api.github.com/repos/seattlerb/sexp_processor/issues/17","labels_url":"https://api.github.com/repos/seattlerb/sexp_processor/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/seattlerb/sexp_processor/issues/17/comments","events_url":"https://api.github.com/repos/seattlerb/sexp_processor/issues/17/events","html_url":"https://github.com/seattlerb/sexp_processor/pull/17","id":68217986,"number":17,"title":"Cache processor/rewrite methods per class","user":{"login":"presidentbeef","id":75613,"avatar_url":"https://avatars.githubusercontent.com/u/75613?v=3","gravatar_id":"","url":"https://api.github.com/users/presidentbeef","html_url":"https://github.com/presidentbeef","followers_url":"https://api.github.com/users/presidentbeef/followers","following_url":"https://api.github.com/users/presidentbeef/following{/other_user}","gists_url":"https://api.github.com/users/presidentbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/presidentbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/presidentbeef/subscriptions","organizations_url":"https://api.github.com/users/presidentbeef/orgs","repos_url":"https://api.github.com/users/presidentbeef/repos","events_url":"https://api.github.com/users/presidentbeef/events{/privacy}","received_events_url":"https://api.github.com/users/presidentbeef/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-04-13T23:28:23Z","updated_at":"2015-04-14T00:06:43Z","closed_at":"2015-04-14T00:05:42Z","pull_request":{"url":"https://api.github.com/repos/seattlerb/sexp_processor/pulls/17","html_url":"https://github.com/seattlerb/sexp_processor/pull/17","diff_url":"https://github.com/seattlerb/sexp_processor/pull/17.diff","patch_url":"https://github.com/seattlerb/sexp_processor/pull/17.patch"},"body":"I am not sure this is worth changing.\r\n\r\nHere are my results for 10,000 calls to `SexpProcessor.new` (script below).\r\n\r\nCurrent master (5b5742753b7c1297172be1105f82c99a25e3ae71):\r\n```\r\n                    user     system      total        real\r\n10000 instances  1.050000   0.010000   1.060000 (  1.067324)\r\n```\r\n\r\nWith this change:\r\n```\r\n                     user     system      total        real\r\n10000 instances  0.020000   0.000000   0.020000 (  0.017636)\r\n```\r\n\r\nObviously there is a difference, but I'm not sure how many people are creating tens of thousands of instances of `SexpProcessor`.\r\n\r\nThe downside to this is that once the class has been instantiated once, any added methods will not be picked up. I thought to use `method_added` for this, but it turns out it would miss any methods not directly added to the class (e.g. via modules).\r\n\r\nAnyway, just throwing it out there.\r\n\r\nThis was my test script:\r\n\r\n```ruby\r\n$LOAD_PATH << \"lib\"\r\n\r\nrequire 'benchmark'\r\nrequire 'sexp'\r\nrequire 'sexp_processor'\r\nTIMES = 10000\r\n\r\nBenchmark.bm do |t|\r\n  t.report(\"#{TIMES} instances\") do\r\n    TIMES.times do\r\n      SexpProcessor.new\r\n    end\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/seattlerb/sexp_processor/issues/comments/92542598","html_url":"https://github.com/seattlerb/sexp_processor/pull/17#issuecomment-92542598","issue_url":"https://api.github.com/repos/seattlerb/sexp_processor/issues/17","id":92542598,"user":{"login":"presidentbeef","id":75613,"avatar_url":"https://avatars.githubusercontent.com/u/75613?v=3","gravatar_id":"","url":"https://api.github.com/users/presidentbeef","html_url":"https://github.com/presidentbeef","followers_url":"https://api.github.com/users/presidentbeef/followers","following_url":"https://api.github.com/users/presidentbeef/following{/other_user}","gists_url":"https://api.github.com/users/presidentbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/presidentbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/presidentbeef/subscriptions","organizations_url":"https://api.github.com/users/presidentbeef/orgs","repos_url":"https://api.github.com/users/presidentbeef/repos","events_url":"https://api.github.com/users/presidentbeef/events{/privacy}","received_events_url":"https://api.github.com/users/presidentbeef/received_events","type":"User","site_admin":false},"created_at":"2015-04-14T00:06:43Z","updated_at":"2015-04-14T00:06:43Z","body":"Haha, cool. There is the caveat that methods added after `new` is called will be ignored. I'm not doing that anywhere, but it's possible someone is."}}