IRC channel logs

2018-05-09.log

back to list of logs

***wleslie_ is now known as wleslie
<pera>Hi! I was wondering if any schemer could review this code here (35 lines): https://gist.github.com/pera/fea285e298075c6f8ab9f16dd4eb660f
<rain1>at a glance this code looks very good, why dont you tell us about it though?
<pera>rain1: I ported that code from this https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/binarytrees-racket-2.html
<rain1>ah
<pera>I was curious if there was something obviously inefficient on my version, because it takes almost 10 times more than the racket version
<rain1>hmmm not sure how we could figure out why there is such a big difference in speed
<pera>I also made a r6rs version that runs on racket which takes almost the same time than the racket version
<pera>I tried to profile it but I am not sure how to read the results :)
<pera>36% of the execution time is being spent inside the check function, and 24 on make
<rain1>so i guess it would be good to know the %'s for racket too
<rain1>then we can see if guile is slower overall, or one particualr part is being slow
<pera>uhm thats a good idea
<daviid>pera: did not look at the paste, but is this compiled (module) code your are running?
<pera>daviid: to be honest I am not sure, but I believe it is: when one runs guile file, isn't guile compiling and then running from a temp directory?
<daviid>yes, but you better be sure to compare benchmark using compiled code ...
<pera>do you mean to not count the compile time?
<daviid>i suggest you make a module, compile it, guild compile .. then start a repl and ,use (the-module), then profiling the run
<pera>thanks I will try that
<daviid>it could be that the code you translated used tricks tha makes it fatser on racket as well, i really don't know
<pera>Sure, although I actually choose this program because of its simplicity (it doesn't look like there is any optimization trick on it)
<daviid>ok
<daviid>10x times slower does not sound 'normal'
<pera>Sorry, it's actually ~9 times more time than chez-scheme, and ~7 times more than racket (both using plain racket and r6rs)
<pera>It takes about 12 seconds to finish on chez, and almost 2 minutes on guile
<pera>wow I think I found something
<pera>those three defines at the beginning (e.g. (define node cons)) make things pretty slow
<rain1>oh thats funny
<rain1>you'd expect that to have 0voverhead
<pera>right!
<pera>so by using cons car cdr instead of nodes it takes half of the time to complete
<lispmacs`>Hi, when I compile module with a class definition, I get strange error:
<lispmacs`>./td/enemy.scm:45:0: source expression failed to match any pattern in form (define-class-pre-definition (#{:accessor}# .prev-x #{:init-keyword}# #{:prev-x}#))
<daviid>define-class-pre-definition does not exists
<daviid>or you defined it, but then it has a bug ..
<lispmacs`>it just looks like a normal class definition to me
<lispmacs`>I don't know what define-class-pre-definition is
<daviid>it does not exists
<daviid>i don't know where you pick-up that code
<daviid>what guile has is define-class
<daviid>look in the manual ...
<lispmacs`>just searched the whole info manual for it, not there
<daviid>yep, as i said... use define-class
<lispmacs`>that is what I used
<lispmacs`>define-class
<daviid>ah
<daviid>did you ,use (oop goops) firt
<daviid>try in a repl
<daviid>,use (oop goops)
<daviid>define-class
<lispmacs`>I have a :use-module (oop goops) option in the module def
<daviid>then tou have a syntax bug in your define-class form
<daviid>double check and compare with some basic example ...
<lispmacs`>is there a paste channel or something?
<daviid>debian-paste
<lispmacs`>to show you class definition?
<daviid>or a tor (no js) prefered
<lispmacs`> https://paste.debian.net/1023919/
<daviid>try this i a repl (define-class <foo> () (a #:accessor a))
<daviid>lispmacs`: it is #:accessor, not :accessor
<daviid>true for other keywords as well
<daviid>#:init-keyword ...
<daviid>also, I (personally) don't recommend the java notation, rather, I use !prev-x, !prev-y ... at your discretion, but goops is not java ...
<lispmacs`>Isn't there some command I can use to allow : to be read as #:?
<lispmacs`>I'm sure I read that in manual, but am having trouble finding it
<daviid>and prefixing using ! captures the attention of users, imo, that this is possibly mutable, thought also clearly not buit-in procedure, like set! ...
<daviid>there is, but I don't recommend it
<pera>wtf by just using let instead of define I get a 2x speed improvement
<daviid>i don't remember how to set read-keyword or something ... you'd have to look in the manual
<daviid>the biggest problem is the code becomes not portable (I won't even look at it)
<daviid>i won't run it ...
<daviid>since i would have to set this paramemter and I dont wan't ...
<lispmacs`>daviid: haha, I'll remember that in case I ever actually have paying client and it turns out to be you
<lispmacs`>daviid: portable isn't an issue is it if I set the prefix option inside my module, right?
<lispmacs`>when you import, you don't have to use :, right?
<daviid>i think the setting becomes global
<daviid>you'll get used to #: ... if you wish, it also makes the code clearly scheme (as opposed to CL)
<lispmacs`>oh
<daviid>which nice
<daviid>but hey, do as yu wish
<lispmacs`>It says here :name is an R5RS violation, so that probably isn't good
<daviid>by the way, did you read my recommendation, the email lk I pasted a few days ago? curious
<lispmacs`>yeah but it didn't seem to apply to my problem or make much sense to me
<daviid>oh, that means you still don't understand much about what's going on :), and how to properly handle it (the interaction between goops and the module system), and it also means I didn't write this well enough then: becaue I answered exactly because of your complain of 'how to export classes' ... I suggest you keep it in your links and re read it as your work progress
<lispmacs`>daviid: yeah, am still kind of a guile noob. I did read through most of the info manual on goops but of course it is hard to integrate everything in one reading
<lispmacs`>i am working an arcade game in Guile Scheme. I'd send you the link but I wouldn't want you to get sick or anything looking at the code ;)
<lispmacs`>or send the lisp ninja squad after me
<daviid>lispmacs`: till you understand, if you use more then one guile module for yur game, I strongly recommend you blindly apply these recommendations
<daviid>more then one guile module using goops I mean...
<daviid>lispmacs`: keep the game work! and welcome, we, guilers, are always extremely happy to try to help, have to run bbl. ping me wrt goops quiz,, if i can, i'd behappy to try to help ...
***Raimondii is now known as Raimondi
<dsmith-work>Wednesday Greetings, Guilers
<OrangeShark>happy wednesday!
<foojin>Does anybody use (texinfo)? It fails on every .texi file that I've tried feeding to it. Its tests seem to invoke its functions with only small snippets, so maybe it's not supposed to work like that yet?
<civodul>foojin: Guix uses it for small snippets (package descriptions)
<civodul>but it's definitely not featureful enough to process whole manuals
<civodul>any help in that direction would be welcome, though :-)
<roelj>Is there a limit to how many backslashes Guile can handle in a string-append? :P
<foojin>civodul: I see. I don't think I know enough about texinfo to help out.
<civodul>roelj: you mean backslashes in string literals?
<civodul>as many as you want i suppose :-)
<janneke>there's probably a memory limit
<civodul>the GNU Coding Standards insist that There Shall Not Be Arbitrary Limits
<roelj>Hehe
<civodul>physical memory limit is a different thing ;-)
<roelj>Well, all I need is 6 backslashes.
<roelj>But I am probably just confused then.
<janneke>civodul: yeah, no arbitrary limits.
<amz3`>What would be the solution to share "work" in a cluster of machines. I am thinking about using a priority queue. I identified three priorities: urgent, realtime, normal and best effort. I am looking for a way to schedule the "tasks" based on their priority.
<amz3`>Let's consider that the database is reliable and that you can acquire exclusive locks and do atomic 'add', 'xor', 'or', 'and' operartions
<amz3`>it's like wiredtiger but distributed
<amz3`>also you can build linked list
<amz3`>wiredtiger doesn't support binary atomic operations
<amz3`>at least it's not a primitive
<amz3`>I am thinking about dedicating a thread to keep the priority queue (modeled as linked list) sorted using an aging algorithm that looks like f(time) = priority + time^n that is the older the task get the higher the priority
<amz3`>basically, I'd like to build something like fibers but distributed to multiple machines
<amz3`>but fiber doesn't use priorities