unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Felician Nemeth <felician.nemeth@gmail.com>
To: emacs-devel@gnu.org
Cc: Philip Kaludercic <philipk@posteo.net>
Subject: (byte-compile '(append '(1 2) '(3 4)))
Date: Sat, 16 Mar 2024 13:16:36 +0100	[thread overview]
Message-ID: <87r0gatlqz.fsf_-_@betli.tmit.bme.hu> (raw)
In-Reply-To: <87bk7p57yz.fsf@posteo.net> (Philip Kaludercic's message of "Fri,  08 Mar 2024 10:33:08 +0000")

(disassemble (byte-compile '(append '(1 2) '(3 4))))

resuts in

byte code:
  args: nil
0	constant  append
1	constant  (1 2)
2	constant  (3 4)
3	call	  2
4	return	  

Instead I expected it to be something like

byte code:
  args: nil
0	constant  1
1	constant  2
2	constant  3
3	constant  4
4	list4	  
5	return	  

I've never looked at byte-code optimization before, and I'm guessing
this is not a huge improvement, but I still wonder when all the
arguments of side-effect-free function are constants would it make sense
to calculate the result at compile time.

Thanks.



       reply	other threads:[~2024-03-16 12:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87v8j28c2x.fsf@betli.tmit.bme.hu>
     [not found] ` <874jdipfp5.fsf@posteo.net>
     [not found]   ` <87cys6t734.fsf@betli.tmit.bme.hu>
     [not found]     ` <87r0gmnjq4.fsf@posteo.net>
     [not found]       ` <87o7bprr04.fsf@betli.tmit.bme.hu>
     [not found]         ` <87bk7p57yz.fsf@posteo.net>
2024-03-16 12:16           ` Felician Nemeth [this message]
2024-03-16 12:46             ` (byte-compile '(append '(1 2) '(3 4))) Philip Kaludercic
2024-03-16 13:23               ` Basil L. Contovounesios
2024-03-16 13:45                 ` Felician Nemeth
2024-03-16 13:55                 ` Philip Kaludercic
2024-03-16 23:42                   ` Basil L. Contovounesios

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=87r0gatlqz.fsf_-_@betli.tmit.bme.hu \
    --to=felician.nemeth@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    /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).