{"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":12,"created_at":"2015-09-08T21:59:35Z","updated_at":"2015-09-10T08:16:47Z","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/139163664","html_url":"https://github.com/chebfun/chebfun/issues/1600#issuecomment-139163664","issue_url":"https://api.github.com/repos/chebfun/chebfun/issues/1600","id":139163664,"user":{"login":"nickhale","id":2035010,"avatar_url":"https://avatars.githubusercontent.com/u/2035010?v=3","gravatar_id":"","url":"https://api.github.com/users/nickhale","html_url":"https://github.com/nickhale","followers_url":"https://api.github.com/users/nickhale/followers","following_url":"https://api.github.com/users/nickhale/following{/other_user}","gists_url":"https://api.github.com/users/nickhale/gists{/gist_id}","starred_url":"https://api.github.com/users/nickhale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickhale/subscriptions","organizations_url":"https://api.github.com/users/nickhale/orgs","repos_url":"https://api.github.com/users/nickhale/repos","events_url":"https://api.github.com/users/nickhale/events{/privacy}","received_events_url":"https://api.github.com/users/nickhale/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T08:16:47Z","updated_at":"2015-09-10T08:16:47Z","body":"@jrus - If you want to be super picky; when x is real (which is the 90% case), then the evaluations at breakpoints (including end points) are not used at all, since these are extracted from `f.pointValues`.\r\n\r\nHowever, dealing with all these different cases will probably (a) have very little performance gain, (b) complicate the code significantly."}}