IRC channel logs

2023-08-27.log

back to list of logs

<haugh>Say I have an internal definition or lambda expression which does not reference any parameters of the "parent" procedure. Does Guile recompute it every time the parent procedure is called?
<haugh>Instead of "parameters of parent procedure" I should say "bindings in the lexical scope"
<haugh>Although now that I think of it, I suppose all these bindings are in lexical scope... I guess what I'm really asking is whether I should worry about the cost of internal or ad hoc procedures as much as I do
<rlb>Offhand, I'd guess you may not need to worry too much, but if it's critical, can always test. If you haven't seen it, https://www.gnu.org/software/guile/manual/html_node/Compiling-to-the-Virtual-Machine.html might be interesting. For example, the CPS level optimizations might mean that what you're thinking about doesn't even exist the way you're thinking about it by the time it gets through there.
<haugh>I was concerned that the answer to my question was "grok CPS"
<haugh>thank you for confirming my fears
<rlb>Hah, not necessarily - and I think there are some disassembly options, so you could possibly just look at the end result for some simpler examples.
<haugh>I see your point.
<rlb>(As yet, I've mostly dealt with the scheme level, and the C level, and not as much the middle :) Well, actually I suppose I've dealt with tree-il somewhat.)
<haugh>I haven't actually encountered any issues but I do write in an obsessively HOF-oriented style so the concern is always there in the back of my mind.
<rlb>Not unreasonable -- just depends on the compiler in question, I suppose.
<rlb>(not unreasonable to wonder I mean)
<haugh>I'm positive I'll get down there eventually, just a matter of priorities
<wingo>haugh: https://wingolog.org/archives/2016/02/08/a-lambda-is-not-necessarily-a-closure
<wingo>cps might be easier to read in the output of ,optimize-cps at the repl
<cow_2001>In the socket procedure's docstring there's a typo. Should be "be" instead of "by". "A single socket port cannot by used for communication until it has"
<mwette>wingo: I didn't realize optimize-cps was there. on 3.0.9, I got this: https://paste.debian.net/1290175/
<mwette>error (last line)
<wingo>good evening
<rlb>evening
<mwette>good evening -6
<mwette>If I create a module that has (define (bv-u32le-ref bv) (bytevector-u32-ref bv little)), where (define little (endianness little)), the compiler will inline the bytevector-u32-ref calls, correct? IIRC bytevector-u32-ref is an intrinsic procedure.