unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Thomas Morley <thomasmorley65@gmail.com>
To: Vijay Pratap Chaurasia <vijaypcin@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: Performance issue with guile-2.2
Date: Tue, 11 Apr 2017 16:22:47 +0200	[thread overview]
Message-ID: <CABsfGyUQh8P+p6X8Fe8t79G1CrDQsJodBqZ8a+bu6_4ZjUjbYQ@mail.gmail.com> (raw)
In-Reply-To: <CAKnjaF7Sh9gYsb6NBEiknFsOCUtLCz366YjO9Fc+Ago5hOdLsQ@mail.gmail.com>

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

2017-04-11 12:28 GMT+02:00 Vijay Pratap Chaurasia <vijaypcin@gmail.com>:
> Hi,
>      I have a tool which compares live data between two sources. I found
> that the program runs more than 3 times slower than the same with
> guile-2.0.11 . I have done profiling but there was nothing special to point
> out. All most all calls were taking more than double the time compare to
> guile-2.0.11. It is contrary to the claim of 30% performance boost with
> guile-2.2 release. Can some one point the possible reason for slowness?
>
> I have created a simple test program which reports the diff of two alist.
>
> *time  /home/guile-2.2/bin/guile -s ./performanceTest.scm*
> real    0m34.375s
> user    0m37.616s
> sys     0m0.361s
>
> *time /home/guile-2.0/bin/guile -s ./performanceTest.scm*
> real    0m18.939s
> user    0m18.829s
> sys     0m0.104s
>

Hi vijay,

I'm from LilyPond, where we have our own problems with every
guile-2.x, we still use guile-1.8.
So I'm very interested in performance problems.

Though, I can't confirm your observations.
Admittedly I used 2.0.14, with this I get:

2.2.0.17-685ca (built from recent master)

real    0m31.642s
user    0m33.272s
sys     0m0.184s

2.0.14 (built from the released tarball)

real    1m39.361s
user    1m41.832s
sys     0m0.224s

Pity it doesn't work for guile-1.8...


One other thing, please attach your files, or at least teach your
e-mail-client not to insert *-signs at every line-break etc.
Regardless whether there should be a line-break or not.

Reformated versions are attached, if someone else want to check, too.

Cheers,
  Harm

