IRC channel logs
2017-04-11.log
back to list of logs
<webshinra>huw. I realise I have missed something in my scheme journey <webshinra>if you get a symbol as argument, how can you get the value associated to this symbol in the current context? <wingo>scheme doesn't have a concept of a context that you can look up values in. identifiers in scheme are lexically scoped, and statically so: you can't look up a symbol in a scope like that, generally. <wingo>there is (ice-9 local-eval) tho <wingo>but generally it's not recommended <wingo>two identifiers can have the same name but be distinct <webshinra>okay, i'll use a less ideous but more verbose option :D <xvilka>btw, from benchmarks I understood, that guile supports R7RS <xvilka>but there is no easy way to enable it? <wingo>guile doesn't have that yet. perhaps by 2.2.1 or 2.2.2. <Petit_Dejeuner>It gives you similar semantics to *special-variables* in lisp. (Dynamically bound.) <webshinra>well, that's interesting and I didn't know about it, so thank you :P <webshinra>et quand on ne dort pas, on est privé de Petit_Dejeuner, ce qui est dommage. <Petit_Dejeuner>1,1The joke is I'm not french and had to look up all the verbs in that except for 'est'. <ArneBab_>wingo: I now have benchmarks in which I see a (car L) (with L as (iota N) taking about 1ns longer than an empty (λ() #t) and (+ N m) taking about 3ns. I have a core i3, 3.1GHz, is this the maximum performance I can expect? <ArneBab_>In Fortran I see about 2ns per addition (when operating on about 3 MiB of data) <ArneBab_>I also see (+ (+ (+ N m) 1) 2) taking 1e-8 seconds while (+ N m) takes 0.5e-8 seconds. <ArneBab_>so these two additions are about 5ns, or 15 cycles <ArneBab_>In fortran I see a sum operation over 2e7 random numbers taking 0.02s (1ns per number) <ArneBab_>(apply + L) with L as (iota 2e7 1 0) takes 1s <ArneBab_>so there rI have 50ns per number, but with (+ N m) I need only 10ns <ArneBab_>(gc-disable) gets me down to 0.5s for (apply + L) <ArneBab_>python takes 1.3 seconds for the same task <ArneBab_>wingo: do you know tricks to make this faster? <ArneBab_>doing this in a plain loop in Python takes 0.6s → guile is faster there <ArneBab_>davexunit: how would you store the numbers? <davexunit>ArneBab_: how are you storing them in fortran? <davexunit>you're using 2 different data structures. try making a bytevector. <ArneBab_>I know that, but I don’t know how to replicate the fortran task with Guile <daviid> ArneBab_: if it is to measure +, you may as well use do <ArneBab_>with this I still get 0.6s: ,time (let lp ((n (- (u32vector-length a) 1))) (when (> n 0) (u32vector-ref a n)(lp (- n 1)))) <ArneBab_>with (define a (make-u32vector (inexact->exact 2e7) 1)) <ArneBab_>ah, that’s the time for the u32vector-ref … <ArneBab_>which fortran does not have to do explicitly <ArneBab_>davexunit, daviid: thank you for your support — I’ll be back later <daviid>ArneBab_: not sure what youe are trying to do, but is this close? ,time (let ((n 3)) (do ((i 0 (+ i 1))) ((= i 2000000)) (+ i n))) <daviid>;; 0.062915s real time, 0.062868s run time. 0.000000s spent in GC. <ArneBab_>,time (let ((n 3)) (do ((i 0 (+ i 1))) ((= i 20000000)) (+ i n))) <ArneBab_>this shows what it does: ,x (λ ()(let ((n 3)) (do ((i 0 (+ i 1))) ((= i 20000000)) (+ i n)))) <ArneBab_>looks like 4 operations in the tight loop (between L1 and L2), each taking 2ns <ArneBab_>daviid: I’m pretty sure fortran does not have a (handle-interrupts) operation in the loop <amz3`>wingo: the link about gc in webassembly seems interesting <amz3`>I found out that biwascheme is slow and/or get slower using firefox 45 (debian stable version) <amz3`>Petit_Dejeuner: what's the difference between paramter and fluids? do you know? <Petit_Dejeuner>amz3`: iirc, parameters are defined in terms of fluids, but I don't know anything else <amz3`>ArneBab_: Do the sum must happen on values that are precalculated? do you know in advance all of them? <amz3`>Petit_Dejeuner: it seems to me they are semantically equivalent. Only the API is different. <ArneBab_>amz3`: the values should not be precalculated, it was just the easiest thing to test. If I do the same in Fortran, the compiler just optimizes away all my code and precalculates the result, therefore I have to use random numbers :)