<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/string-list.c, branch v2.16.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.16.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.16.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-10-09T23:57:24Z</updated>
<entry>
<title>cleanup: fix possible overflow errors in binary search</title>
<updated>2017-10-09T23:57:24Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2017-10-08T18:29:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=19716b21a4255ecc7148b54ab2c78039c59f25bf'/>
<id>urn:sha1:19716b21a4255ecc7148b54ab2c78039c59f25bf</id>
<content type='text'>
A common mistake when writing binary search is to allow possible
integer overflow by using the simple average:

	mid = (min + max) / 2;

Instead, use the overflow-safe version:

	mid = min + (max - min) / 2;

This translation is safe since the operation occurs inside a loop
conditioned on "min &lt; max". The included changes were found using
the following git grep:

	git grep '/ *2;' '*.c'

Making this cleanup will prevent future review friction when a new
binary search is contructed based on existing code.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Reviewed-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use MOVE_ARRAY</title>
<updated>2017-07-17T21:54:56Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-07-15T20:00:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f331ab9d4cb21942dcde6d879aaca6a1784e8cb6'/>
<id>urn:sha1:f331ab9d4cb21942dcde6d879aaca6a1784e8cb6</id>
<content type='text'>
Simplify the code for moving members inside of an array and make it more
robust by using the helper macro MOVE_ARRAY.  It calculates the size
based on the specified number of elements for us and supports NULL
pointers when that number is zero.  Raw memmove(3) calls with NULL can
cause the compiler to (over-eagerly) optimize out later NULL checks.

This patch was generated with contrib/coccinelle/array.cocci and spatch
(Coccinelle).

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bw/forking-and-threading'</title>
<updated>2017-05-30T02:16:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-05-30T02:16:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7d5e13f652b4dfbf5e399dd2de32e5954368f0f8'/>
<id>urn:sha1:7d5e13f652b4dfbf5e399dd2de32e5954368f0f8</id>
<content type='text'>
The "run-command" API implementation has been made more robust
against dead-locking in a threaded environment.

* bw/forking-and-threading:
  usage.c: drop set_error_handle()
  run-command: restrict PATH search to executable files
  run-command: expose is_executable function
  run-command: block signals between fork and execve
  run-command: add note about forking and threading
  run-command: handle dup2 and close errors in child
  run-command: eliminate calls to error handling functions in child
  run-command: don't die in child when duping /dev/null
  run-command: prepare child environment before forking
  string-list: add string_list_remove function
  run-command: use the async-signal-safe execv instead of execvp
  run-command: prepare command before forking
  t0061: run_command executes scripts without a #! line
  t5550: use write_script to generate post-update hook
</content>
</entry>
<entry>
<title>Merge branch 'jh/string-list-micro-optim'</title>
<updated>2017-04-24T05:07:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-04-24T05:07:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8b6bba66633cf16807ae962e0b1126af164f0e78'/>
<id>urn:sha1:8b6bba66633cf16807ae962e0b1126af164f0e78</id>
<content type='text'>
The string-list API used a custom reallocation strategy that was
very inefficient, instead of using the usual ALLOC_GROW() macro,
which has been fixed.

* jh/string-list-micro-optim:
  string-list: use ALLOC_GROW macro when reallocing string_list
</content>
</entry>
<entry>
<title>string-list: add string_list_remove function</title>
<updated>2017-04-21T00:55:32Z</updated>
<author>
<name>Brandon Williams</name>
<email>bmwill@google.com</email>
</author>
<published>2017-04-19T23:13:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3a30033327337323e91dcbcb87396d3245260585'/>
<id>urn:sha1:3a30033327337323e91dcbcb87396d3245260585</id>
<content type='text'>
Teach string-list to be able to remove a string from a sorted
'struct string_list'.

