unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Linas Vepstas <linasvepstas@gmail.com>
To: Guile User <guile-user@gnu.org>,
	Guile Development <guile-devel@gnu.org>,
	 Thomas Morley <thomasmorley65@gmail.com>
Subject: Re: guile-2.9.1 impressions
Date: Wed, 5 Dec 2018 23:21:02 -0600	[thread overview]
Message-ID: <CAHrUA34PEtE+tE=LLW_nNo-2LtSBgRVC4Zra8huGDUV8BXAeBg@mail.gmail.com> (raw)
In-Reply-To: <CAHrUA351Svvb+PVJpX-B_b8XKC8j0vU3NHxM7e7+=nHVRbdiWg@mail.gmail.com>

After sending the email below, I scanned the guile-devel archives,
and I see Thomas Morley talking about Lilypond performance.
The example program he offers up caught my eye: nested deep
in a loop is this:

(eval-string "'(a b c)")

Well -- oh -- ha -- I think this is the same culprit that is one of my
significant bottlenecks.  Although I'm mixing C++ and guile very
intensely, my main C++-calling-into-guile is more-or-less eval-string.
(its actually scm_eval_string() for me).  So I think that I can call and
and return from scm_eval_string() about 40K/sec on a five-year-old
vintage machine, passing it some trivial thing to evaluate.  (Python
is in a similar ballpark, if that provides any motivation.)

I'll bet, given Thomas' comments, that scm_eval_string() was thinner
and faster on guile-1.8.8

Thomas also mentioned the "string problem" ... I recall that, when
I looked string handling in the guile-2.1.x codebase, there was a
whole lotta pointless conversion back and forth between utf8 and
double-byte wide chars.  It was just tangled, for no good technical
reason. Code read like a bleary-eyed 3AM coding session, with
"obvious" inefficiencies in it.  Fixing it seemed "easy"; there's no
comp-sci in it, nothing subtle.  It was mostly just a tangle of spaghetti
trying to handle locales every which by by converting .. too many times.

I thought I might fix that but I got .. busy doing other things.  This might
be an unfair complaint, as it might very well be fixed in guile-2.2 or
guile-2.9 but ... if there is a string problem, the impression that strings
are slow, I suggest that an audit of the string handling code may well
reveal that the excessive conversions are still there.

In particular, I think the excessive string-conversion code showed up
in guile-2.0 and got worse in 2.2 as broader utf8 support was added ...

(I also humbly suggest that the guile internals should be 100% utf8.
From long experience, utf8 is amazingly clean and simple, and all the
other encoding schemes are just horrid messes of hacks and ick and
needless complexity and confusing confusion.)

-- Linas

On Wed, Dec 5, 2018 at 9:56 PM Linas Vepstas <linasvepstas@gmail.com> wrote:
>
> So I pulled guile-2.9.1(beta) today, and gave it a spin. Looks
> good/great! One bug -- some crazy multithreading bug,
> reported as #33641
>
> My use case: guile calling C++ code, which calls guile, which
> calls C, ad nauseum. I have some 133 unit tests, of which
> maybe 3/4ths tweak guile in some way. All but the
> multi-threading pass, so happy!
>
> Some comments about performance in this crazy-quilt
> mixed environment. Most of code, both guile and C/C++
> is fairly "thin", not doing a whole lot, before transitioning
> into the other language. Thus, the performance is dominated
> by the cost of the switch.
>
> There are two different switches: from C++ to guile, and
> from guile to C++.  For the first, I'm seeing a rate of about
> 30K  switches/sec C++ into guile (and back, this includes the return).
>
> Calls going the other way are about 800K switches/sec
> from guile into C++ (this also includes the return).   This is
> on a 2014-vintage machine.
>
> Clearly a big difference between the two. Many years ago,
> I profiled this, but don't recall the results. The profile did not
> reveal anything I could control very much or at all.
>
> Thus, In this scenario, I don't really expect the gnu lightning
> bytecode to affect performance very much; I'm mostly
> bottlnecked in the switching of environments.
>
> FWIW, I'm seeing speedups of 1x to 1.5x for interpreted
> mode, and 1.3x to 2x for compiled code. Don't read too
> much into these numbers: They're crazy mixes of calls
> going in both directions.  But still, that's really quite good,
> all things considered!
>
> -- Linas
>
> I cc'ed both guile-user and guile-devel; I'm not subscribed
> to guile-devel, but also I did not see a 2.9.1-beta announce
> on guile-user!
> --
> cassette tapes - analog TV - film cameras - you



-- 
cassette tapes - analog TV - film cameras - you



  reply	other threads:[~2018-12-06  5:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  3:56 guile-2.9.1 impressions Linas Vepstas
2018-12-06  5:21 ` Linas Vepstas [this message]
2019-05-23 19:28   ` Andy Wingo
2019-05-26 13:40     ` Linas Vepstas
2019-05-27  4:40       ` Linas Vepstas
2019-05-28  1:49         ` Linas Vepstas

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='CAHrUA34PEtE+tE=LLW_nNo-2LtSBgRVC4Zra8huGDUV8BXAeBg@mail.gmail.com' \
    --to=linasvepstas@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=thomasmorley65@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).