Re: Best tools for profiling Clojure programs?
Oops, forgot to state Java Mission Control flight recording is for Oracle JVM only. On Tuesday, July 1, 2014 1:10:42 PM UTC+2, Niels van Klaveren wrote: > > A new option for test purposes is included in JDK 1.7.0_40 and up and is > called Java Mission Control. It is located in the JDK as /bin/jmc.exe. > > With it you can connect to a local java process, or remotely through RMI, > and record all kinds of performance characteristics in a Flight Recording. > Such a flight recording can be a defined for a limited time, or it can > buffer the recording to record only the latest x minutes. Overhead depends > on the monitoring template used, but is typically around 2%. These > recordings can then be browsed, analyzed and queried in a pretty good > interface after the recording has been saved. > > To do so, you need to have the following options in your project.clj, and > run your project on a JDK > 1.7.0_40 > > :jvm-opts [ > ; add Flight Recording options > "-XX:+UnlockCommercialFeatures" > "-XX:+FlightRecorder" > ; add RMI connection (to connect to process remotely or > running as service/daemon) > ; this example has NO authentication enabled through the > RMI port > "-Dcom.sun.management.jmxremote" > "-Dcom.sun.management.jmxremote.port=" > "-Dcom.sun.management.jmxremote.authenticate=false" > "-Dcom.sun.management.jmxremote.ssl=false"] > > > On Friday, June 20, 2014 3:05:05 PM UTC+2, ru wrote: >> >> Hi all, >> >> What performance profiling instrument somebody can recommend for Clojure >> programs and corresponding documents, articles or tutorials. Thanks in >> advance. >> >> Sincerely, >> Ru >> > -- 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.
Re: Code health metrics
Hi Chris, I have long collected metrics on various Clojure code bases, and have had grand plans for automating the process with an open source tool. The metrics you look at depend heavily on what you care about - the most telling metrics I've used recently are Assertion Density [1], an adaption of LSCC [2], and an attempt at cognitive load [3]. Typical things I look at are namespace manipulation/jumps per file, docstring-on-function-percentage, distribution of defn size, distribution of anonymous function size, number of functions per namespace, number of symbols per namespace. In the past I've looked at an adaptation of cyclomatic complexity, distribution of all functions used, and namespace fan-in/fan-out. I'll echo what others have said above: eastwood, dynalint, and basic `lein check` are good approaches for general lint activities. Cheers, Paul [1] http://cacm.acm.org/magazines/2014/2/171689-mars-code/fulltext [2] http://139.141.170.133/drjehad/A%20precise%20method-method%20interaction%20based%20cohesion.pdf [3] http://www.ucalgary.ca/icic/files/icic/59-JECE-IEEE919.pdf -- 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.
Re: ANN: ClojureScript 0.0-2261
Does murmur3 hashing effect performance? kl. 04:42:39 UTC+2 onsdag 2. juli 2014 skrev David Nolen følgende: > > ClojureScript, the Clojure compiler that emits JavaScript source code. > > README and source code: https://github.com/clojure/clojurescript > > New release version: 0.0-2261 > > Leiningen dependency information: > > [org.clojure/clojurescript "0.0-2261"] > > ### Changes > * Dependency on Clojure 1.6.0 > * Dependency on latest Google Closure Compiler > > ### Enhancements > * Murmur3 hashing for collections > > ### Fixes > * CLJS-817: Warning on use of undeclared var when creating recursive > definition > * CLJS-819: cljs.reader cannot handle character classes beginning with > slashes in regex literals > * CLJS-820: Missing invoke without arguments in MetaFn > * CLJS-816: clojure.set/rename-keys accidentally deletes keys > -- 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.
Re: ANN: ClojureScript 0.0-2261
Some operations are slightly faster. Some operations are slightly slower but should not be noticeable. If you experience otherwise, detailed reports are welcome. David On Wed, Jul 2, 2014 at 8:16 AM, Robin Heggelund Hansen wrote: > Does murmur3 hashing effect performance? > > kl. 04:42:39 UTC+2 onsdag 2. juli 2014 skrev David Nolen følgende: >> >> ClojureScript, the Clojure compiler that emits JavaScript source code. >> >> README and source code: https://github.com/clojure/clojurescript >> >> New release version: 0.0-2261 >> >> Leiningen dependency information: >> >> [org.clojure/clojurescript "0.0-2261"] >> >> ### Changes >> * Dependency on Clojure 1.6.0 >> * Dependency on latest Google Closure Compiler >> >> ### Enhancements >> * Murmur3 hashing for collections >> >> ### Fixes >> * CLJS-817: Warning on use of undeclared var when creating recursive >> definition >> * CLJS-819: cljs.reader cannot handle character classes beginning with >> slashes in regex literals >> * CLJS-820: Missing invoke without arguments in MetaFn >> * CLJS-816: clojure.set/rename-keys accidentally deletes keys > > -- > 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. -- 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.
Re: Code health metrics
A little more context on what I'm considering. I work in a team of about 10 developers on a Clojure project. In the larger enterprise there are mainly Java applications. I'm interested in a way to visualise which parts of the codebase are getting sticky and might require intervention. As well as being a non-subjective measure of relative tech debt for our internal purposes, this is also about communicating with the rest of the enterprise in terms similar to ones they already understand. Linting tools are very useful, and of course the subjective impressions of those who work with the codebase are very important too. Cheers, Chris On 2 July 2014 12:38, Paul deGrandis wrote: > Hi Chris, > > I have long collected metrics on various Clojure code bases, and have had > grand plans for automating the process with an open source tool. > > The metrics you look at depend heavily on what you care about - the most > telling metrics I've used recently are Assertion Density [1], an adaption > of LSCC [2], and an attempt at cognitive load [3]. Typical things I look > at are namespace manipulation/jumps per file, > docstring-on-function-percentage, distribution of defn size, distribution > of anonymous function size, number of functions per namespace, number of > symbols per namespace. In the past I've looked at an adaptation of > cyclomatic complexity, distribution of all functions used, and namespace > fan-in/fan-out. > > I'll echo what others have said above: eastwood, dynalint, and basic `lein > check` are good approaches for general lint activities. > > Cheers, > Paul > > [1] http://cacm.acm.org/magazines/2014/2/171689-mars-code/fulltext > [2] > http://139.141.170.133/drjehad/A%20precise%20method-method%20interaction%20based%20cohesion.pdf > [3] http://www.ucalgary.ca/icic/files/icic/59-JECE-IEEE919.pdf > > -- > 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. > -- 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.
guide on how to plug eastwood into clojure.test unittests?
Does anyone have a guide on how to plug https://github.com/jonase/eastwood into my clojure.test unittests? Or even if eastwood is the correct tool to be using for lint checking my files? Thanks -- 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.
Re: guide on how to plug eastwood into clojure.test unittests?
Eastwood is a reasonable tool to consider for lint checking your files, IMNSHO. It is currently lacking a feature that would make it more useful as an automated step in a build/release process, which is the ability to disable particular warnings on very small sections of code. If such a feature is added, it will become possible to run Eastwood on a code base, and if there are 0 warnings in the output, the developer will know that the only warnings that possibly exist are false positive warnings they have manually checked and disabled before. A little bit of thought has been exerted on this [1] [2], but no code or testing yet. I hope to find time for it within a month or so. Regarding invoking Eastwood from clojure.test, I'm sure that would be possible, but it isn't exactly convenient to invoke it that way. Hopefully someone else can describe their preferred method for adding a command line invocation like 'lein eastwood' to their checkin/CI/release process. Andy [1] https://github.com/jonase/eastwood/issues/21 [2] https://groups.google.com/d/msg/clojure-dev/5_dlGSNR6xQ/l8bkwjTPKioJ On Wed, Jul 2, 2014 at 3:55 AM, Chris Morgan wrote: > > Does anyone have a guide on how to plug https://github.com/jonase/eastwood > into my clojure.test unittests? > > Or even if eastwood is the correct tool to be using for lint checking my > files? > > Thanks > > > -- > 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. > -- 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.
Broad question about best-practices for structs
As an exercise, I'm trying to port a library that I originally wrote in C#. It's actually a Neural Network, so my imperative design was a pretty straightforward tree-like structure of nodes that could manipulate state. During my port to Clojure, I've been writing functions that take multiple arrays (typically "graph of outputs" and "graph of weights"). Then I remembered about structs, so I refactored my code to deal with a collection of structs "node". A node contains a vector of weights and an output. In this way, I am only passing around a single collection that can represent my whole neural network. Now I'm running into the fact that I kind of need to update the structure. So what I've implemented is essentially, each time you calculate the network output - my code iterates over the list of structs and creates new ones with the "updated" values. Performance is something that people don't seem to talk about much with Clojure, but I'm kind of thinking my approach with structs might not be the best one. My question is, am I approaching this incorrectly? I've seen a lot of resources that deal with the syntax of Clojure but haven't found a good guide on actual application design. My usage of structures seems natural to me, but that makes me question it even more! For anyone interested, here is my code: https://www.refheap.com/87775 I'm going to open source the library after many many iterations to beautify it. I'm sure it's a bit too haphazard to make sense to right now... Thank you for your time! -SharpCoder -- 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.
Re: Broad question about best-practices for structs
defstruct is deprecated. You should use defrecord or deftype instead. You can define operations on these via defprotocol. And you can even type hint the members: (defprotocol IScale (scale [this ^double amount])) (deftype Point [^double x ^double y] IScale (scale [this amount] (Point. (* x amount) (* y amount (scale (Point. 10 1)) Timothy On Wed, Jul 2, 2014 at 9:41 AM, SharpCoder wrote: > As an exercise, I'm trying to port a library that I originally wrote in > C#. It's actually a Neural Network, so my imperative design was a pretty > straightforward tree-like structure of nodes that could manipulate state. > During my port to Clojure, I've been writing functions that take multiple > arrays (typically "graph of outputs" and "graph of weights"). Then I > remembered about structs, so I refactored my code to deal with a collection > of structs "node". A node contains a vector of weights and an output. In > this way, I am only passing around a single collection that can represent > my whole neural network. > > Now I'm running into the fact that I kind of need to update the structure. > So what I've implemented is essentially, each time you calculate the > network output - my code iterates over the list of structs and creates new > ones with the "updated" values. Performance is something that people don't > seem to talk about much with Clojure, but I'm kind of thinking my approach > with structs might not be the best one. > > My question is, am I approaching this incorrectly? I've seen a lot of > resources that deal with the syntax of Clojure but haven't found a good > guide on actual application design. My usage of structures seems natural to > me, but that makes me question it even more! > > For anyone interested, here is my code: https://www.refheap.com/87775 > I'm going to open source the library after many many iterations to > beautify it. I'm sure it's a bit too haphazard to make sense to right now... > > Thank you for your time! > -SharpCoder > > -- > 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. > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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.
Re: Code health metrics
How large is your Clojure codebase? On Wednesday, July 2, 2014 6:33:42 AM UTC-7, Chris Ford wrote: > > A little more context on what I'm considering. > > I work in a team of about 10 developers on a Clojure project. In the > larger enterprise there are mainly Java applications. > > I'm interested in a way to visualise which parts of the codebase are > getting sticky and might require intervention. As well as being a > non-subjective measure of relative tech debt for our internal purposes, > this is also about communicating with the rest of the enterprise in terms > similar to ones they already understand. > > Linting tools are very useful, and of course the subjective impressions of > those who work with the codebase are very important too. > > Cheers, > > Chris > > > On 2 July 2014 12:38, Paul deGrandis > > wrote: > >> Hi Chris, >> >> I have long collected metrics on various Clojure code bases, and have had >> grand plans for automating the process with an open source tool. >> >> The metrics you look at depend heavily on what you care about - the most >> telling metrics I've used recently are Assertion Density [1], an adaption >> of LSCC [2], and an attempt at cognitive load [3]. Typical things I look >> at are namespace manipulation/jumps per file, >> docstring-on-function-percentage, distribution of defn size, distribution >> of anonymous function size, number of functions per namespace, number of >> symbols per namespace. In the past I've looked at an adaptation of >> cyclomatic complexity, distribution of all functions used, and namespace >> fan-in/fan-out. >> >> I'll echo what others have said above: eastwood, dynalint, and basic >> `lein check` are good approaches for general lint activities. >> >> Cheers, >> Paul >> >> [1] http://cacm.acm.org/magazines/2014/2/171689-mars-code/fulltext >> [2] >> http://139.141.170.133/drjehad/A%20precise%20method-method%20interaction%20based%20cohesion.pdf >> [3] http://www.ucalgary.ca/icic/files/icic/59-JECE-IEEE919.pdf >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.
auto-reloading tests with diffs
Hi, I'm doing some tests that require diff reporting (ala "lein difftest") but want them to autoreload (ala "lein prism"). Does anyone know if there's a way to make these libraries function together? Is there some other approach/library I should be using to get both diff reporting and autoreloading at once? Thanks for any pointers! -- 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.
Re: auto-reloading tests with diffs
FYI, I installed difftest via a plugin entry in my ~/.lein/profiles.clj. This requires me to call "lein difftest", since "lein test" still shows the un-diffed test results. I suspect there's some extra step I need to take to hook difftest into the default error reporting to make it work with "lein prism" but I can't find any documentation for that... any pointers are welcome! On Wednesday, July 2, 2014 1:16:47 PM UTC-5, Conrad wrote: > > Hi, I'm doing some tests that require diff reporting (ala "lein difftest") > but want them to autoreload (ala "lein prism"). > > Does anyone know if there's a way to make these libraries function > together? Is there some other approach/library I should be using to get > both diff reporting and autoreloading at once? > > Thanks for any pointers! > -- 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.
Deploying to Clojars no longer works
I have been deploying the same project to clojars for quite a while now(5 months?); for some reason it decided it no longer wanted to work. After giving my pass phrase I get "peer not authenticated". I have not changed computers nor do I have a new internet connection. Does anyone know what the heck I've done to blow it up? -- 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.
reloading enlive templates
Hi, I am trying to reload my enlive templates with a watcher, how it was suggested in this issue: https://github.com/cgrand/enlive/issues/6 I am calling this function of start of my application: (watcher/watcher ["resources/"] (watcher/rate 50) ; poll every 50ms (watcher/on-change (fn [file] (do (println "file changed: " file) ;(use 'de.sveri.clj.adspread :reload) ;as soon as I uncomment this, the anonymous function is not called anymore But just like I stated in the comment, as soon as I try to reload a namespace the anonymous function is not executed anymore, whereas without the (use ...) call it gets executed on file change. I also tried to call (reload 'namespace) but that did not work either. Any ideas on how to fix this or make enlive templates reload on change? Best Regards, Sven -- 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.
Why does unquote clone values?
Hi, I tried replacing a closure with a dynamically built and evaluated metafunction but discovered that it was actually slower. Here's a minimal example: (defn f1 [x](fn [y ] (=x y ))) (defn f2 [x] (eval `(fn [y#] (= ~x y# (defn f3 [x] (eval `(fn [y#] (= ~@[x] y# (use 'criterium.core) (def v nil) ; nil -> same speed. (let [f (f1 v)] (quick-bench (f v))) ; 7.1ns (let [f (f2 v)] (quick-bench (f v))) ; 5.4ns (let [f (f3 v)] (quick-bench (f v))) ; 5.4ns (def v [10 20]) ; vector -> f2 slower (let [f (f1 v)] (quick-bench (f v))) ; 6.8ns (let [f (f2 v)] (quick-bench (f v))) ; 78.0ns (let [f (f3 v)] (quick-bench (f v))) ; 5.3ns (def v {10 20}) ; map -> f2 and f3 slower?! (let [f (f1 v)] (quick-bench (f v))) ; 6.6ns (let [f (f2 v)] (quick-bench (f v))) ; 151.0ns (let [f (f3 v)] (quick-bench (f v))) ; 152.0ns I guess f2 runs this much slower than f1 because it doesn't actually pass a reference to x when unquoting, but clones the value, which means it needs to compare the lists element-wise. The other cases all compare the references which is why the nil case runs at the same speed. Why does unquoting ~x clone the vector? And why doesn't splice unquoting ~@[x] appear to clone the vector, but *does* clone the map?! Is there a way to pass all values per reference into a quote, to get exactly the same behaviour as f1? Cheers, -- pascal -- 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.
[ANN] Dynohub: DynamoDB client + transaction layer
Dynohub, a Clojure DynamoDB client with transaction layer https://github.com/ozjongwon/dynohub Dynohub is a transperent DynamoDB client with a port of transaction library(https://github.com/awslabs/dynamodb-transactions) There are three layers of abstraction: * Dynohub - a plain client layer * Dynolite - a handy client layer on top of Dynohub * Dynotx - a transaction enabled client layer on top of Dynolite (NOTE: All the limits of Amazon's transaction library also applied to Dynohub's transaction layer, Dynotx) Using 'with-transaction' macro you can add transaction! An example (from test): (deftest conflicting-tx-test (testing "Conflicts" (setup-db) (dt/with-transaction [t1] (dt/put-item test-table {:id "conflictingTransactions_Item1" :which-transaction? "t1"}) (dt/put-item test-table {:id "conflictingTransactions_Item2"}) (dt/with-transaction [t2] (dt/put-item test-table {:id "conflictingTransactions_Item1" :which-transaction? "t2 - I win!"}) (utils/ignore-errors (dt/commit t1)) (dt/put-item test-table {:id "conflictingTransactions_Item3"}))) (is (empty? (dl/scan :_tx_table_))) (is (empty? (dl/scan :_image_table_))) (is (empty? (dl/get-item test-table {:id "conflictingTransactions_Item2"}))) (is (not (empty? (dl/get-item test-table {:id "conflictingTransactions_Item3"} (is (= (get (dl/get-item test-table {:id "conflictingTransactions_Item1"}) :which-transaction?) "t2 - I win!" Any bug reports will be appreciated. Cheers - Jong-won Choi -- 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.
Re: Why does unquote clone values?
It gets even weirder. I tried this hoping it would create a closure like f1 does: (defn f4 [x] (eval `(let [[x#] ~@[[x]]] (fn [y#] (= x# y#) And indeed using no.disassemble in my test cases f1 and f4 always create the same bytecode: a clojure.lang.AFunction with a field holding the value x, which is passed through the function's constructor. Likewise, f2 and f3 always create the same bytecode: an AFunction without any fields and an empty constructor, with a static constructor creating a new vector/map/nil. All the bodies are identical, calling clojure.lang.Util.equiv, with the argument and the stored reference object. (now talking about the functions returned by f1-4) But: in the vector case, f4 takes 140ns, almost twice of what even f2 takes, and much longer than f1 (which is apparently identical!). It makes no sense that f3 (identical to f2) doesn't take that long. In the map case, f2, f3 and f4 take the same time, 150ns, again making no sense as f1=f4. Is there some metadata I'm missing? -- 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.
Re: guide on how to plug eastwood into clojure.test unittests?
On Wed, Jul 2, 2014 at 3:01 PM, Andy Fingerhut wrote: > Hopefully someone else can describe their preferred method for adding a > command line invocation like 'lein eastwood' to their checkin/CI/release > process. > @Chris Have you tried adding `lein eastwood` to your build process? If you did, and it didn't work perhaps you can provide more details. -- Kind Regards, Atamert Ölçgen -+- --+ +++ www.muhuk.com -- 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.
Re: Why does unquote clone values?
Hi Pascal, On Wed, Jul 2, 2014 at 10:19 PM, Pascal Germroth wrote: > I tried replacing a closure with a dynamically built and evaluated > metafunction but discovered that it was actually slower. > If evaluating code during run is slower than AOT compiling it, it wouldn't surprise me. > I guess f2 runs this much slower than f1 because it doesn't actually pass > a reference to x when unquoting, but clones the value, which means it needs > to compare the lists element-wise. > > This is interesting. Were you able to confirm it or are you just guessing? (I'm just curious.) -- Kind Regards, Atamert Ölçgen -+- --+ +++ www.muhuk.com -- 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.