IRC channel logs

2020-07-14.log

back to list of logs

<rlb>Is there an obvious replacement for scm_internal_stack_catch? I'm *still* trying to remove guile-2.0 from debian, and geda-gaf is the last hold out: http://git.geda-project.org/geda-gaf/tree/gnetlist/src/parsecmd.c?id=1.8.2-20130925#n209
<rlb>I can always file for package removal, but thought I'd see if I might be able to come up with a stopgap patch without too much effort.
<rlb>cf. https://packages.debian.org/search?keywords=geda
<rlb>cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=885195
<rlb>Commenting out that clause, I can get it to build and pass all the tests but 1 with 3.0, but from that last bug tracker message, might be plausible to just remove it in favor of "lepton" (not really a domain I know much about).
***catonano_ is now known as catonano
<rlb>Got it to build and past all but one of the tests (if that was all the tests) by disabling that bit (given some other changes). But also updated the bug -- might still be sensible to remove the package from debian.
<dsmith>rlb: Hmm. For bobot++ we had scm_internal_lazy_catch -> scm_internal_catch
<dsmith>rlb: In scwm, I replaced scm_internal_stack_catch with scm_c_catch, but I'm not sure if that's quite right.
<dsmith>Unfortunately, the NEWS is not that helpful with moving to new catching functions.
***terpri__ is now known as terpri
<ArneBab>justin_smith: so you mean things like Sonar Qube and linters? We’re using Sonar at work and it helps by catching a lot of potential problems like not closing files or forgetting to check for nullness.
***nikita_ is now known as nikita`
<dsmith-work>Morning Greetings, Guilers
<mwette>morning
<justin_smith>ArneBab: right, the original question was about static analysis tools used as a security precaution
<justin_smith>and of course guile does a bunch of these things for us, but we dont' have the approved tools that eg. a board of directors would request for sensitive systems
<ArneBab>I think it could be useful to have something — tools to check best practices or such. But for that we need best practices :-)
<ArneBab>There are always things that are legal in a language, but not a good idea.
<ArneBab>The two tools I know that do the most there are IntelliJ and Matlab (unfree): The latter even tells you when something you did can be sped up with minor changes.
<ArneBab>Ideally Guile would provide those warnings itself while compiling
<dsmith-work>I have been *really* digging Rust laetely.
<justin_smith>ArneBab: yeah - at least in theory, a lisp lets you do things that would be utterly nonsense in another language, but contextually (especially when provided by a well vetted library) are best practices
<justin_smith>imagine your linter complaining about the macroexpansion of a match form because it doesnt' understand match...
<justin_smith>but even so, we could have good verifiers or linters, they just haven't been made for most lisps
<justin_smith>security lib rejecting your program because it uses goops which overrides built in functions...
<ArneBab>performance-linter warning against using string-append in a loop
<sneek>dsmith-work Hey!
<ArneBab>dsmith-work: do you mean, you enjoy programming in it, or you dig deep?
<dsmith-work>ArneBab: really enjoying it
<ArneBab>dsmith-work: what is it you enjoy — and can we get part of that in Guile?
<ArneBab>:-)
<dsmith-work>ArneBab: Lots of things. Expressions instead of statements. Match. The type system. The error messages. Type interence.
<dsmith-work>inference
<dsmith-work>The borrow checker.
<ArneBab>what’s the difference between expression and statement?
<ArneBab>(dsmith-work is it ok if I try to pick your brain on this a bit? I’m curious because I wanted to try out Rust for ages but never made the time)
<dsmith-work>So in Scheme, "if" is an expression. It evaluates to a value. Also in Rust.
<dsmith-work>ArneBab: In Scheme, the last expression in a lambda is the return value. Also in Rust (if you leave off the semicolon to keep the epxression turning into a statement);
<thchr>Question: I'm using a piece of C software (MPB) where I want to call a Guile function repeatedly (thousands and thousands of times): right now, this interop is implemented with `scm_call_1` (or `gh_call1` on older Guiles), with the call in the inner loop looking like:
<thchr>position
<thchr>there is a way to speed this up?
<dsmith-work>thchr: Can you move your loop to Scheme? That will probably speed things up for Guile 3. Not sure about 2.x
<thchr>I can't move it to Scheme unfortunately; at least not without a lot of pain.
<thchr>It's initializing a C data structure for subsequent use in C
<thchr>More generally, any guidance on what precisely the bottleneck here is would be welcome: what really happens on `scm_call_1` is somewhat opaque to me: is the whole Scheme function reparsed/compiled on every call?
<dsmith-work>thchr: Well, I don't really know. But things *have* changed quite a bit between 1.8, 2.0, 2.2, and 3.0
<dsmith-work>1.8 was interpereted.
<dsmith-work>2.0 and 2.2 compiled to a virtual machine.
<dsmith-work>3.0 does too, but also has a JIT compiler to machine code.
<thchr>Yeah, I read that 3.0 brought JIT compiling; that's nice. I'm on 2.2 currently.
<thchr>I guess I'm mainly wondering whether I'm seeing such slow performance because I'm really paying for a compilation step at each invocation; if so, that would be awful. Basically, I'm wondering whether the C interop requires that I "register" the Guile function beforehand, outside my loop.
<dsmith-work>I don't think you are compiling at each iteration.
<justin_smith>how big is the overhead per C->scheme call? it could be that batching multiple calls and minimizing the amount of data that needs to cross the c->scheme boundary would help with performance
<justin_smith>I assume certain wrapping / conversion must happen
<dsmith-work>thchr: The guile devs are not currently around. It would be a good idea to post to the mailing list.
<justin_smith>thchr: are you evaluating a form containing a lambda from the c side? or reusing a previously created lambda?
<R1ck77>Hi! Did anybody manage to compile Guile for Android?
<thchr>dsmith-work Argh, I lost connection.Sounds like a good idea asking in the mailing list: which one is it though? The development mailing list http://mail.gnu.org/mailman/listinfo/guile-devel/ seems down (and I guess also not appropriate for questions like this)
<thchr>(and thanks dsmith-work)
<dsmith-work>guile-user, probably
<thchr>Hmm, also down (this one, right: http://mail.gnu.org/mailman/listinfo/guile-user/?)
<thchr>Without the '?'...
<bandali>pretty sure it's lists.gnu.org, not mail.gnu.org
<thchr>Ah
<dsmith-work> https://lists.gnu.org/archive/html/guile-user/
<dsmith-work>The archives are up
<thchr>Nice, thanks!
<bandali>and mailman as well: https://lists.gnu.org/mailman/listinfo/guile-devel/
<bandali>mail.gnu is our mail server, not the list server
<dsmith-work> https://lists.gnu.org/mailman/listinfo/guile-user/
<thchr>I was following the 'development mailing list' link at https://www.gnu.org/software/guile/contribute/
<thchr>Thanks all
<dsmith-work>thchr: Curious what you are working on..
<thchr>justin_smith: Sorry, my connection dropped out and I missed your messages (found them in the log now). I guess the core problem is that I have no idea what the overhead for the Scheme->C call is.
<thchr>justin_smith: I'm calling a function I `(define ...)`d on the Scheme side; so I guess I'm reusing a lambda?
<thchr>Working on photonic crystals
<justin_smith>yeah (define (f x) ...) is a shorthand of (define f (lambda (x) ...))
<justin_smith>so if you just call f, it will reuse that lambda
<justin_smith>it's the call to lambda that does the compilation work, and it should be straightforward to ensure your code doesn't do that in the path C is invoking
<justin_smith>unless guile has a very weird compiler
<thchr>So, using `scm_call_1(f, arg)` is as good as it gets then?
<justin_smith>thchr: likely, but you could also try measuring what happens when smaller vs. larger units of work cross the c<->scheme boundaries? and/or you could just ask the people who wrote the compiler
<thchr>justin_smith: I'll try both then
<justin_smith>if you have the patience for it, gdb on scheme calling your code, and stepping by instructions rather than lines of code is likely extremely informative
<thchr>I never got around to picking up gdb :(
<justin_smith>I discovered I was doing goops indirection for 80% of my loop once that way, lol
***terpri__ is now known as terpri
***sneek_ is now known as sneek
<ArneBab>dsmith-work: wow, good to know :-)
<ArneBab>dsmith-work: do you see something in Rust that could be added to Guile?
*ArneBab just wanted to build a small m3u-file fixer — two hours later conf can create wisp-projects but there is still no m3u-fixer :-) https://hg.sr.ht/~arnebab/conf
<dsmith>ArneBab: Hmm. Nope. I don't think it would be Scheme any more then.
<dsmith>Pattern matching. But Guile already has that. Someone is working on making it more awesome.
<dsmith>ArneBab: I just came off of doing about 4-5 years of Python, and really hungering for a statically typed, ahead-of-time compiled language.
<ArneBab>dsmith-work: at work I’m currently alternating between Javascript and Java; I learned to both appreciate types in Java and the flexibility of Javascript (along with the simpler structures people build with it). The main thing I’d carry over to Scheme is to have more focus in tutorials on records.
<ArneBab>define-record-type gives you the data-classes we’re hungering for in Java
<ArneBab>dsmith: did you already experiment with extending Guile with high-performance Rust?
<dsmith>Nope
<ArneBab>that’s a use-case for which I’d really love to see a tutorial :-)
<dsmith>Just learning Rust
<ArneBab>it’s crazy that rust managed to be the place where performance-innovation takes place
<ArneBab>ripgrep is a game-changer
<dsmith>So with the C<->Scheme interface, it's always a question of who allocates memory, and who is reposible for freeing it. That's one thing that Rust has down cold.
<ArneBab>(with crazy I mean: hard to believe but real)
<dsmith>Yeah, started using rg in emacs. Very nice.
<ArneBab>so with Rust<->Scheme you’d keep memory on the Rust side and only direct rust from Scheme
<ArneBab>rg allows me to skip IntelliJ for Javascript development and instead use dumb-jump and projectile for symbol resolution :-)