This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-11
Channels
- # alda (9)
- # beginners (28)
- # boot (94)
- # cider (21)
- # clojure (179)
- # clojure-android (4)
- # clojure-boston (2)
- # clojure-brasil (1)
- # clojure-denmark (1)
- # clojure-dev (194)
- # clojure-italy (1)
- # clojure-russia (8)
- # clojure-uk (1)
- # clojurescript (269)
- # clojurex (22)
- # clojutre (2)
- # cursive (4)
- # datomic (3)
- # devops (1)
- # events (7)
- # jobs (6)
- # ldnclj (30)
- # luminus (3)
- # off-topic (8)
- # reagent (3)
I'm trying to understand the performance differences of 1. (inc x) 2. (+ 1 x) and 3. (def myinc inc) (myinc x). What should be faster, and why? When I test with criterium it seems like the fastest would be 1 then 2 then 3.
this is the code for inc https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L887
and of + https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj#L949
how do I know if the inline path was taken, or the main path?
(thanks, btw. I didn't think of going to the source)
@goodwind89: I believe inline is used whenever the function is called directly
Function body used whenever it is used as a higher order function
But that's just based off this - https://groups.google.com/forum/#!topic/clojure/8ixHD07XdX0 - not real experience with that meta attribute
Specifically tbc++'s answer
Thanks. I'm just trying to understand why (def myinc inc) (myinc x) performs worse. Guess the only option is to read the bytecode.
@goodwind89: compare the generated bytecode
I've just installed my OS on a new PC, and trying to create a new lein project, and I'm getting:
$ lein new chestnut fiddle
Failed to resolve version for chestnut:lein-template:jar:RELEASE: Could not find metadata chestnut:lein-template/maven-metadata.xml in local (/home/xlevus/.m2/repository)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
Could not find template chestnut on the classpath.
I did this on another machine just a week ago and I could have sworn it worked flawlessly.cleared out everything in ~/.lein
and ~/.m2
and still no go
$ lein version
Leiningen 2.5.1 on Java 1.8.0_45-internal OpenJDK 64-Bit Server VM
you can set the DEBUG env var to get from detail from lein
$ DEBUG=true lein new chestnut fiddle (14:02)
Leiningen's classpath: /home/xlevus/.lein/self-installs/leiningen-2.5.2-standalone.jar
Applying task new to [chestnut fiddle]
Failed to resolve version for chestnut:lein-template:jar:RELEASE: Could not find metadata chestnut:lein-template/maven-metadata.xml in local (/home/xlevus/.m2/repository)
This could be due to a typo in :dependencies or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.
Could not find template chestnut on the classpath.
ok then :)
@xlevus: Yes, I would write any new files using cljc files with reader conditionals. @danielcompton has a really good tutorial on them here: http://danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example