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

Re: [PATCH v2 [rebased]] [Enhancement] Improve internals / refactoring.

From
Brandon Richardson <brandon1024.br@gmail.com>
Date
Feb 2, 2019, 03:09 UTC
Message-ID
<CAETBDP7jw_z_Nz7X-+jne7sYrJ7G92wWsB3S_ipf3XjJwxYxfw@mail.gmail.com>
In-Reply-To
<01020168ab79f642-10a06c5b-c3f7-441e-86f8-bff5e41ac834-000000@eu-west-1.amazonses.com>
Hi Shahzad,
On Fri, 1 Feb 2019 at 19:54, Shahzad Lone <shahzadlone@gmail.com> wrote:
Show 6 quoted lines
>         git_zstream stream;
> -       unsigned char ibuf[1024 * 16];
> -       unsigned char obuf[1024 * 16];
> +       unsigned char ibuf[16384];
> +       unsigned char obuf[16384];
>         unsigned long olen = 0;

This change also brings very little value because most compilers will evaluate constant expressions such as this at compile time. A quick google query on "Constant Folding" will tell you all about this.

I love optimization as much as the next guy, but I also feel an argument can be made for readability too. The former version is far easier to see that the array will be 16KB in size, where 16384 is more difficult to visualize.

Previous: Shahzad LoneNext: Shahzad Lone
Message 7 of 9 in “[Enhancement] Improve internals / refactoring.”
  1. 1/3 [Enhancement] Improve internals / refactoring.Shahzad Lone, Feb 1, 2019
  2. 3/3 It's C not C++ so variable length array should not be used [-Werror=vla] :,).Shahzad Lone, Feb 1, 2019
  3. Eric SunshineFeb 1, 2019
  4. 2/3 ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] so fix that.Shahzad Lone, Feb 1, 2019
  5. Eric SunshineFeb 1, 2019
  6. ] [Enhancement] Improve internals / refactoring.Shahzad Lone, Feb 1, 2019
  7. Brandon RichardsonFeb 2, 2019
  8. ] [Enhancement] Improve internals / refactoring.Shahzad Lone, Feb 2, 2019
  9. Junio C HamanoFeb 4, 2019

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.