unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: Andy Wingo <wingo@pobox.com>
Cc: 17049@debbugs.gnu.org
Subject: bug#17049: [PATCH] Make reverse! forego the cost of SCM_VALIDATE_LIST
Date: Fri, 21 Mar 2014 18:44:07 +0100	[thread overview]
Message-ID: <8738ib30rc.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87bnx0y4qk.fsf@pobox.com> (Andy Wingo's message of "Thu, 20 Mar 2014 21:50:11 +0100")

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

Andy Wingo <wingo@pobox.com> writes:

> Hi,
>
> Thanks for the patch.  What is its performance impact for your use case?

Here is an artificial use case (I make care to get my list scattered
over memory, assuming that sort! keeps the cells around).


[-- Attachment #2: zoppo.scm --]
[-- Type: application/octet-stream, Size: 270 bytes --]

(use-modules (srfi srfi-19) (srfi srfi-1))
(define xxx (sort! (map! random (make-list 50000 10000000)) <))
(define start-time (current-time))
(for-each (lambda x (set! xxx (reverse! xxx))) (make-list 20001))
(display (time-difference (current-time) start-time))

      

[-- Attachment #3: Type: text/plain, Size: 597 bytes --]


The output for my version first and the default version afterwards is

#<time type: time-duration nanosecond: 449629000 second: 8>dak@lola:/usr/local/tmp/guile$ meta/guile /tmp/zoppo.scm 
#<time type: time-duration nanosecond: 898802000 second: 15>dak@lola:/usr/local/tmp/guile$ 

So it's a bit better than my 7:4 estimate (rather a factor of 1.88),
probably because I forgot that the CPU does not have to wait for the
write cycle to complete for continuing.

Now that's a somewhat artificial benchmark, but still: almost a factor
of 2 for the operation itself is pretty good.

-- 
David Kastrup

  parent reply	other threads:[~2014-03-21 17:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 11:23 bug#17049: [PATCH] Make reverse! forego the cost of SCM_VALIDATE_LIST David Kastrup
2014-03-20 11:38 ` bug#17049: PostScriptum: David Kastrup
2014-03-20 14:19 ` bug#17049: [PATCH] Make reverse! forego the cost of SCM_VALIDATE_LIST David Kastrup
2014-03-20 20:50 ` Andy Wingo
2014-03-20 21:27   ` David Kastrup
2014-03-21  4:38   ` Mark H Weaver
2014-03-21 16:56     ` David Kastrup
2014-03-31 19:56       ` Mark H Weaver
2014-04-01 10:26         ` bug#17049: [PATCH v2] " David Kastrup
2014-04-01 10:40           ` David Kastrup
2014-04-01 14:09             ` Mark H Weaver
2014-04-01 14:24               ` bug#17049: [PATCH v3] " David Kastrup
2014-04-01 16:35                 ` Mark H Weaver
2014-03-21 17:44   ` David Kastrup [this message]
2014-03-30 16:36 ` bug#17049: Further change ideas David Kastrup

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/guile/

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

  git send-email \
    --in-reply-to=8738ib30rc.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=17049@debbugs.gnu.org \
    --cc=wingo@pobox.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.
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).