all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Juan José García-Ripoll" <juanjose.garciaripoll@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: decompress.c now also compresses
Date: Sun, 29 Mar 2020 19:11:16 +0300	[thread overview]
Message-ID: <83369r5efv.fsf@gnu.org> (raw)
In-Reply-To: <86zhbz17mk.fsf@csic.es> (juanjose.garciaripoll@gmail.com)

> From: Juan José García-Ripoll
>  <juanjose.garciaripoll@gmail.com>
> Date: Sun, 29 Mar 2020 17:52:03 +0200
> 
> I attach a patch that adds support for compressing buffers using
> zlib. It is a minor extension to the file src/decompress.c but it may be
> useful because of two reasons (i) in Windows, Emasc is shipped without
> g[un]zip.exe, (ii) the whole process of compression takes about 20 times
> less time than calling gzip.
> 
> (benchmark 1
>   '(mapc 'simple-zlib-compress
>       (directory-files  "~/emacs-build/git/emacs-27/lisp/" t ".*\\.el")))
> ;; => Elapsed time: 2.602588s (0.014894s in 1 GCs)
> 
> (benchmark 1
>   '(mapc 'simple-gzip-compress
>        (directory-files  "~/emacs-build/git/emacs-27/lisp/" t ".*\\.el")))
> ;; => Elapsed time: 61.986128s (0.039815s in 3 GCs)

The timing might look very different on platforms other than Windows.

> I attach a patch that was produced against emacs-27 but also seems to
> work against emacs-28 (at least the decompress.c part, I am unsure about
> how NEWS should be edited).

Thanks.

Something is wrong with your Git installation, I think: for some
reason Git thinks that you are replacing the entire decompress.c file,
with nothing in common.  I suspect some end-of-line convention snafu.
Did you perhaps install Git with option other than "checkout as-is,
commit as-is"?  If so, please reinstall Git.  Or maybe you saved the
modified decompress.c with CRLF end-of-line format?

> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -3656,6 +3656,10 @@ easier to undo immediately afterwards.
>  ** When called interactively, 'next-buffer' and 'previous-buffer' now
>  signal 'user-error' if there is no buffer to switch to.
>  
> +---
> +** New function 'zlib-compress-region' compresses a unibyte buffer region using
> +gzip's format, via the zlib library.

This should be +++, not ---, and we should document this primitive in
the Elisp manual, like we do with zlib-decompress-region.

We also request a ChangeLog-style commit log message to go with ach
contribution; please provide one.

Last, but not least: I'm not convinced that we would need such a
primitive (the decompression primitive was provided to support
decompression of payloads received via network protocols, but there's
no similar reason for the compression routine).  So before you invest
more work in this, let's hear opinions from others regarding the
necessity.

A couple more specific comments below:

> +If optional parameter NO-WRAPPER is nil or omitted, use the GZIP
> +wrapper format; otherwise, output just a deflated stream of
> +bytes. If decompression is completely successful return t.
        ^^
In doc strings, comments, and manuals, we use the US English
convention of leaving 2 spaces between sentences.

> +This function can be called only in unibyte buffers.*/)
                                                      ^^
Please leave two spaces between the end of the sentence and the
comment delimiter (here and elsewhere in the patch). 



  parent reply	other threads:[~2020-03-29 16:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29 15:52 decompress.c now also compresses Juan José García-Ripoll
2020-03-29 15:57 ` Juan José García-Ripoll
2020-03-29 16:11 ` Eli Zaretskii [this message]
2020-03-29 16:48   ` Juan José García-Ripoll
2020-03-29 16:54 ` Stefan Monnier
2020-03-29 19:27   ` Juan José García-Ripoll

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83369r5efv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=juanjose.garciaripoll@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.