bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] md5: accepts a new --threads option


From: Jim Meyering
Subject: Re: [PATCH] md5: accepts a new --threads option
Date: Fri, 23 Oct 2009 12:22:16 +0200

Pádraig Brady wrote:
...
> This results in a significant decrease in syscall overhead
> giving a 3% speedup to the digest utilities for example
> (when processing large files from cache).
> Storage is moved from the stack to the heap as some
> threaded environments for example can have small stacks.
...
> +     Use a better IO block size for modern systems
> +     * lib/copy-file.c (copy_file_preserving): Used a 32KiB malloced buffer.
> +     * lib/md2.c: Likewise.
> +     * lib/md4.c: Likewise.
> +     * lib/md5.c: Likewise.
> +     * lib/sha1.c: Likewise.
> +     * lib/sha256.c: Likewise.
> +     * lib/sha512.c: Likewise.
...
>  void
>  copy_file_preserving (const char *src_filename, const char *dest_filename)
> @@ -58,8 +60,7 @@ copy_file_preserving (const char *src_filename, const char 
> *dest_filename)
>    struct stat statbuf;
>    int mode;
>    int dest_fd;
> -  char buf[4096];
> -  const size_t buf_size = sizeof (buf);
> +  char *buf = xmalloc (IO_SIZE);

Hi Pádraig,

We must not use functions like xmalloc (that can exit)
from within library code.

Instead, you might want to use malloc, and if that fails,
revert to using the buffer on the stack.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]