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

[PATCH v2 0/7] reftable: improvements for the `binsearch()` mechanism

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 25, 2024, 10:10 UTC
Message-ID
<cover.1711361340.git.ps@pks.im>
In-Reply-To
<cover.1711109214.git.ps@pks.im>
Hi,

this is the second version of my patch series that refactors the `binsearch()` mechanism in the reftable library. There's only a single change compared to v1, namely a renamed struct.

Thanks!
Patrick
Patrick Steinhardt (7):
  reftable/basics: fix return type of `binsearch()` to be `size_t`
  reftable/basics: improve `binsearch()` test
  reftable/refname: refactor binary search over refnames
  reftable/block: refactor binary search over restart points
  reftable/block: fix error handling when searching restart points
  reftable/record: extract function to decode key lengths
  reftable/block: avoid decoding keys when searching restart points
 reftable/basics.c      |   7 ++-
 reftable/basics.h      |   7 +--
 reftable/basics_test.c |  55 +++++++++++---------
 reftable/block.c       | 114 ++++++++++++++++++++++++++++++-----------
 reftable/record.c      |  34 ++++++++----
 reftable/record.h      |   6 +++
 reftable/refname.c     |  53 +++++++++----------
 7 files changed, 179 insertions(+), 97 deletions(-)
Range-diff against v1:
1:  cd82ac6531 = 1:  cd82ac6531 reftable/basics: fix return type of `binsearch()` to be `size_t`
2:  7955f7983a ! 2:  a277d4fa6f reftable/basics: improve `binsearch()` test
    @@ reftable/basics_test.c: license that can be found in the LICENSE file or at
     -struct binsearch_args {
     -	int key;
     -	int *arr;
    -+struct integer_needle_lesseq {
    ++struct integer_needle_lesseq_args {
     +	int needle;
     +	int *haystack;
      };
    @@ reftable/basics_test.c: license that can be found in the LICENSE file or at
     -	struct binsearch_args *args = void_args;
     -
     -	return args->key < args->arr[i];
    -+	struct integer_needle_lesseq *args = _args;
    ++	struct integer_needle_lesseq_args *args = _args;
     +	return args->needle <= args->haystack[i];
      }
      
    @@ reftable/basics_test.c: license that can be found in the LICENSE file or at
     -		args.key = i;
     -		res = binsearch(sz, &binsearch_func, &args);
     +	for (i = 0; i < ARRAY_SIZE(testcases); i++) {
    -+		struct integer_needle_lesseq args = {
    ++		struct integer_needle_lesseq_args args = {
     +			.haystack = haystack,
     +			.needle = testcases[i].needle,
     +		};
3:  44386818ce = 3:  9ffcf45c32 reftable/refname: refactor binary search over refnames
4:  f56275f288 = 4:  5e20d93ae0 reftable/block: refactor binary search over restart points
5:  36b1ef8e5c = 5:  5bbeab114f reftable/block: fix error handling when searching restart points
6:  38666de451 = 6:  271bacb210 reftable/record: extract function to decode key lengths
7:  f716400686 = 7:  e751b3c536 reftable/block: avoid decoding keys when searching restart points
-- 
2.44.GIT
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 13 of 45 in “reftable: improvements for the `binsearch()` mechanism”
  1. 0/7 reftable: improvements for the `binsearch()` mechanismPatrick Steinhardt, Mar 22, 2024
  2. 1/7 reftable/basics: fix return type of `binsearch()` to be `size_t`Patrick Steinhardt, Mar 22, 2024
  3. 2/7 reftable/basics: improve `binsearch()` testPatrick Steinhardt, Mar 22, 2024
  4. Justin ToblerMar 22, 2024
  5. Patrick SteinhardtMar 25, 2024
  6. 3/7 reftable/refname: refactor binary search over refnamesPatrick Steinhardt, Mar 22, 2024
  7. Justin ToblerMar 22, 2024
  8. Patrick SteinhardtMar 25, 2024
  9. 4/7 reftable/block: refactor binary search over restart pointsPatrick Steinhardt, Mar 22, 2024
  10. 5/7 reftable/block: fix error handling when searching restart pointsPatrick Steinhardt, Mar 22, 2024
  11. 6/7 reftable/record: extract function to decode key lengthsPatrick Steinhardt, Mar 22, 2024
  12. 7/7 reftable/block: avoid decoding keys when searching restart pointsPatrick Steinhardt, Mar 22, 2024
  13. 0/7 reftable: improvements for the `binsearch()` mechanismPatrick Steinhardt, Mar 25, 2024
  14. 1/7 reftable/basics: fix return type of `binsearch()` to be `size_t`Patrick Steinhardt, Mar 25, 2024
  15. 2/7 reftable/basics: improve `binsearch()` testPatrick Steinhardt, Mar 25, 2024
  16. 3/7 reftable/refname: refactor binary search over refnamesPatrick Steinhardt, Mar 25, 2024
  17. Justin ToblerApr 2, 2024
  18. Patrick SteinhardtApr 2, 2024
  19. 4/7 reftable/block: refactor binary search over restart pointsPatrick Steinhardt, Mar 25, 2024
  20. Justin ToblerApr 2, 2024
  21. Patrick SteinhardtApr 2, 2024
  22. Justin ToblerApr 2, 2024
  23. Patrick SteinhardtApr 3, 2024
  24. 5/7 reftable/block: fix error handling when searching restart pointsPatrick Steinhardt, Mar 25, 2024
  25. 6/7 reftable/record: extract function to decode key lengthsPatrick Steinhardt, Mar 25, 2024
  26. 7/7 reftable/block: avoid decoding keys when searching restart pointsPatrick Steinhardt, Mar 25, 2024
  27. Justin ToblerApr 2, 2024
  28. Patrick SteinhardtApr 2, 2024
  29. 0/7 reftable: improvements for the `binsearch()` mechanismPatrick Steinhardt, Apr 2, 2024
  30. 1/7 reftable/basics: fix return type of `binsearch()` to be `size_t`Patrick Steinhardt, Apr 2, 2024
  31. 2/7 reftable/basics: improve `binsearch()` testPatrick Steinhardt, Apr 2, 2024
  32. 3/7 reftable/refname: refactor binary search over refnamesPatrick Steinhardt, Apr 2, 2024
  33. 4/7 reftable/block: refactor binary search over restart pointsPatrick Steinhardt, Apr 2, 2024
  34. 5/7 reftable/block: fix error handling when searching restart pointsPatrick Steinhardt, Apr 2, 2024
  35. 6/7 reftable/record: extract function to decode key lengthsPatrick Steinhardt, Apr 2, 2024
  36. 7/7 reftable/block: avoid decoding keys when searching restart pointsPatrick Steinhardt, Apr 2, 2024
  37. Justin ToblerApr 2, 2024
  38. 0/7 reftable: improvements for the `binsearch()` mechanismPatrick Steinhardt, Apr 3, 2024
  39. 1/7 reftable/basics: fix return type of `binsearch()` to be `size_t`Patrick Steinhardt, Apr 3, 2024
  40. 2/7 reftable/basics: improve `binsearch()` testPatrick Steinhardt, Apr 3, 2024
  41. 3/7 reftable/refname: refactor binary search over refnamesPatrick Steinhardt, Apr 3, 2024
  42. 4/7 reftable/block: refactor binary search over restart pointsPatrick Steinhardt, Apr 3, 2024
  43. 5/7 reftable/block: fix error handling when searching restart pointsPatrick Steinhardt, Apr 3, 2024
  44. 6/7 reftable/record: extract function to decode key lengthsPatrick Steinhardt, Apr 3, 2024
  45. 7/7 reftable/block: avoid decoding keys when searching restart pointsPatrick Steinhardt, Apr 3, 2024

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.