From: Leo <sdl.web@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Move sha1 to C?
Date: Tue, 24 May 2011 01:38:35 +0800 [thread overview]
Message-ID: <m14o4l71wk.fsf@th041094.ip.tsinghua.edu.cn> (raw)
In-Reply-To: <E1QOPS3-0000UM-C6@fencepost.gnu.org> (Eli Zaretskii's message of "Mon, 23 May 2011 03:21:19 -0400")
On 2011-05-23 15:21 +0800, Eli Zaretskii wrote:
> Note that gnulib's sha1.c uses malloc, which is not safe in Emacs.
> So either make sure sha1_stream is never ever called by Emacs, or use
> xmalloc instead.
For the record, it seems there is no need to use sha1_stream:
(defun sha1-file (file)
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents file)
(sha1 (current-buffer))))
(benchmark-run 1 (sha1-file "Path-to-a-700M-file"))
(9.66299 1 0.11788399999999999)
(benchmark-run 1 (shell-command-to-string "shasum Path-to-a-700M-file"))
(5.64725 0 0.0)
Leo
prev parent reply other threads:[~2011-05-23 17:38 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-21 6:37 Move sha1 to C? Leo
2011-05-22 19:04 ` Stefan Monnier
2011-05-22 20:02 ` Leo
2011-05-23 1:23 ` Stefan Monnier
2011-05-23 8:44 ` Leo
2011-05-23 12:04 ` Stefan Monnier
2011-05-23 13:21 ` Leo
2011-05-23 13:27 ` Stefan Monnier
2011-05-23 13:34 ` Leo
2011-05-23 13:57 ` Stefan Monnier
2011-05-23 18:14 ` Leo
2011-05-23 19:15 ` Stefan Monnier
2011-05-23 22:10 ` Paul Eggert
2011-05-24 4:09 ` Leo
2011-05-24 10:01 ` Eli Zaretskii
2011-05-24 14:24 ` Leo
2011-05-24 22:01 ` Richard Stallman
2011-05-24 5:09 ` Thien-Thi Nguyen
2011-05-23 14:30 ` Eli Zaretskii
2011-05-23 17:47 ` Leo
2011-05-23 18:12 ` Eli Zaretskii
2011-05-23 18:23 ` Leo
2011-05-23 19:21 ` Eli Zaretskii
2011-05-23 7:21 ` Eli Zaretskii
2011-05-23 8:30 ` Leo
2011-05-23 15:27 ` Chong Yidong
2011-05-23 17:14 ` Leo
2011-05-23 17:38 ` Leo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m14o4l71wk.fsf@th041094.ip.tsinghua.edu.cn \
--to=sdl.web@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).