IRC channel logs
2025-07-13.log
back to list of logs
<Kolev>daviid, I was wondering if there are any Adwaita apps written in Guile yet. <robin>cow_2001, i usually use it to profile execution of a thunk, but for a single procedure you can use statprof-begin/statprof-end around the particular region(s) to profile (iirc it will combine profiling results until statprof-reset is called) <robin>statprof-start and statprof-stop, rather <robin>(and (statprof-display [port]) to print the results) <sibl>how can I exit my process from sigaction ? I tried to add (exit 1) in my handler (SIGINT) but it doesnt exit <sibl>this is how I setup the handler `(sigaction SIGINT (lambda (sig) (format #t "\rBye !~%") (exit 1)))` <cow_2001>(define (f blah) (statprof-start) (let ((result (some-operation blah))) (statprof-stop) result)) and somewhere else, after calling (f blah), i (statprof-display) and it displays that <identity>cow_2001: it means that not enough stuff happened between (statprof-start) and (statprof-stop), try running (f blah) in a loop wrapped in (statprof-start) and (statprof-stop) <ArneBab>cow_2001: I tend to statprof with ,profile (let loop ((n 10000)) <the code> (unless (zero? n) (loop (1- n))))) <cow_2001>when you put a bit of code between those two, and then call that bit of code several times, shouldn't it add more data to the statistics each iteration? <cow_2001>like (let loop ((n 10000)) (statprof-start) (f blah) (statprof-stop) (unless (zero? n) (loop (1- n))))? <cow_2001>no samples recorded even in a many times loop <ArneBab>cow_2001: gc stuff is pretty hard to optimize for me. But they can give massive gains. <ArneBab>sneek: later tell dthompson: is there a chance that you could add your optimizing post to the guile reference manual? <graywolf>Hello :) How do I profile a syntax-case? I wrote a syntax wrapper to args-fold from SRFI-37, and while it works, it is horrendously slow (~0.30 seconds with 490 options). By commenting out the entry point, I confirmed that basically all the time is spent before it. So during loading (I think, not sure about the phases) of the module. Now my question is, how do I debug why is it slow? In <graywolf>general, how does how debug performance problems with syntax transformers? <graywolf>So, ugh, any idea why `guile -L . -C . -s test.scm' does not load test.go file? <mwette>graywolf: You could code up your own profiler using the vm-hooks. Say, in (vm-exec-hook! (lambda () (when count (set! counter (1+ counter))))) where counter is global. <mwette>That would not measure time, but number of vm instructions. <ArneBab>graywolf: -s test.scm explicitly says, read the test.scm file, I think. <ArneBab>graywolf: could you try creating a module with a (main args) procedure and then use guile -L . -C . -e '(test)'? <graywolf>ArneBab: with -e the main is executed, but I get the repl after that. I need to do -e '(@@ (test) main)' -c '' , which is bit convoluted. <graywolf>Additionally I need to export the `main', otherwise compiler seems to remove the definition :/ <graywolf>I wonder what a shebang for Guile is supposed to look like. exec guile -e '(@ (test) main)' -s "$0" "$@" does not load the compiled version. However if I replace the -s wit -c '', the (car (command-line)) is wrong. What do people typically use? <ArneBab>graywolf: that’s what I usually do (-c ''), yes. It’s what I found to be the fastest way to run code from a script. <graywolf>Aaah I see, it is problem only when the executable file has .scm extension. If I name the file just `test', the `test.go' is picked up correctly. <graywolf>When it is `test.scm', it looks for `test.scm.go'. <ArneBab>-e '(test)' is a shorthand for - '(@ (test) main)' <graywolf>ArneBab: I admit I do not understand how the -e '(hello-world)' works. <graywolf>(As in, can I assume it will stay that way?) <graywolf>Hm. Well I guess I do not *actually* care about $0 in most of my scripts, so I might be fine without that. Thanks for the help (and the link), very useful :) <ArneBab>graywolf: the -e '(main)' has been included for ages, but only got documented when I added the documentation a few years back :-) <ArneBab>There’s far too much stuff that’s possible with Guile but hard to find. <ArneBab>intended a quick start into programming from nothing to best practices I found -- kind of like a tutorial. <ArneBab>(it’s actually a pretty small book that fits in the backpocket) <ArneBab>Still needs a last round of polishing before I can put it live as printed book. <graywolf>Need to go but one last question, I guess this requires the scripts to have .scm extension to be loadable by the module lookup, correct? The best way to get the non-.scm version working, would probably be a symlink? <ArneBab>then it searches .EXT files (.w files), too.