unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Execution speed
Date: Sun, 19 Mar 2017 11:12:59 -0400	[thread overview]
Message-ID: <jwv1sttcnv2.fsf-monnier+emacs@gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

Someone on SO reported a surprising behavior where a recursive
implementation of `gcd` turned out faster than the iterative version:

    http://stackoverflow.com/questions/42792988/

The more surprising thing is that when I try it I get the
opposite result, even though it's basically on the same kind of system
(GNU/Linx x86).

I'm curious where the difference might come from.  Could you guys try
out the test?

Just do `emacs -Q --batch -l .../ir-test.el`.  Here's what I got:

    % emacs24 -Q --batch -l ~/tmp/ir-test.el
    Interpreted:  Iterative=1.770s; Recursive=1.937s
    Bytecompiled: Iterative=1.187s; Recursive=1.496s
    % .../src/emacs -Q --batch -l ~/tmp/ir-test.el
    Interpreted:  Iterative=4.496s; Recursive=4.595s
    Bytecompiled: Iterative=2.471s; Recursive=2.983s

where `emacs24` is Debian's whereas the other one is my locally
built&hacked version with debugging assertions and stuff.


        Stefan

[-- Attachment #2: ir-test.el --]
[-- Type: application/emacs-lisp, Size: 992 bytes --]

             reply	other threads:[~2017-03-19 15:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-19 15:12 Stefan Monnier [this message]
2017-03-19 15:26 ` Execution speed Mark Oteiza
2017-03-19 15:32 ` Eli Zaretskii
2017-03-19 16:01 ` Tino Calancha
2017-03-19 16:14 ` Andreas Politz
2017-03-19 16:33 ` Teemu Likonen
2017-03-19 19:09 ` npostavs
2017-03-19 22:49   ` Phil Sainty
2017-03-20 10:36     ` Performance of lexical closures in interpreted code? (was Re: Execution speed) Phil Sainty
2017-03-20 12:50       ` Stefan Monnier
2017-03-20 13:12         ` Stefan Monnier
2017-03-19 22:30 ` Execution speed Phil Sainty
2017-03-20  9:46 ` Ivan Kanis
2017-03-20 10:46   ` Philippe Vaucher
2017-03-20 14:26 ` Filipp Gunbin

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=jwv1sttcnv2.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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).