unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Writing on Guile optimization: what are anon #x... functions?
@ 2024-04-05 20:17 Artyom Bologov
  2024-04-05 23:04 ` Olivier Dion
  2024-04-07 20:59 ` Skyler Ferris
  0 siblings, 2 replies; 5+ messages in thread
From: Artyom Bologov @ 2024-04-05 20:17 UTC (permalink / raw)
  To: guile-user

Hi y'all,

I'm making a blog post on Guile optimization gotchas I learned. But I
find that one piece of the picture is missing there: anon functions in
the profiler output. Like "anon #x117f408"

One of these functions eats up a lot of performance in my code. So I
can't say I'm an expert on optimization until I understand what it
is. Anyone can hint me at where these functions might come from? Are
they foreign? Are they Guile-internal? Are they not functions at all?

Here's a link to the post draft, where you can find more context (and
maybe correct me if there's something off/missing in the text):

https://www.aartaka.me.eu.org/guile-optimization-gotchas

anon #x117f408 truly is a mystery that haunts me at night...
--
Artyom Bologov



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing on Guile optimization: what are anon #x... functions?
  2024-04-05 20:17 Writing on Guile optimization: what are anon #x... functions? Artyom Bologov
@ 2024-04-05 23:04 ` Olivier Dion
  2024-04-06  0:25   ` Artyom Bologov
  2024-04-07 20:59 ` Skyler Ferris
  1 sibling, 1 reply; 5+ messages in thread
From: Olivier Dion @ 2024-04-05 23:04 UTC (permalink / raw)
  To: Artyom Bologov, guile-user

On Sat, 06 Apr 2024, Artyom Bologov <mail@aartaka.me> wrote:
> Hi y'all,
>
> I'm making a blog post on Guile optimization gotchas I learned. But I
> find that one piece of the picture is missing there: anon functions in
> the profiler output. Like "anon #x117f408"

Anonymous, i.e. lambda?

[...]
-- 
Olivier Dion
oldiob.ca



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing on Guile optimization: what are anon #x... functions?
  2024-04-05 23:04 ` Olivier Dion
@ 2024-04-06  0:25   ` Artyom Bologov
  0 siblings, 0 replies; 5+ messages in thread
From: Artyom Bologov @ 2024-04-06  0:25 UTC (permalink / raw)
  To: Olivier Dion, guile-user



Hi Olivier

>Anonymous, i.e. lambda?

No, lambdas display as <current input>:xxx:yyy: where x is lines y is columns. So anon functions are something else.

--
Artyom.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing on Guile optimization: what are anon #x... functions?
  2024-04-05 20:17 Writing on Guile optimization: what are anon #x... functions? Artyom Bologov
  2024-04-05 23:04 ` Olivier Dion
@ 2024-04-07 20:59 ` Skyler Ferris
  2024-04-07 22:26   ` Artyom Bologov
  1 sibling, 1 reply; 5+ messages in thread
From: Skyler Ferris @ 2024-04-07 20:59 UTC (permalink / raw)
  To: Artyom Bologov, guile-user

I haven't run into this before in myself, but this line from the NEWS 
file in guile repository seems like a good lead:

"Previously statprof would show strings like "anon #x1234" for primitives
written in C."

It's in the section for changes new to 3.0.3 so if you're on 3.0.2 or 
below then upgrading might help you get more useful analysis. If you're 
already on/past 3.0.3 then I'm confused.

On 4/5/24 13:17, Artyom Bologov wrote:
> Hi y'all,
>
> I'm making a blog post on Guile optimization gotchas I learned. But I
> find that one piece of the picture is missing there: anon functions in
> the profiler output. Like "anon #x117f408"
>
> One of these functions eats up a lot of performance in my code. So I
> can't say I'm an expert on optimization until I understand what it
> is. Anyone can hint me at where these functions might come from? Are
> they foreign? Are they Guile-internal? Are they not functions at all?
>
> Here's a link to the post draft, where you can find more context (and
> maybe correct me if there's something off/missing in the text):
>
> https://www.aartaka.me.eu.org/guile-optimization-gotchas
>
> anon #x117f408 truly is a mystery that haunts me at night...
> --
> Artyom Bologov
>





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Writing on Guile optimization: what are anon #x... functions?
  2024-04-07 20:59 ` Skyler Ferris
@ 2024-04-07 22:26   ` Artyom Bologov
  0 siblings, 0 replies; 5+ messages in thread
From: Artyom Bologov @ 2024-04-07 22:26 UTC (permalink / raw)
  To: Skyler Ferris; +Cc: Artyom Bologov, guile-user

Hi Skyler,

> "Previously statprof would show strings like "anon #x1234" for primitives
> written in C."

This made me grep through Guile sources. I found this function:

(define (addr->printable addr pdi)
  (or (and=> (and=> pdi program-debug-info-name) symbol->string)
      (and=> (primitive-code-name addr) symbol->string)
      (string-append "anon #x" (number->string addr 16))))

Seems like any function that's neither named in debug info nor a
built-in one is assigned the anon label. So these might be C functions
indeed.

> It's in the section for changes new to 3.0.3 so if you're on 3.0.2 or 
> below then upgrading might help you get more useful analysis. If you're 
> already on/past 3.0.3 then I'm confused.

I'm on Guile 3.0.9, so now I'm confused too!

Thanks,
--
Artyom.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-07 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 20:17 Writing on Guile optimization: what are anon #x... functions? Artyom Bologov
2024-04-05 23:04 ` Olivier Dion
2024-04-06  0:25   ` Artyom Bologov
2024-04-07 20:59 ` Skyler Ferris
2024-04-07 22:26   ` Artyom Bologov

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).