Signed-off-by: Brandon Williams &lt;bmwill@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>string-list: use ALLOC_GROW macro when reallocing string_list</title>
<updated>2017-04-15T09:04:41Z</updated>
<author>
<name>Jeff Hostetler</name>
<email>jeffhost@microsoft.com</email>
</author>
<published>2017-04-14T19:51:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=950a234cbd781021d69fcfaa40ab6fd258b1d917'/>
<id>urn:sha1:950a234cbd781021d69fcfaa40ab6fd258b1d917</id>
<content type='text'>
Use ALLOC_GROW() macro when reallocing a string_list array
rather than simply increasing it by 32.  This is a performance
optimization.

During status on a very large repo and there are many changes,
a significant percentage of the total run time is spent
reallocing the wt_status.changes array.

This change decreases the time in wt_status_collect_changes_worktree()
from 125 seconds to 45 seconds on my very large repository.

This produced a modest gain on my 1M file artificial repo, but
broke even on linux.git.

Test                                            HEAD^^            HEAD
---------------------------------------------------------------------------------------
0005.2: read-tree status br_ballast (1000001)   8.29(5.62+2.62)   8.22(5.57+2.63) -0.8%

Signed-off-by: Jeff Hostetler &lt;jeffhost@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>string-list: use QSORT_S in string_list_sort()</title>
<updated>2017-01-23T19:02:38Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-22T17:57:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5ebd9472a490b12ff941b8085b1b0932a755ffcc'/>
<id>urn:sha1:5ebd9472a490b12ff941b8085b1b0932a755ffcc</id>
<content type='text'>
Pass the comparison function to cmp_items() via the context parameter of
qsort_s() instead of using a global variable.  That allows calling
string_list_sort() from multiple parallel threads.

Our qsort_s() in compat/ is slightly slower than qsort(1) from glibc
2.24 for sorting lots of lines:

Test                         HEAD^             HEAD
---------------------------------------------------------------------
0071.2: sort(1)              0.10(0.22+0.01)   0.09(0.21+0.00) -10.0%
0071.3: string_list_sort()   0.16(0.15+0.01)   0.17(0.15+0.00) +6.3%

GNU sort(1) version 8.26 is significantly faster because it uses
multiple parallel threads; with the unportable option --parallel=1 it
becomes slower:

Test                         HEAD^             HEAD
--------------------------------------------------------------------
0071.2: sort(1)              0.21(0.18+0.01)   0.20(0.18+0.01) -4.8%
0071.3: string_list_sort()   0.16(0.13+0.02)   0.17(0.15+0.01) +6.3%

There is some instability -- the numbers for the sort(1) check shouldn't
be affected by this patch.  Anyway, the performance of our qsort_s()
implementation is apparently good enough, at least for this test.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use QSORT</title>
<updated>2016-09-29T22:42:18Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-09-29T15:27:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ed0d8d6e6de7737fe9a658446318b86e57c6fad'/>
<id>urn:sha1:9ed0d8d6e6de7737fe9a658446318b86e57c6fad</id>
<content type='text'>
Apply the semantic patch contrib/coccinelle/qsort.cocci to the code
base, replacing calls of qsort(3) with QSORT.  The resulting code is
shorter and supports empty arrays with NULL pointers.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>string_list: use string-list API in unsorted_string_list_lookup()</title>
<updated>2016-04-25T18:48:27Z</updated>
<author>
<name>Ralf Thielow</name>
<email>ralf.thielow@gmail.com</email>
</author>
<published>2016-04-25T17:40:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d16df0c062e45cbaf42b99963d90c77a0ec9b7df'/>
<id>urn:sha1:d16df0c062e45cbaf42b99963d90c77a0ec9b7df</id>
<content type='text'>
Using the string-list API in function unsorted_string_list_lookup()
makes the code more readable.

Signed-off-by: Ralf Thielow &lt;ralf.thielow@gmail.com&gt;
Acked-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/string-list'</title>
<updated>2014-12-22T20:27:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-22T20:27:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12b9f08953f4f558789f833b0fe438c25ce6d4b1'/>
<id>urn:sha1:12b9f08953f4f558789f833b0fe438c25ce6d4b1</id>
<content type='text'>
API simplification.

* sb/string-list:
  string_list: remove string_list_insert_at_index() from its API
  mailmap: use higher level string list functions
  string_list: document string_list_(insert,lookup)
</content>
</entry>
</feed>
