{"action":"closed","issue":{"url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/172","repository_url":"https://api.github.com/repos/bvaughn/react-virtualized","labels_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/172/labels{/name}","comments_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/172/comments","events_url":"https://api.github.com/repos/bvaughn/react-virtualized/issues/172/events","html_url":"https://github.com/bvaughn/react-virtualized/issues/172","id":145250319,"number":172,"title":"Suggestion - optimize calls to rowGetter","user":{"login":"joewood","id":1389583,"avatar_url":"https://avatars.githubusercontent.com/u/1389583?v=3","gravatar_id":"","url":"https://api.github.com/users/joewood","html_url":"https://github.com/joewood","followers_url":"https://api.github.com/users/joewood/followers","following_url":"https://api.github.com/users/joewood/following{/other_user}","gists_url":"https://api.github.com/users/joewood/gists{/gist_id}","starred_url":"https://api.github.com/users/joewood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joewood/subscriptions","organizations_url":"https://api.github.com/users/joewood/orgs","repos_url":"https://api.github.com/users/joewood/repos","events_url":"https://api.github.com/users/joewood/events{/privacy}","received_events_url":"https://api.github.com/users/joewood/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bvaughn/react-virtualized/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-01T18:29:18Z","updated_at":"2016-04-01T22:50:13Z","closed_at":"2016-04-01T22:50:13Z","body":"In FlexTable the loop over _createColumn makes a call to rowGetter with the [same rowIndex number](https://github.com/bvaughn/react-virtualized/blob/0b9a6869541c74e55b17927c67434e6727c0c5b5/source/FlexTable/FlexTable.js#L325) for each column in the row. \r\n\r\nCould this call to `rowGetter` be pulled of this loop as it's expected to return the same object for each call? \r\n\r\n```javascript\r\n    const renderedRow = React.Children.map(\r\n      children,\r\n      (column, columnIndex) => this._createColumn(\r\n        column,\r\n        columnIndex,\r\n        rowGetter(rowIndex),\r\n        rowIndex\r\n      )\r\n    )\r\n```\r\nI was using FlexTable and had this function constructing the object and doing some processing. The number of calls into this function could be reduced by simple taking the call out of the loop.\r\n\r\nTo:\r\n```javascript\r\n    const row = rowGetter(rowIndex);\r\n    const renderedRow = React.Children.map(\r\n      children,\r\n      (column, columnIndex) => this._createColumn(\r\n        column,\r\n        columnIndex,\r\n        row,\r\n        rowIndex\r\n      )\r\n    )\r\n```"}}