{"action":"created","issue":{"url":"https://api.github.com/repos/astaxie/build-web-application-with-golang/issues/578","labels_url":"https://api.github.com/repos/astaxie/build-web-application-with-golang/issues/578/labels{/name}","comments_url":"https://api.github.com/repos/astaxie/build-web-application-with-golang/issues/578/comments","events_url":"https://api.github.com/repos/astaxie/build-web-application-with-golang/issues/578/events","html_url":"https://github.com/astaxie/build-web-application-with-golang/issues/578","id":122873011,"number":578,"title":"关于GO逐行读取大文件的问题，Go为什么耗费时间是PHP7的8倍？","user":{"login":"lixuancn","id":6368760,"avatar_url":"https://avatars.githubusercontent.com/u/6368760?v=3","gravatar_id":"","url":"https://api.github.com/users/lixuancn","html_url":"https://github.com/lixuancn","followers_url":"https://api.github.com/users/lixuancn/followers","following_url":"https://api.github.com/users/lixuancn/following{/other_user}","gists_url":"https://api.github.com/users/lixuancn/gists{/gist_id}","starred_url":"https://api.github.com/users/lixuancn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lixuancn/subscriptions","organizations_url":"https://api.github.com/users/lixuancn/orgs","repos_url":"https://api.github.com/users/lixuancn/repos","events_url":"https://api.github.com/users/lixuancn/events{/privacy}","received_events_url":"https://api.github.com/users/lixuancn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-12-18T03:40:55Z","updated_at":"2015-12-26T05:30:08Z","closed_at":"2015-12-25T02:43:54Z","body":"最近写了个脚本，作为学习Go以来第一个实战。但是效果不理想。\r\n\r\n一个文件。13G。逐行读取，将读取到的内容按空格切割为数组，取数组中Key＝8的值累加。最后得到这个累加的值。\r\n\r\n很简单的文件处理程序。Go和PHP都是单线程顺序执行。\r\n\r\n虽然PHP是最好的语言，但是Go作为编译型强类型语言，在我的认知里要比PHP快得多才对，就像C的速度是PHP5的1000倍。可现在Go为什么会出现这样的结果？\r\n\r\nGo用了300秒，PHP5.6用了200秒，PHP7用了47秒。我是真的不敢相信这就是Google大力推广的Go。我宁愿相信这是我代码的问题\r\n\r\n代码：http://www.oschina.net/question/938918_2145778\r\n\r\n我周围没什么懂Go的人，问都不知道问谁了。国内社区基本很难获得理想的答案。请赐教！"},"comment":{"url":"https://api.github.com/repos/astaxie/build-web-application-with-golang/issues/comments/167280867","html_url":"https://github.com/astaxie/build-web-application-with-golang/issues/578#issuecomment-167280867","issue_url":"https://api.github.com/repos/astaxie/build-web-application-with-golang/issues/578","id":167280867,"user":{"login":"wheelcomplex","id":1411633,"avatar_url":"https://avatars.githubusercontent.com/u/1411633?v=3","gravatar_id":"","url":"https://api.github.com/users/wheelcomplex","html_url":"https://github.com/wheelcomplex","followers_url":"https://api.github.com/users/wheelcomplex/followers","following_url":"https://api.github.com/users/wheelcomplex/following{/other_user}","gists_url":"https://api.github.com/users/wheelcomplex/gists{/gist_id}","starred_url":"https://api.github.com/users/wheelcomplex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wheelcomplex/subscriptions","organizations_url":"https://api.github.com/users/wheelcomplex/orgs","repos_url":"https://api.github.com/users/wheelcomplex/repos","events_url":"https://api.github.com/users/wheelcomplex/events{/privacy}","received_events_url":"https://api.github.com/users/wheelcomplex/received_events","type":"User","site_admin":false},"created_at":"2015-12-26T05:30:08Z","updated_at":"2015-12-26T05:30:08Z","body":"从go profile看，是strings.Fields函数效率不高引起。"}}