[-- Attachment #2: data.txt --]
[-- Type: text/plain, Size: 2233 bytes --]

'(  (IDN_PROD_PERM 98) (RDNDISPLAY 120) (DSPLY_NAME "MINI GOLD JUN7") (RDN_EXCHID 23) (TIMACT "2017-03-20 10:33:06") (FID_TRD_PRC 1235.2) (FID_TRD_PREV1_PRC 1234.7) (FID_TRD_PREV2_PRC 1234.8) (TRDPRC_4 1234.7)(TRDPRC_5 1234.7) (FID_NET_CHG 2.0) (FID_HI 1237.2) (FID_LO 1233.0) (FID_TICK 1) (CURRENCY 840) (TRADE_DATE "3/20/2017") (ACTIV_DATE "3/20/2017") (TRDTIM_1 "2017-03-20 10:17:32") (OPEN_PRC 1233.3) (FID_YSET_PRC 1233.2) (FID_BID 1235.1) (FID_ASK 1235.6) (NEWS "YYYY") (NEWS_TIME " 7:53:07") (FID_BID_SIZE 5) (FID_ASK_SIZE 1) (FID_CUM_VOL 30) (CONTR_MNTH "JUN7") (BLKVOLUM null) (FID_SRC_PRC_FMT_CODE 1) (LOTSZUNITS 32) (FID_PCNT_CHG 0.16) (OPEN_BID 1220.7) (OPEN_ASK 1234.0) (CLOSE_BID 1231.4) (CLOSE_ASK 1232.9) (LOCHIGH 1365.3) (LOCLOW 1098.0) (FID_OPN_INT 165) (OPINTNC 23) (FID_EXPR "6/28/2017") (FID_SET_PRC 1233.2) (UPLIMIT null) (LOLIMIT null) (FID_NO_OF_TRDS 26) (OFFCL_CODE "5050169")(FID_IDN_HSTCLSDATE "3/17/2017") (LIMIT_IND null) (TURNOVER 32109.0)(YCHIGH_IND null) (YCLOW_IND null) (DAYS_MAT 101) (PRC_QL_CD 160) (TDY_UN_CLS null) (TDY_OF_CLS null) (FID_TRD_VOL 1) (LOT_SIZE_A 32.15) (RECORDTYPE 178) (FID_SET_DATE "3/17/2017") (BID_TONE "i") (ASK_TONE "i") (OPINT_2 142) (OPINT_DATE "3/17/2017") (IRGVOL null) (INSPRC null) (INSVOL null) (FID_TRD_TIME "2017-03-20 10:17:32") (TNOVER_SC null) (HST_VOL null) (EXERCISED null) (BCAST_REF "GOL") (HST_SESVOL 56) (ACT_FLAG1 "s") (ACT_FLAG2 "s") (ACT_FLAG3 "b") (ACT_FLAG4 "b") (ACT_FLAG5 " ") (GEN_VAL1 1235.4) (GEN_VAL2 1.0) (GEN_VAL3 1233.4) (GEN_VAL4 101) (GV1_TEXT "SPLTrd") (GV2_TEXT "SPLVol") (GV3_TEXT "SYS") (SEQNUM 52690211) (QUOTIM "2017-03-20 10:33:06") (GV1_DATE "3/20/2017") (GEN_VAL5 null) (GV1_TIME "2017-03-20 10:19:15") (EXCHTIM "2017-03-20 10:33:06") (CONV_FAC 0) (PREF_DISP 5391) (VOL_X_PRC1 1234.96) (DSO_ID null) (BIG_VOL null) (RDN_EXCHD2 759) (THEO_OPEN 1233.4) (LSTTRDDATE null) (OPINT_DAT2 "3/16/2017") (PREV_DISP 3491) (MPV null) (OFF_CLOSE null) (QUOTE_DATE "3/20/2017") (TRDVOL_2 1) (TRDVOL_3 1) (TRDVOL_4 1) (TRDVOL_5 1) (VWAP 1234.96) (PROV_SYMB "5050169") (BID_ASK_DT "3/17/2017") (ISIN_CODE null) (LST_TRD_PR 1232.1) (MNEMONIC "YG") (UNDERLYING null) (PERIOD_CDE "O") (TRDTIM_MS 51452672) (SALTIM_MS 51452672) (QUOTIM_MS 52386000) )

[-- Attachment #3: performanceTest.scm --]
[-- Type: text/x-scheme, Size: 2265 bytes --]

(use-modules
     (ice-9 eval-string)
     (ice-9 common-list)
     (ice-9 hash-table)
     (srfi srfi-1)
     (ice-9 rdelim))


(define *obj-string-cache* (make-hash-table 500))
(define (fast-obj-string obj)
  (let ((entry (hashq-ref *obj-string-cache* obj #f)))
    (unless entry
        (set! entry (if (symbol? obj) (symbol->string obj) (object->string obj)))
        (hashq-set! *obj-string-cache* obj entry))
    entry))

(define (sort-tuples tuples)
  (sort-list tuples
      (lambda (x y)
          (string<? (fast-obj-string (car x))
                    (fast-obj-string (car y))))))

(define (report-diff type tuple1 tuple2)
  (let ((tuple (if tuple1 tuple1 tuple2)))
     (cond ((eq? type '-) `((- . (,tuple1))))
              ((eq? type '+) `((+ . (,tuple2))))
              ((eq? type '!) `((! . (,tuple1 . (,tuple2))))))))

(define (diff-sorted-tuples tuples1 tuples2 diff)
  (cond ((and (null? tuples1) (null? tuples2)) diff)
        ((null? tuples1) (append (map (lambda (x) (report-diff '+ #f x)) tuples2) diff))
        ((null? tuples2) (append (map (lambda (x) (report-diff '- x #f)) tuples1) diff))
        (else
         (let* ((tuple1 (car tuples1))
                (tuple2 (car tuples2)))
           (cond ((equal? (car tuple1) (car tuple2))
                  (diff-sorted-tuples (cdr tuples1) (cdr tuples2)
                                      (if (equal? tuple1 tuple2) diff (append! diff (report-diff '! tuple1 tuple2)))))
                 ((string<? (fast-obj-string (car tuple1))
                            (fast-obj-string (car tuple2)))
                  (diff-sorted-tuples (cdr tuples1) tuples2 (append! diff (report-diff '- tuple1 #f))))
                 (else
                  (diff-sorted-tuples tuples1 (cdr tuples2) (append! diff (report-diff '+ #f tuple2)))))))))

(define-inlinable (diff-tuples tuples1 tuples2)
  (diff-sorted-tuples (sort-tuples tuples1) (sort-tuples tuples2) '()))

(define compare
  (let ((count 0))
     (lambda (port)
           (let ((msg  (eval-string (read-line port))))
               (diff-tuples msg msg)
               (seek port 0 SEEK_SET)
               (set! count (1+ count))
               (if (< count 10000)
                  (compare port))))))

(compare (open-input-file "data.txt"))

  reply	other threads:[~2017-04-11 14:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 10:28 Performance issue with guile-2.2 Vijay Pratap Chaurasia
2017-04-11 14:22 ` Thomas Morley [this message]
2017-04-11 15:51   ` Stefan Israelsson Tampe
2017-04-12  6:45   ` Vladimir Zhbanov
2017-04-13 12:30     ` Ludovic Courtès
2017-04-12  7:28   ` Vijay Pratap Chaurasia
2017-04-14 11:13     ` Andy Wingo

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=CABsfGyUQh8P+p6X8Fe8t79G1CrDQsJodBqZ8a+bu6_4ZjUjbYQ@mail.gmail.com \
    --to=thomasmorley65@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=vijaypcin@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.
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).