commit: faster parsing
commit: faster parsing

The current code issues a lot of strncmp() calls in order to check for
the end of the header, simply in order to copy it and start going
through it again. These are a lot of calls for something we can check as
we go along. Knowing the amount of parents beforehand to reduce
allocations in extreme cases does not make up for them.

Instead start parsing immediately and check for the double-newline after
each header field, leaving the raw_header allocation for the end, which
lets us go through the header once and reduces the amount of strncmp()
calls significantly.

In unscientific testing, this has reduced a shortlog-like usage (walking
though the whole history of a branch and extracting data from the
commits) of git.git from ~830ms to ~700ms and makes the time we spend in
strncmp() negligible.

ardumont/libgit2,sygool/libgit2,JIghtuse/libgit2,sim0629/libgit2,swisspol/DEMO-libgit2,Snazz2001/libgit2,dleehr/libgit2,amyvmiwei/libgit2,falqas/libgit2,saurabhsuniljain/libgit2,jflesch/libgit2-mariadb,kissthink/libgit2,skabel/manguse,iankronquist/libgit2,Snazz2001/libgit2,MrHacky/libgit2,linquize/libgit2,Corillian/libgit2,nokiddin/libgit2,mrksrm/Mingijura,saurabhsuniljain/libgit2,mrksrm/Mingijura,spraints/libgit2,yosefhackmon/libgit2,Aorjoa/libgit2_maked_lib,maxiaoqian/libgit2,amyvmiwei/libgit2,whoisj/libgit2,chiayolin/libgit2,iankronquist/libgit2,rcorre/libgit2,oaastest/libgit2,sim0629/libgit2,stewid/libgit2,yosefhackmon/libgit2,Corillian/libgit2,mcanthony/libgit2,ardumont/libgit2,kenprice/libgit2,yongthecoder/libgit2,joshtriplett/libgit2,iankronquist/libgit2,swisspol/DEMO-libgit2,oaastest/libgit2,jeffhostetler/public_libgit2,joshtriplett/libgit2,yongthecoder/libgit2,JIghtuse/libgit2,sim0629/libgit2,Aorjoa/libgit2_maked_lib,stewid/libgit2,since2014/libgit2,nokiddin/libgit2,swisspol/DEMO-libgit2,jflesch/libgit2-mariadb,KTXSoftware/libgit2,skabel/manguse,since2014/libgit2,chiayolin/libgit2,KTXSoftware/libgit2,amyvmiwei/libgit2,kenprice/libgit2,claudelee/libgit2,sygool/libgit2,dleehr/libgit2,t0xicCode/libgit2,ardumont/libgit2,Tousiph/Demo1,leoyanggit/libgit2,rcorre/libgit2,nokiddin/libgit2,joshtriplett/libgit2,falqas/libgit2,MrHacky/libgit2,Tousiph/Demo1,jeffhostetler/public_libgit2,maxiaoqian/libgit2,Tousiph/Demo1,sim0629/libgit2,maxiaoqian/libgit2,stewid/libgit2,mcanthony/libgit2,falqas/libgit2,skabel/manguse,claudelee/libgit2,saurabhsuniljain/libgit2,falqas/libgit2,spraints/libgit2,mingyaaaa/libgit2,spraints/libgit2,t0xicCode/libgit2,magnus98/TEST,leoyanggit/libgit2,mcanthony/libgit2,MrHacky/libgit2,Corillian/libgit2,falqas/libgit2,since2014/libgit2,oaastest/libgit2,Aorjoa/libgit2_maked_lib,yosefhackmon/libgit2,skabel/manguse,linquize/libgit2,sygool/libgit2,mrksrm/Mingijura,kissthink/libgit2,Snazz2001/libgit2,Snazz2001/libgit2,spraints/libgit2,mhp/libgit2,mingyaaaa/libgit2,MrHacky/libgit2,jflesch/libgit2-mariadb,since2014/libgit2,whoisj/libgit2,rcorre/libgit2,leoyanggit/libgit2,maxiaoqian/libgit2,mhp/libgit2,swisspol/DEMO-libgit2,raybrad/libit2,nokiddin/libgit2,yosefhackmon/libgit2,JIghtuse/libgit2,dleehr/libgit2,skabel/manguse,jeffhostetler/public_libgit2,kenprice/libgit2,whoisj/libgit2,since2014/libgit2,claudelee/libgit2,falqas/libgit2,Snazz2001/libgit2,raybrad/libit2,t0xicCode/libgit2,oaastest/libgit2,MrHacky/libgit2,dleehr/libgit2,jeffhostetler/public_libgit2,mcanthony/libgit2,t0xicCode/libgit2,yosefhackmon/libgit2,joshtriplett/libgit2,leoyanggit/libgit2,whoisj/libgit2,raybrad/libit2,sygool/libgit2,jflesch/libgit2-mariadb,yongthecoder/libgit2,oaastest/libgit2,whoisj/libgit2,Corillian/libgit2,kissthink/libgit2,since2014/libgit2,sim0629/libgit2,JIghtuse/libgit2,maxiaoqian/libgit2,mhp/libgit2,chiayolin/libgit2,yongthecoder/libgit2,JIghtuse/libgit2,KTXSoftware/libgit2,nokiddin/libgit2,amyvmiwei/libgit2,spraints/libgit2,Corillian/libgit2,mingyaaaa/libgit2,JIghtuse/libgit2,claudelee/libgit2,MrHacky/libgit2,chiayolin/libgit2,magnus98/TEST,magnus98/TEST,KTXSoftware/libgit2,claudelee/libgit2,mhp/libgit2,mrksrm/Mingijura,claudelee/libgit2,magnus98/TEST,saurabhsuniljain/libgit2,dleehr/libgit2,chiayolin/libgit2,kenprice/libgit2,saurabhsuniljain/libgit2,kenprice/libgit2,mrksrm/Mingijura,magnus98/TEST,ardumont/libgit2,Aorjoa/libgit2_maked_lib,iankronquist/libgit2,sygool/libgit2,Tousiph/Demo1,stewid/libgit2,jeffhostetler/public_libgit2,iankronquist/libgit2,jflesch/libgit2-mariadb,kissthink/libgit2,rcorre/libgit2,kissthink/libgit2,Corillian/libgit2,Snazz2001/libgit2,yongthecoder/libgit2,mhp/libgit2,jeffhostetler/public_libgit2,rcorre/libgit2,t0xicCode/libgit2,linquize/libgit2,whoisj/libgit2,leoyanggit/libgit2,Tousiph/Demo1,chiayolin/libgit2,sim0629/libgit2,saurabhsuniljain/libgit2,t0xicCode/libgit2,dleehr/libgit2,Aorjoa/libgit2_maked_lib,spraints/libgit2,raybrad/libit2,joshtriplett/libgit2,stewid/libgit2,raybrad/libit2,oaastest/libgit2,iankronquist/libgit2,swisspol/DEMO-libgit2,rcorre/libgit2,jflesch/libgit2-mariadb,kissthink/libgit2,swisspol/DEMO-libgit2,stewid/libgit2,mcanthony/libgit2,linquize/libgit2,yongthecoder/libgit2,kenprice/libgit2,linquize/libgit2,mrksrm/Mingijura,sygool/libgit2,mhp/libgit2,mingyaaaa/libgit2,amyvmiwei/libgit2,KTXSoftware/libgit2,Tousiph/Demo1,mingyaaaa/libgit2,yosefhackmon/libgit2,ardumont/libgit2,nokiddin/libgit2,mcanthony/libgit2,leoyanggit/libgit2,KTXSoftware/libgit2,mingyaaaa/libgit2,maxiaoqian/libgit2,magnus98/TEST,amyvmiwei/libgit2,skabel/manguse,linquize/libgit2,joshtriplett/libgit2,ardumont/libgit2