unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: emacs-devel@gnu.org
Cc: Leo Liu <sdl.web@gmail.com>
Subject: Re: why is reverse a string in-place so much slower than a vector?
Date: Fri, 25 Apr 2014 10:55:59 +0200	[thread overview]
Message-ID: <3673186.oJyHOS7TOs@descartes> (raw)
In-Reply-To: <m338h1n7q1.fsf@gmail.com>

On Friday 25 April 2014 16:17:42 Leo Liu wrote:
> So why is this so much slower on string?

This is a bit of a guess.  But I think the problem is that `aref' has to do 
more complicated operations for multi-byte strings to correctly decode them.  
While for a vector it can simply access every single bytes.

(with-current-buffer "subr.el" (multibyte-string-p (buffer-substring (point-
min) (point-max))))
-> t

Regards,
Rüdiger




  reply	other threads:[~2014-04-25  8:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-25  8:12 why is reverse a string in-place so much slower than a vector? Leo Liu
2014-04-25  8:17 ` Leo Liu
2014-04-25  8:55   ` Rüdiger Sonderfeld [this message]
2014-04-25  9:14   ` Andreas Schwab
2014-04-25  9:35     ` Leo Liu
2014-04-25 11:00       ` Andreas Schwab
2014-04-26  0:19         ` Leo Liu

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=3673186.oJyHOS7TOs@descartes \
    --to=ruediger@c-plusplus.de \
    --cc=emacs-devel@gnu.org \
    --cc=sdl.web@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 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).