git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/2] Avoid unnecessary strlen() calls

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 18, 2007, 15:54 UTC
Message-ID
<Pine.LNX.4.64.0703180848580.6730@woody.linux-foundation.org>
In-Reply-To
<7v8xdunavr.fsf@assigned-by-dhcp.cox.net>
On Sun, 18 Mar 2007, Junio C Hamano wrote:
Show 18 quoted lines
> 
> 	git blame -C block/ll_rw_blk.c
> 
> Just for fun, these are the same for the kernel history with tglx-history 
> repository's history grafted behind it, i.e. with this grafts file:
> 
> $ cat .git/info/grafts
> 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 e7e173af42dbf37b1d946f9ee00219cb3b2bea6a
> 
> (v1.5.0)
> 73.80user 2.57system 1:16.40elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (0major+773077minor)pagefaults 0swaps
> 
> (master + three patches)
> 65.14user 0.40system 1:05.55elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (0major+125052minor)pagefaults 0swaps
> 
> In either case, it is showing drastic reduction of minor faults.
That's an interesting test-case (and I get 53 seconds, nyaah, nyaah ;)

However, it's almost totally *not* about object access any more with my patches. All the top profiling hits are about generating the patches and assigning blame:

	samples  %        image name               app name                 symbol name
	470352   15.5813  git                      git                      xdl_hash_record
	298683    9.8944  git                      git                      cmp_suspect
	225156    7.4587  git                      git                      assign_blame
	221308    7.3312  libc-2.5.so              libc-2.5.so              memcpy
	177621    5.8840  libc-2.5.so              libc-2.5.so              memchr
	163571    5.4186  vmlinux                  vmlinux                  __copy_user_nocache
	129301    4.2833  git                      git                      xdl_prepare_ctx
	99009     3.2799  libc-2.5.so              libc-2.5.so              _int_malloc
	83899     2.7793  git                      git                      xdiff_outf
	80588     2.6696  libz.so.1.2.3            libz.so.1.2.3            (no symbols)
	..

so as you can see, libz is down in the 2.5% range, and strlen and the tree accessor functions are totally un the noise.

So it looks like it *used* to be somewhat of a problem (the object access itself must have been about 10 seconds, since that got shaved off the time), but realistically, if you want to speed up "git blame", we can totally ignore the git object data structures, an dconcentrate on xdiff and on blame itself (cmp_suspect and assign_blame probably have some nasty O(n^2) behaviour or something like that, that could hopefully be fixed fairly easily. The xdl hashing is a different thing, and I don't think it's necessarily easy to fix that one..)

			Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 52 of 79 in “cleaner/better zlib sources?”
  1. Linus TorvaldsMar 16, 2007
  2. Shawn O. PearceMar 16, 2007
  3. Jeff GarzikMar 16, 2007
  4. Matt MackallMar 16, 2007
  5. Linus TorvaldsMar 16, 2007
  6. Linus TorvaldsMar 16, 2007
  7. Davide LibenziMar 16, 2007
  8. Linus TorvaldsMar 16, 2007
  9. Davide LibenziMar 16, 2007
  10. Linus TorvaldsMar 16, 2007
  11. Davide LibenziMar 16, 2007
  12. Linus TorvaldsMar 16, 2007
  13. Davide LibenziMar 16, 2007
  14. Linus TorvaldsMar 17, 2007
  15. Linus TorvaldsMar 17, 2007
  16. Nicolas PitreMar 17, 2007
  17. Shawn O. PearceMar 17, 2007
  18. Linus TorvaldsMar 17, 2007
  19. Linus TorvaldsMar 17, 2007
  20. 1/2 Make trivial wrapper functions around delta base generation and freeingLinus Torvalds, Mar 17, 2007
  21. 2/2 Implement a simple delta_base cacheLinus Torvalds, Mar 17, 2007
  22. Linus TorvaldsMar 17, 2007
  23. Junio C HamanoMar 17, 2007
  24. Linus TorvaldsMar 17, 2007
  25. Linus TorvaldsMar 17, 2007
  26. Nicolas PitreMar 18, 2007
  27. Junio C HamanoMar 18, 2007
  28. Junio C HamanoMar 17, 2007
  29. Linus TorvaldsMar 17, 2007
  30. Jon SmirlMar 17, 2007
  31. Morten WelinderMar 18, 2007
  32. Linus TorvaldsMar 18, 2007
  33. Nicolas PitreMar 18, 2007
  34. Linus TorvaldsMar 18, 2007
  35. Nicolas PitreMar 18, 2007
  36. Linus TorvaldsMar 18, 2007
  37. Nicolas PitreMar 18, 2007
  38. Linus TorvaldsMar 18, 2007
  39. Julian PhillipsMar 18, 2007
  40. Linus TorvaldsMar 18, 2007
  41. Robin RosenbergMar 18, 2007
  42. Linus TorvaldsMar 18, 2007
  43. Robin RosenbergMar 18, 2007
  44. Shawn O. PearceMar 18, 2007
  45. David BrodskyMar 19, 2007
  46. Robin RosenbergMar 20, 2007
  47. David BrodskyMar 20, 2007
  48. Linus TorvaldsMar 21, 2007
  49. Nicolas PitreMar 21, 2007
  50. 3/2 Avoid unnecessary strlen() callsLinus Torvalds, Mar 18, 2007
  51. Junio C HamanoMar 18, 2007
  52. Linus TorvaldsMar 18, 2007
  53. Linus TorvaldsMar 18, 2007
  54. Shawn O. PearceMar 18, 2007
  55. Linus TorvaldsMar 18, 2007
  56. Johannes SchindelinMar 20, 2007
  57. Shawn O. PearceMar 20, 2007
  58. Shawn O. PearceMar 20, 2007
  59. Linus TorvaldsMar 20, 2007
  60. Shawn O. PearceMar 20, 2007
  61. Linus TorvaldsMar 20, 2007
  62. Junio C HamanoMar 20, 2007
  63. Junio C HamanoMar 20, 2007
  64. Linus TorvaldsMar 20, 2007
  65. Shawn O. PearceMar 20, 2007
  66. Linus TorvaldsMar 20, 2007
  67. Linus TorvaldsMar 18, 2007
  68. Avi KivityMar 18, 2007
  69. Linus TorvaldsMar 17, 2007
  70. Jeff GarzikMar 16, 2007
  71. Matt MackallMar 16, 2007
  72. Linus TorvaldsMar 16, 2007
  73. Nicolas PitreMar 16, 2007
  74. Shawn O. PearceMar 16, 2007
  75. Nicolas PitreMar 16, 2007
  76. Linus TorvaldsMar 16, 2007
  77. Nicolas PitreMar 16, 2007
  78. Davide LibenziMar 16, 2007
  79. Davide LibenziMar 16, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.