IRC channel logs

2020-05-13.log

back to list of logs

***catonano_ is now known as catonano
<tohoyn>sneek, hello
<mwette>sneek: botsnack
<sneek>:)
<catonano>sneek later tell andswitch you're right, I missed the bit about the single page you wanted. Sorry
<sneek>Okay.
<tohoyn>sneek: botsnack
<sneek>:)
<tohoyn>log service seems to be down
***rekado_ is now known as rekado
<rekado>tohoyn: thanks for the notice. It got stuck somehow.
<wingo>sneek: later tell dsmith turns on i made a mistake that resulted in all optimizations being on, also for bootstrap :P things a little better now.
<sneek>Will do.
*janneke hopes for a slight understatement there
<wingo>depends on the file in question
<wingo>is quite significant for bootstrap tho
<janneke>that is great; i'm bootstrapping more than i would sometimes like, these days :)
<wingo>janneke: you might like the bootstrap compiler, just for reading; it is 1400 lines and relatively straightforward
<wingo>maybe mes has some tricks it could use or vice versa
<janneke>wingo: yes, that's a nice idea! what's the entry point?
<wingo>janneke: https://git.savannah.gnu.org/cgit/guile.git/tree/module/language/tree-il/compile-bytecode.scm ; it's bottom-up
<manumanumanu>wingo: did I dream that it was about 10x faster?
<wingo>so the entry point is at the bottom
<wingo>manumanumanu: o/~ caught in a landslide, no escape from reality o/~
<janneke>yes
<wingo>but yeah it is lots faster
<manumanumanu>open your eyes!
<manumanumanu>Or however it continues
<manumanumanu>im just a poor boy?
<manumanumanu>nice!
<wingo>:)
<manumanumanu>I am going to have a go at the equal?/eqv? optimization today. We got some arctic cold these days, so all my fruit blossoms froze. No cherries. No apples. I am rage-quitting gardening for a while
<wingo>haha condolences
<wingo>will it help to say i see my neighbor's tree laden with reddening cherries from my window? i guess not ;)
<manumanumanu>rub it in
<manumanumanu>gardening in sweden is a lost cause. All I get is cabbage and carrots
<manumanumanu>on the other hand, we got about 100kg carrots last year, and had kale through the winter
<wingo>nice
<wingo>i moved 18 months ago and haven't set up a proper veg bed yet
<manumanumanu>i'd suggest building your own raised ones instead of buying those flimsy ones
<manumanumanu>the ones we bought when we moved in 3 years ago are all rotten by now, but the ones I built look like new
***madsy is now known as Guest47091
<rekado>manumanumanu: we barely scraped by freezing; my trees don’t look happy at all. And my watermelons died.
<manumanumanu>To make the gardening a bit more on-topic: guile is powering my self-watering flower pot :D
<wingo>manumanumanu: what!!
<wingo>do tell
<wingo>at one point a few years ago i wanted to compile part of guile to a microcontroller to open and close the door of my chicken coop
<wingo>of course i never got around to doing it ;)
<manumanumanu>yeah. I have some python scripts to read from GPIO
<manumanumanu>neatly abstracted away
<wingo>janneke: a -j1 make in bootstrap/ now takes 11 minutes for me
<manumanumanu>so about 80% guile 20% python to measure impedance between two nails and start a pump if the it is too high (dry soil)
<wingo>i suspect the best you could do with -j40 would be 5 or 6 minutes, because of having to build eval.go and psyntax-pp.go first
<wingo>manumanumanu: neat!
<manumanumanu>I only managed to empty the water onto the floor once or twice :D
<janneke>wingo: eh, is that a full bootstrap; that used to take 2.5h?
*janneke looks puzzled
<wingo>janneke: full bootstrap
<wingo>well
<wingo>i mean to say
<wingo>you have built libguile/. you have no .go files, no prebuilt/
<wingo>that was "time make -C bootstrap/ -j1"
<janneke>whoa -- that's amazing
<manumanumanu>i second that.
<janneke>can that be backported to 2.2.8?
<janneke>(not to bring back the dead, but...)
<wingo>:)
<wingo>not sure. it would need VM work as well as compiler work
<wingo>i.e. possibly-missing instructions
<wingo>best to let 2.2 lie sleeping IMO :)
<janneke>wingo: ah, i only really meant "...a mistake that resulted in all optimizations being on,"
<wingo>ah that. no that was a recent mistake introduced when shoehorning the baseline compiler into the <language> graph
<janneke>i'm not advocating any significant work
<janneke>OK, just checking
<wingo>the speed improvement is because of the baseline compiler + trimming the bootstrap module graph
<janneke>nice!
<janneke>bootstrap dependency reduction; *love it*
<wingo>:)
<wingo>make -j4 just got me down to 9m42s in bootstrap/; there are some "long poles" that won't fold up into the bag, it seems
<manumanumanu>wingo: when I'm at it looking at some primitiv expanders, are there any others you have thought about but not really bothered about?
<wingo>manumanumanu: which primitive expanders are you looking at? i am pretty good at forgetting about things i decided to not bother about so i can't answer the question :)
*wingo casts short memory into a virtue :P
<manumanumanu>now I am looking at turning equal? into more efficient forms for (const ...)s where it makes sense
<manumanumanu>chars
<manumanumanu>ratnums (i believe)
<manumanumanu>floats? No idea about that
<wingo>incidentally peval can be a really good place to do that sort of thing
<manumanumanu>I just thought language/tree-il/primitives.scm is the place to do it since that is where equal/eqv -> eq? is doen
<wingo>yeah could be
<wingo>make -j4 -C module/ after a bootstrap runs in 3m36s on this now-aging laptop
<wingo>so, good.
<wingo>finally, a make -C bootstrap/ -j4, with prebuilt/ built, runs in 12s.
<manumanumanu>If I understand correctly, all numbers are eqv? all other numbers in guile, even complex and inexact numbers.
<wingo>correct
<manumanumanu>great.
<wingo>i mean of course (eqv? 1 2) is false
<wingo>but you mean that (eqv? N M) == (equal? N M)
<wingo>i guess
<wingo>if N or M is a number
<manumanumanu>haha
<manumanumanu>yes, that is how I meant
<RhodiumToad>two numbers can be = but not eqv?, though, if one is exact and the other not
<RhodiumToad>or if one is real and the other complex
<manumanumanu>oh yes, but now I am turning equal? -> eqv? which has a similar number comparison semantics iirc
<RhodiumToad>hm, that has some dubious edge cases
<manumanumanu>It is not as if I am not going to test it :D
<manumanumanu>(equal? 0.1 1/10) = #f which is true for eqv. (equal? 0 0/10) -> #t which is also true for eqv?
<RhodiumToad>if at least one of the operands of equal? is a number, then the result is equivalent to the result of eqv? on those same operands
<RhodiumToad>(eqv? 0.1 1/10) is false for me.
<manumanumanu>i meant that :D
<manumanumanu>it is true, but not #t :D
<manumanumanu>(eq? (equal? 0.1 1/10)) (eqv? 0.1 1/10)) -> #t :D
<manumanumanu>(eq? (equal? 0 0/10)) (eqv? 0 0/10)) -> #t
<RhodiumToad>whereas (= 0.1 1/10) -> #t
<manumanumanu>yup, but I am not touching =
<RhodiumToad>the edge case I found is that an exact complex number whose imaginary part is exactly 0 is actually an exact real number
<RhodiumToad>so (eqv? 1 1+0i) is true
<RhodiumToad>whereas (eqv? 1.0 1.0+0.0i) is not
<manumanumanu>that's the case for equal? as well
<RhodiumToad>yes
<RhodiumToad>as I said, if at least one operand of equal? is any kind of number, then the result is the same as using eqv?
<wingo>1+0i is not the same as 1+0.1i
<wingo>er
<wingo>1+0i is not the same as 1+0.0i
<RhodiumToad>right, because the latter is inexact
<manumanumanu>now, is there a way to run guile from the source folder where i just completed a 'make'?
<wingo>manumanumanu: meta/guile
<wingo>incidentally if you just finished a make, i suggest git pull and make again
<wingo>it won't take very long
<manumanumanu>haha, i botched it! :D
<wingo>that way you will have the new baseline compiler
<manumanumanu>(equal? #\a #\a) -> ERROR
<wingo>haha ;)
<wingo>easy to make mistakes :)
<RhodiumToad>looking at r5rs, it says that eqv? is true if the operands are both numbers, have matching exactness, and are =
<wingo>r5rs is out of date
<manumanumanu>it turns into very fast code though! (equal? #\a #\a) -> (#f)
<manumanumanu>the reason seems to be that I don't know scheme. I literally forgot a (cond ...)
<RhodiumToad>why would that be #f?
<manumanumanu>no, somewhere in the compile I ended up with ((and blah blah blah)) which tried to apply (#f)
<manumanumanu>it never even ran. That's how fast it was
<RhodiumToad>r7rs says that two inexact numbers are eqv? if and only if scheme's standard arithmetic procedures can't tell them apart.
<RhodiumToad>(it uses slightly more words but that's the sense)
<RhodiumToad>so what can tell 1.0 from 1.0+0.0i ?
<RhodiumToad>hm.
<RhodiumToad>perhaps 1.0 is treated as 1.0+0i such that the imaginary part is exactly 0?
<efraim>perhaps this is more of a Guix question, but if I've created a gexp how do I invoke it from a guile REPL?
<RhodiumToad>yup.
<RhodiumToad>so 1.0 and 1.0+0i are indeed eqv?
<wingo>(imag-part 1.0) => 0
<wingo>(real? 1.0+0i) => #t
<wingo>1.0+0i is just 1.0.
<wingo>efraim: i think there is some kind of guix repl extension
<wingo>perhaps a guix person knows more
<wingo>but you have to evaluate it within a store monad i think
<wingo>so thee repl extension lets you enter the monad
<efraim>thanks. I guess it's not a problem when it's already inside a script to do the store monad dance
<manumanumanu>wingo: you weren't kidding when you said it is easy to get wrong. I managed to actually get it wrong again and always simplifying equal? to eqv?. I forgot that primitive-expanders should return #f iif no expansion should be done.
<manumanumanu>now all tests pass :D
<wingo>:)
<lloda>sneek: bugs?
<sneek>Last time I checked bugs is Send reports to bug-guile@gnu.org, and see bug reports at https://bugs.gnu.org/guile
<lloda>sneek: bug list?
<lloda> https://bugs.freedesktop.org is gone, so guile-cairo needs a new place for bugs
<lloda>I guess https://debbugs.gnu.org should work? but guile-cairo is 'nongnu'
<lloda>not sure how that works
<wingo>we could ask for a new debbugs component or so; i think civodul knows more about that
<lloda>sounds good
<manumanumanu>so, wingo: tests are changed, no fails. tests are added, all pass. However: I just extended the already existing procedure. That means we are only optimizing the less-than-three-arguments form. (equal? toplevel-x #\a) -> (eqv? #\a toplevel-x), but (equal toplevel-x toplevel-y #\a) -> (and (equal? toplevel-x toplevel-y) (eqv? #\a toplevel y))
<manumanumanu>meh, i'll change it. it seems dumb not to.
<wingo>yeah that can usually be a straightforward recursive change
<manumanumanu>due to how the code was written, it ended up being a little bit more than that. I restructured it so that call to eqv? or equal? has it's arguments checked in order. If there are any eq-able or eqv-able literals that is the primitive used, otherwise don't do anything
<manumanumanu>The problem is I suspect the output from (make-conditional ...) is run through the primitive-expander once again, meaning we don't get o(n)
<manumanumanu>for things that turn into eqv? at least
<manumanumanu>no... for both eqv? and equal?. (equal? a b c d e) checks all args for simplifiable literals and turns it into (and (equal? a b) (equal? b c d e)) which in turn checks (b c d e) for simpflifiable literals, which in turn would be an eternal shame to submit as a patch
<RhodiumToad>hm, really you want to know what is the most simplifiable literal in the list before generating any clause
<manumanumanu>RhodiumToad: good idea.
<manumanumanu>the simplify call is only called once, so no non O(n).
<RhodiumToad>so if any arg is a symbol or keyword, you can reduce all the tests to eq?. otherwise, if any arg is a number or character, then they all reduce to eqv?
<weinholt>manumanumanu, weird that equal? works with any number of arguments, the manual says it takes exactly two arguments
***dddddd__ is now known as dddddd
<guix-vits>weinholt: (help equal?) -> "- Scheme Procedure: equal? [x [y . rest]]"
<guix-vits>maybe 2-nd is a list?
<manumanumanu>guix-vits: the manual says otherwise though.
<manumanumanu>wingo: there is a patch on the mailing list. It isn't pretty and needs a little discussion. Anyway, thanks for the help!
*guix-vits "same for eqv?: manual says x y, not [y . rest]. Confusing."
<dsmith-work>{appropriate time} Greetings, Guilers
<wingo>dsmith-work: hey!
<wingo>i fixed the speed thing i think
<wingo>want to give a try to a fresh build?
<wingo>a -j4 build from nothing should complete in around 20 minutes for the whole thing
<wingo>hey civodul :)
<dsmith-work>Is currently working on eval.go
<wingo>civodul: if you are able, give current guile another go on python-xyz.scm
<civodul>howdy!
<wingo>there was a bug that accidentally turned on all tree-il optimizations :P
<civodul>ah! :-)
<civodul>will do
<wingo>dsmith-work: is it done? :)
<dsmith-work>Not yet. :)
<dsmith-work>on fix-letrec
<wingo>still in bootstrap? weird
<dsmith-work>It's moving along. Does seem faster than yesterday
***Guest53758 is now known as jao
<dsmith-work>Done
<dsmith-work>git 31bb0e: real: 36m11.730s user: 87m33.215s
<dsmith-work>
<dsmith-work>git 3385f6: real: 60m12.574s user: 140m37.284s
<dsmith-work>yesteday ^^
<dsmith-work>Close to twice as fast
<civodul>random thought of the day: what if we put Guile as the PT_INTERP of a .go file?
<wingo>civodul: would be interesting! lots of paths to get right tho
<wingo>in guix context you can do it, obvs
<wingo>dsmith-work: great! so around 2x as fast as 3.0.2 bootstrap without prebuilt files.
<wingo>iirc your number yesterday was 77m for 3.0.2
<dsmith-work>yes
<wingo>nice
<wingo>thanks for testing, i might have missed this bug if you hadn't tested
<dsmith-work>Thats wallclock time. Was on 4 cores.
<dsmith-work>User time went from 189m to 87m
<dsmith-work>Which is more likes a single core time?
<wingo>dsmith-work: similar but a sequential build will usually have less user time than a parallel build, because later steps can take advantage of previous steps
<wingo>manumanumanu: you nerd-sniped me ;) see the list
<wingo>with regards to "match", and "case" for that matter, we really need to compile chained conditionals better :P
<mwette>Does that mean something like this? (('a 'b) ...) (('a 'c) ...) => (('a . ,rest) (match rest (('b) ...) (('c) ...)
<wingo>sorta
<wingo>that's part of it
<wingo>the other part is http://scheme2006.cs.uchicago.edu/07-clinger.pdf
<wingo>needs to be done at the CPS level though, so that the component parts of e.g. (match exp (($ <a>) ..) ($ <b>) ..) ...) can work
<mwette>On occasion I'm guilty of hackage to avoid case forms.
<alextee[m]>i want to load a file and do some regex on every line and combine the results in a new string. i guess i'd do (with-input-from-file) and (fold), but is there a way to convert the file contents to a list of strings (one for each line)?
<RhodiumToad>read-line will read one line, why would you want to make a list?
<RhodiumToad>what I'd do is probably with-input-from-file and with-output-to-string
<alextee[m]>actually i think i dont.. i just want to do some regex and just (display) the result for each line, so read-line will work, thanks!
<alextee[m]>i'm doing with-output-to-file, and then inside that with-input-from-file
<RhodiumToad>ah, you don't actually need the string?
<alextee[m]>(reading a list of translators from a file and generating a C string to dump in a C header file)
<alextee[m]>no, i just need to (display) it
<civodul>wingo: python-xyz master -O0: 2m10s wall-clock
<civodul>python-xyz 3.0.2 -O0: 2m40s wall-clock
<civodul>time(1) says 693M (master) vs. 746M maxresident, FWIW
<civodul>hmm
<civodul>wait a minute, i was doing it wrong, not sure why
<civodul>it's down to 3.8s and 287272maxresident, much nicer :-)
<civodul>was i using the wrong optimizations-for-level before, go figure
***dongcarl7 is now known as dongcarl
<alextee[m]> https://paste.debian.net/1146592/
<alextee[m]>is my use of (read-line) wrong? it seems to stay on the first line and that loop keeps displaying the first line forever. isn't it supposed to move the iterator on the current input port by default?
<alextee[m]>wait i think i'm just doing the do-loop wrong
*alextee[m] reads the docs again
<RhodiumToad>yeah
<alextee[m]>yeah i missed the [step] part, sorry for the noise :-)
<RhodiumToad>(do ((line (read-line) (read-line))) ... or something like that
<alextee[m]>thx!
<manumanumanu>wingo: regarding case, I have a case macro that does a binary search for more-than-n elements
<manumanumanu>btw, I'll read the patch and try to understand what it does.
<manumanumanu>It would be cool to actually be able to contribute
<manumanumanu>I had a macro that resulted in huge case macros, and shaved a lot of time from it by doing a binary search. I thought about doing it with a hash table, but I never got to that
<manumanumanu>Racket does o(logN) case dispatch, so I suspect they do a binary search as well
<manumanumanu>I had no idea that guile eq?'d chars!
<justin_smith>clojure compiles case into a hash table lookup also
<alextee[m]>is it possible to remove characters from an output port?
<alextee[m]>like, the last n characters?
<alextee[m]>not sure if that makes sense
<justin_smith>I'd suspect that for an arbitrary port this is impossible, but if it were possible to wrap a port in a buffer, you could do so before the buffer flush
<RhodiumToad>manumanumanu: does it eq all chars, or only some?
<justin_smith>I suspect in guile your wrapper couldn't directly be a port
<manumanumanu>RhodiumToad: andy's last patch seems to indicate all, but I am not sure I understand it
<alextee[m]>i see, thanks. i'll handle my problem in a different way then (make a list so i can tell if it's the last element or not and not print the extra chars)
<RhodiumToad>alextee[m]: if it's a random access port, such as a file port, you can seek backwards
<alextee[m]>oh?
<RhodiumToad>however, that would seek in bytes, not in characters
<alextee[m]>i think using a list in what im doing will be more elegant. i'll try and report back :-)
<RhodiumToad>manumanumanu: I'm guessing that characters are always immediate values, since all unicode codepoints easily fit in even a 32-bit word with enough space for type tags
<RhodiumToad>yup, reading the C code that does appear to be the case
<manumanumanu>guile also compares fixnums using eq?, which are larger
<RhodiumToad>ah, that depends on the size of the number
<RhodiumToad>numbers small enough to fit in a word with 2 spare bits for tag are immediate values, and will compare as eq
<RhodiumToad>numbers larger than that will not
<RhodiumToad>hm, that said, it's somehow still managing to compare them as equal
<RhodiumToad>aha
<RhodiumToad>(define a 2000000001) (define b (1+ 2000000000)) (eq? a b) => #f
<RhodiumToad>on a 32-bit system that is
<RhodiumToad>on 64-bit that would be #t still
<alextee[m]>i did it! \o/ https://paste.debian.net/1146602/
<alextee[m]>result: https://paste.debian.net/1146603/
<alextee[m]>now i dont have to copy the translators from the TRANSLATORS file in the about dialog manually anymore : P
<alextee[m]>i'll do this for the credits section in the manual too
<wingo>civodul: from 220s to 4s ???
<wingo>a 50x improvement??
<wingo>civodul: would be interesting to compare -O2 with -O2 -Ono-letrectify
<civodul>wingo: so i'm doing a full build of the 'guix' package
<civodul>its peaks at "only" 780M resident towards the end
<civodul>instead of almost 2G i think
<civodul>that too is pretty nice
<civodul>here's how i build 'guix' against master: https://paste.debian.net/1146620/
<andswitch>Does a nested define create a closure like a lambda does?
<sneek>andswitch, you have 1 message!
<sneek>andswitch, catonano says: you're right, I missed the bit about the single page you wanted. Sorry
<civodul>andswitch: the compiler inlines it when appropriate
<civodul>so it depends on the situation
<justin_smith>I'd expect it to turn into the same thing a let* binding would