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

Re: [PATCH v2 11/11] reftable/block: reuse buffer to compute record keys

From
Han-Wen Nienhuys <hanwenn@gmail.com>
Date
Dec 21, 2023, 10:43 UTC
Message-ID
<CAOw_e7bQ+jxO2zhj32mDksq9uBKQfNt=wMNP5K6Oy1DqievCdg@mail.gmail.com>
In-Reply-To
<02b11f3a80608ba8748a0d0e2294f432e02464e5.1702047081.git.ps@pks.im>
On Fri, Dec 8, 2023 at 3:53 PM Patrick Steinhardt <ps@pks.im> wrote:
Show 6 quoted lines
> @@ -84,10 +84,12 @@ struct block_iter {
>
>         /* key for last entry we read. */
>         struct strbuf last_key;
> +       struct strbuf key;
>  };

it's slightly more efficient, but the new field has no essential meaning. If I encountered this code with the change you make here, I would probably refactor it in the opposite direction to increase code clarity.

I suspect that the gains are too small to be measurable, but if you are after small efficiency gains, you can have reftable_record_decode() consume the key to avoid copying overhead in record.c.

-- 
Han-Wen Nienhuys - hanwenn@gmail.com - http://www.xs4all.nl/~hanwen
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 39 of 58 in “reftable: small set of fixes”
  1. 0/8 reftable: small set of fixesPatrick Steinhardt, Nov 21, 2023
  2. 1/8 reftable: wrap EXPECT macros in do/whilePatrick Steinhardt, Nov 21, 2023
  3. 2/8 reftable: handle interrupted readsPatrick Steinhardt, Nov 21, 2023
  4. 3/8 reftable: handle interrupted writesPatrick Steinhardt, Nov 21, 2023
  5. 4/8 reftable/stack: verify that `reftable_stack_add()` uses auto-compactionPatrick Steinhardt, Nov 21, 2023
  6. 5/8 reftable/stack: perform auto-compaction with transactional interfacePatrick Steinhardt, Nov 21, 2023
  7. Han-Wen NienhuysDec 21, 2023
  8. Patrick SteinhardtDec 21, 2023
  9. 6/8 reftable/stack: reuse buffers when reloading stackPatrick Steinhardt, Nov 21, 2023
  10. 7/8 reftable/merged: reuse buffer to compute record keysPatrick Steinhardt, Nov 21, 2023
  11. Han-Wen NienhuysDec 21, 2023
  12. 8/8 reftable/stack: fix stale lock when dyingPatrick Steinhardt, Nov 21, 2023
  13. 00/11 reftable: small set of fixesPatrick Steinhardt, Dec 8, 2023
  14. 01/11 reftable: wrap EXPECT macros in do/whilePatrick Steinhardt, Dec 8, 2023
  15. 02/11 reftable: handle interrupted readsPatrick Steinhardt, Dec 8, 2023
  16. Taylor BlauDec 8, 2023
  17. Patrick SteinhardtDec 11, 2023
  18. 03/11 reftable: handle interrupted writesPatrick Steinhardt, Dec 8, 2023
  19. 04/11 reftable/stack: verify that `reftable_stack_add()` uses auto-compactionPatrick Steinhardt, Dec 8, 2023
  20. Taylor BlauDec 8, 2023
  21. Eric SunshineDec 8, 2023
  22. Patrick SteinhardtDec 11, 2023
  23. Eric SunshineDec 11, 2023
  24. 05/11 reftable/stack: perform auto-compaction with transactional interfacePatrick Steinhardt, Dec 8, 2023
  25. Taylor BlauDec 8, 2023
  26. Patrick SteinhardtDec 11, 2023
  27. 06/11 reftable/stack: reuse buffers when reloading stackPatrick Steinhardt, Dec 8, 2023
  28. Taylor BlauDec 8, 2023
  29. Patrick SteinhardtDec 11, 2023
  30. Han-Wen NienhuysDec 21, 2023
  31. 07/11 reftable/stack: fix stale lock when dyingPatrick Steinhardt, Dec 8, 2023
  32. Taylor BlauDec 8, 2023
  33. Patrick SteinhardtDec 11, 2023
  34. 08/11 reftable/stack: fix use of unseeded randomnessPatrick Steinhardt, Dec 8, 2023
  35. Han-Wen NienhuysDec 21, 2023
  36. 09/11 reftable/merged: reuse buffer to compute record keysPatrick Steinhardt, Dec 8, 2023
  37. 10/11 reftable/block: introduce macro to initialize `struct block_iter`Patrick Steinhardt, Dec 8, 2023
  38. 11/11 reftable/block: reuse buffer to compute record keysPatrick Steinhardt, Dec 8, 2023
  39. Han-Wen NienhuysDec 21, 2023
  40. Patrick SteinhardtDec 28, 2023
  41. Taylor BlauDec 8, 2023
  42. 00/11 reftable: small set of fixesPatrick Steinhardt, Dec 11, 2023
  43. 01/11 reftable: wrap EXPECT macros in do/whilePatrick Steinhardt, Dec 11, 2023
  44. 02/11 reftable: handle interrupted readsPatrick Steinhardt, Dec 11, 2023
  45. 03/11 reftable: handle interrupted writesPatrick Steinhardt, Dec 11, 2023
  46. 04/11 reftable/stack: verify that `reftable_stack_add()` uses auto-compactionPatrick Steinhardt, Dec 11, 2023
  47. Taylor BlauDec 11, 2023
  48. Patrick SteinhardtDec 12, 2023
  49. 05/11 reftable/stack: perform auto-compaction with transactional interfacePatrick Steinhardt, Dec 11, 2023
  50. 06/11 reftable/stack: reuse buffers when reloading stackPatrick Steinhardt, Dec 11, 2023
  51. 07/11 reftable/stack: fix stale lock when dyingPatrick Steinhardt, Dec 11, 2023
  52. 08/11 reftable/stack: fix use of unseeded randomnessPatrick Steinhardt, Dec 11, 2023
  53. 09/11 reftable/merged: reuse buffer to compute record keysPatrick Steinhardt, Dec 11, 2023
  54. 10/11 reftable/block: introduce macro to initialize `struct block_iter`Patrick Steinhardt, Dec 11, 2023
  55. 11/11 reftable/block: reuse buffer to compute record keysPatrick Steinhardt, Dec 11, 2023
  56. Taylor BlauDec 11, 2023
  57. Patrick SteinhardtDec 12, 2023
  58. Han-Wen NienhuysDec 21, 2023

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.