{"action":"created","issue":{"url":"https://api.github.com/repos/thoughtbot/Argo/issues/295","labels_url":"https://api.github.com/repos/thoughtbot/Argo/issues/295/labels{/name}","comments_url":"https://api.github.com/repos/thoughtbot/Argo/issues/295/comments","events_url":"https://api.github.com/repos/thoughtbot/Argo/issues/295/events","html_url":"https://github.com/thoughtbot/Argo/issues/295","id":117019179,"number":295,"title":"Performance issues","user":{"login":"RuiAAPeres","id":949286,"avatar_url":"https://avatars.githubusercontent.com/u/949286?v=3","gravatar_id":"","url":"https://api.github.com/users/RuiAAPeres","html_url":"https://github.com/RuiAAPeres","followers_url":"https://api.github.com/users/RuiAAPeres/followers","following_url":"https://api.github.com/users/RuiAAPeres/following{/other_user}","gists_url":"https://api.github.com/users/RuiAAPeres/gists{/gist_id}","starred_url":"https://api.github.com/users/RuiAAPeres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RuiAAPeres/subscriptions","organizations_url":"https://api.github.com/users/RuiAAPeres/orgs","repos_url":"https://api.github.com/users/RuiAAPeres/repos","events_url":"https://api.github.com/users/RuiAAPeres/events{/privacy}","received_events_url":"https://api.github.com/users/RuiAAPeres/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-15T21:31:26Z","updated_at":"2015-11-16T22:12:23Z","closed_at":null,"body":"I found that on a 4S device, my data model was taking almost 12 seconds, to be parsed. So I did a small experiment with the following:\r\n\r\n```\r\nimport Foundation\r\nimport Argo\r\nimport Curry\r\nimport Runes\r\n\r\nstruct Person {\r\n    \r\n    let firstName: String\r\n    let secondName: String?\r\n    let age: Int\r\n    let hoobies: [String]\r\n    let description: String\r\n}\r\n\r\nextension Person: Decodable {\r\n    \r\n    static func decode(j: JSON) -> Decoded<Person> {\r\n        return curry(Person.init)\r\n            <^> j <| \"firstName\"\r\n            <*> j <|? \"secondName\"\r\n            <*> j <| \"age\"\r\n            <*> j <|| \"hobbies\"\r\n            <*> j <| \"description\"\r\n    }\r\n}\r\n```\r\n\r\nThis is not my original model, but a far simpler one. So I used a testing file with 100k lines of JSON with a total of 9130 objects. The original one has more than 330k lines and far deeper hierarchy and complexity (number of members). \r\n\r\nI wasn't sure which would the best approach so I used the ones I saw in the wild (the measurements are in release mode on a MacbookPro 2015):\r\n\r\n<img width=\"928\" alt=\"screen shot 2015-11-15 at 21 26 40\" src=\"https://cloud.githubusercontent.com/assets/949286/11171109/89243156-8bdf-11e5-8cdf-3eda215cd3b4.png\">\r\n\r\nThen I did the parsing \"by hand\": \r\n\r\n<img width=\"933\" alt=\"screen shot 2015-11-15 at 21 28 09\" src=\"https://cloud.githubusercontent.com/assets/949286/11171111/9c241154-8bdf-11e5-8e0c-f85b52315772.png\">\r\n\r\nObviously, the second version has a lot more boilerplate, it's not as easy to maintain or extend, but in this case all those niceties are not worth with such timings. A demo project can be found [here](https://www.dropbox.com/s/053wr6vib1ssimn/TestingStuff.zip?dl=0). "},"comment":{"url":"https://api.github.com/repos/thoughtbot/Argo/issues/comments/157187826","html_url":"https://github.com/thoughtbot/Argo/issues/295#issuecomment-157187826","issue_url":"https://api.github.com/repos/thoughtbot/Argo/issues/295","id":157187826,"user":{"login":"gfontenot","id":124499,"avatar_url":"https://avatars.githubusercontent.com/u/124499?v=3","gravatar_id":"","url":"https://api.github.com/users/gfontenot","html_url":"https://github.com/gfontenot","followers_url":"https://api.github.com/users/gfontenot/followers","following_url":"https://api.github.com/users/gfontenot/following{/other_user}","gists_url":"https://api.github.com/users/gfontenot/gists{/gist_id}","starred_url":"https://api.github.com/users/gfontenot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfontenot/subscriptions","organizations_url":"https://api.github.com/users/gfontenot/orgs","repos_url":"https://api.github.com/users/gfontenot/repos","events_url":"https://api.github.com/users/gfontenot/events{/privacy}","received_events_url":"https://api.github.com/users/gfontenot/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T22:12:23Z","updated_at":"2015-11-16T22:12:23Z","body":"Hmm. I was hoping that removing the double iteration would have more of an impact than that."}}