{"action":"created","issue":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/1600","labels_url":"https://api.github.com/repos/chebfun/chebfun/issues/1600/labels{/name}","comments_url":"https://api.github.com/repos/chebfun/chebfun/issues/1600/comments","events_url":"https://api.github.com/repos/chebfun/chebfun/issues/1600/events","html_url":"https://github.com/chebfun/chebfun/issues/1600","id":105478091,"number":1600,"title":"Unnecessary call to chebfun/size in fevalColumn","user":{"login":"asgeirbirkis","id":3543429,"avatar_url":"https://avatars.githubusercontent.com/u/3543429?v=3","gravatar_id":"","url":"https://api.github.com/users/asgeirbirkis","html_url":"https://github.com/asgeirbirkis","followers_url":"https://api.github.com/users/asgeirbirkis/followers","following_url":"https://api.github.com/users/asgeirbirkis/following{/other_user}","gists_url":"https://api.github.com/users/asgeirbirkis/gists{/gist_id}","starred_url":"https://api.github.com/users/asgeirbirkis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asgeirbirkis/subscriptions","organizations_url":"https://api.github.com/users/asgeirbirkis/orgs","repos_url":"https://api.github.com/users/asgeirbirkis/repos","events_url":"https://api.github.com/users/asgeirbirkis/events{/privacy}","received_events_url":"https://api.github.com/users/asgeirbirkis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chebfun/chebfun/labels/performance","name":"performance","color":"eaff00"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":28,"created_at":"2015-09-08T21:59:35Z","updated_at":"2015-09-11T02:27:00Z","closed_at":null,"body":"Looking at the profiler output when studying #1599, I noticed a lot of calls to `chebfun/size` inside `chebfun/feval/fevalColumn`. These are in [line 85](https://github.com/chebfun/chebfun/blob/fix-chebop-shortPulses/%40chebfun/feval.m#L85).\r\n\r\nHowever, we're only really interested in the result of `chebfun/size` with the second argument equal to 2, which is just what `numColumns` returns (and `numColumns` gets called inside `chebfun/size`). By changing line 85 from\r\n```\r\nnumCols = size(f, 2);\r\n```\r\nto\r\n```\r\nnumCols = numColumns(f);\r\n```\r\n\r\nand running the profiler for `chebtest('chebfun')`, it turns out that it saved more than 13000 calls to `chebfun/size`, while all the tests still passed.\r\n\r\nI'm wondering whether there's a reason for this call to `size` rather than `numColumns` before I issue a PR addressing it.\r\n\r\nI'm also wondering about the line that follows in `fevalColumn`:\r\n```\r\nnumFuns = numel(f.funs);\r\n```\r\nWill this ever be anything else than 1, as things with `numel(f) > 1` only live at the `chebfun` level?"},"comment":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/comments/139432030","html_url":"https://github.com/chebfun/chebfun/issues/1600#issuecomment-139432030","issue_url":"https://api.github.com/repos/chebfun/chebfun/issues/1600","id":139432030,"user":{"login":"jrus","id":83411,"avatar_url":"https://avatars.githubusercontent.com/u/83411?v=3","gravatar_id":"","url":"https://api.github.com/users/jrus","html_url":"https://github.com/jrus","followers_url":"https://api.github.com/users/jrus/followers","following_url":"https://api.github.com/users/jrus/following{/other_user}","gists_url":"https://api.github.com/users/jrus/gists{/gist_id}","starred_url":"https://api.github.com/users/jrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrus/subscriptions","organizations_url":"https://api.github.com/users/jrus/orgs","repos_url":"https://api.github.com/users/jrus/repos","events_url":"https://api.github.com/users/jrus/events{/privacy}","received_events_url":"https://api.github.com/users/jrus/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T02:27:00Z","updated_at":"2015-09-11T02:27:00Z","body":"Here’s a gist of the full file and a diff showing how I’d do it:\r\nhttps://gist.github.com/jrus/7760a42347aa70c7aa05\r\n\r\nI switched to camelCase variable names."}}