"No I'm benchmarking the functions returned by f1-4." 

Where did I say different? 

In any event, I'm trying to help you understand why your benchmarking 
results are not aligning with your expectations and assumptions about the 
code you wrote. 

I would really like to help you gain a greater understanding here, but I 
must admit you are coming off as fairly confrontational, so I am hesitant 
to continue this conversation. Good luck. 

On Thursday, July 3, 2014 2:14:51 PM UTC-4, Pascal Germroth wrote:
>
> On Thursday, July 3, 2014 6:15:32 PM UTC+1, adrian...@mail.yu.edu wrote:
>
>> I'm not sure I understand what you're saying here. :( Your example is 
>> simply benchmarking the same bit of code in each form. Why would evaluating 
>> one explicitly affect that benchmark? Your original example called eval in 
>> the body of the functions that you're benchmarking. That is where the 
>> overhead comes from. 
>>
>
> No I'm benchmarking the functions returned by f1-4.
> They use different ways of generating their return function, i.e. by 
> eval'ing the function constructor (fn [] ...) once before the benchmark -- 
> the `let [f (f1 v)]` part.
> Of course the call to (eval) takes time, but my point is that a function 
> that was generated using (eval) is exactly the same as one generated 
> statically.
>
> Except somehow when unquoting the x-parameter to create the eval'ed form 
> things are being cloned that shouldn't. That's what I'm measuring.
>
> Actually I just found a better example that doesn't need timing etc:
>
> (def x (Object.))
> (str x) ; "java.lang.Object@..."
> `(str ~x) ; (clojure.core/str #<Object java.lang.Object@...>)
> (eval `(str ~x)) ; RuntimeException: Can't embed object in code, maybe 
> print-dup not defined: java.lang.Object@...
> (eval `(str x)) ; "java.lang.Object@..." -- works through resolving user/x
>
> So it's not actually a problem with quoting, that returns a list with str 
> and the object as expected.
> But eval'ing that list fails because it can't print-dup'ed?! I can't tell 
> where that's happening, because it looks like clojure.lang.Parser.eval is 
> actually processing the elements of the list as I expected…
>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to