John, this will speed up to the same as the others if you let the 0. IIRC
from looking at the bytecode before, the 0 is an Integer not an int.
user> (time
(let [m (int 1) b (double 4.0) x0 (double -0.2) y0 (double
0.1) t (double 2.0) i0 (int 0)]
(loop [x (double 0.0) y
Thanks for sharing this. What I miss a bit is the ability to set the
*compile-path* to something other than "classes". And might it be a
good idea to be able to name .clj files instead of namespaces as an
option? Then one could use regular ant filesets constucted
automatically from expressions, in
Dear Clojurians,
I have to parse some XML files with c.x/parse. However the files
contain UTF-8 characters, which end up as '?' after being parsed by
c.x/parse. Is there some possibility to correctly parse the files? I
suspect there is some settings somewhere in my Clojure/JVM/System
which makes
Hello all,
Just wanted to add a small remark. If you look at the shootout, most
languages considered now to be very efficient has been once said to be
very very slow and not usable.
In the eighties, functional languages were doomed to be slow and
unusable for anything. And Ocaml/MLton and the l
On Wed, Aug 12, 2009 at 7:00 AM, John Harrop wrote:
> A very straightforward version, and 875.36796ms/1 = 8.7536796ns.
> This is on a 2.5GHz machine, so that's only about 22 native instructions per
> iteration. The theoretical minimum is over 1/2 of that:
> Four fmuls
> Three fadds and an
I've read what he has to say about backquotes, but he really doesn't
give as clear and concise a method for figuring out what's going on as
Graham does.
To evaluate a backquoted expression, you remove the outermost
backquote and each matching ~, and replace the expression following
each matching
Hi,
On Tue, Aug 11, 2009 at 10:22 PM, Meikel Brandmeyer wrote:
Yes. run uses a one-shot connection. When you leave the body
> the connection will be closed. Hence the second form cannot
> work, because the connection is already closed. We are currently
> working on improving the connection handl
Hi,
On Aug 12, 11:43 am, Maximilian Karasz
wrote:
> May i ask what kinds of improvements are planned for connection handling?
> Do you want to move it into the direction of persistent connections /
> connection pools?
We are currently looking into ways the user might specify connections
himsel
Hello,
I tried to inline everything in the main loop (the updaters loops) and
obtained on my machine a 15% speed-up.
One of the possible slowdown may come from having arrays and not object.
Maybe, each access need to perform a size check on the array. Which is
not very costly but not negligible
On this topic, how do primitives work? I heard something about
"function boundaries." Which I interpret to mean that when a function
returns a primitive, Clojure boxes it in some Java object. And type
declarations can't stop this boxing from happening.
Is this a correct understanding? (I doubt it
Hi,
On Aug 12, 11:54 am, Tayssir John Gabbour
wrote:
> On this topic, how do primitives work? I heard something about
> "function boundaries." Which I interpret to mean that when a function
> returns a primitive, Clojure boxes it in some Java object. And type
> declarations can't stop this boxi
Ah, thanks Meikel for the explanation.
Ok, so a function like + avoids this boxing, because it's really
replaced by a call to clojure.lang.Numbers.add()... And looking at the
sourcecode, this is accomplished through :inline. This :inline
declaration allows + to avoid IFn's rules, because + disapp
Hi,
On Aug 12, 12:44 pm, Tayssir John Gabbour
wrote:
> Ok, so a function like + avoids this boxing, because it's really
> replaced by a call to clojure.lang.Numbers.add()... And looking at the
> sourcecode, this is accomplished through :inline. This :inline
> declaration allows + to avoid IFn's
using http-agent threw
(#)
notice the spelling error in 'setFixedLenghtSttreamingMode' (Lenght)
this from the HEAD of trunk as of Aug 11 about 11pm PDT
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" gr
On Wed, Aug 12, 2009 at 12:00 PM, John Harrop wrote:
> Note: the expressions should be run three or four times. The first two or
> three timings will be longer than the later ones. (JIT?) Run until the times
> are consistent and at least three repetitions have been run in rapid
> succession.
JIT
This is a troll question. I have seen similar questions posted on other
forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran,
bigloo(?) etc by the same poster.
Try this link: http://www.google.co.in/search?q=fft1976%40gmail.com
On Wed, Aug 12, 2009 at 2:00 PM, Nicolas Oury wrot
Primitives can only be stored inside a local (i.e., a let binding).
Primitives are auto-boxed everywhere else. A type hint implies an
object (not a primitive). See this post for more info.
http://groups.google.com/group/clojure/msg/1e0d52ae931c730d
Travis
On Aug 12, 5:54 am, Tayssir John Gabbou
http://blog.objectmentor.com/articles/2009/08/11/jarvis-march-in-clojure
--~--~-~--~~~---~--~~
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 fr
I have to parse some XML files with c.x/parse. However the files
contain UTF-8 characters, which end up as '?' after being parsed by
c.x/parse. Is there some possibility to correctly parse the files? I
suspect there is some settings somewhere in my Clojure/JVM/System
which makes the whole thing fa
Hi Stephen,
On Aug 12, 3:57 pm, "Stephen C. Gilardi" wrote:
> > I have to parse some XML files with c.x/parse. However the files
> > contain UTF-8 characters, which end up as '?' after being parsed by
> > c.x/parse. Is there some possibility to correctly parse the files? I
> > suspect there is s
Hi Meikel,
On Wed, Aug 12, 2009 at 10:16, Meikel Brandmeyer wrote:
>
> Dear Clojurians,
>
> I have to parse some XML files with c.x/parse. However the files
> contain UTF-8 characters, which end up as '?' after being parsed by
> c.x/parse. Is there some possibility to correctly parse the files? I
On Wed, Aug 12, 2009 at 16:22, Meikel Brandmeyer wrote:
>
> Hi Stephen,
>
> On Aug 12, 3:57 pm, "Stephen C. Gilardi" wrote:
>> > I have to parse some XML files with c.x/parse. However the files
>> > contain UTF-8 characters, which end up as '?' after being parsed by
>> > c.x/parse. Is there some
Calculating probabilities with Clojure...
http://javajeff.blogspot.com/2009/07/grails-springsource-and-clojure.html
I welcome any clever solutions you might want to contribute in Clojure.
The problem is intentionally loosely defined (exactly 3? at least 3?
etc...). The goal isn't to have a clear
Hi,
On Aug 12, 4:30 pm, B Smith-Mannschott wrote:
> Please post code. Show us what you are trying to do, so we can help
> instead of just guessing.
I have a file which looks roughly like this:
In fact things are more complicated, but also happens
when I change the file to the above form. Un
On Wed, Aug 12, 2009 at 4:00 AM, C. Florian Ebeling <
florian.ebel...@gmail.com> wrote:
>
> Thanks for sharing this. What I miss a bit is the ability to set the
> *compile-path* to something other than "classes".
Thanks for your input! Yes, this was always planned, I just didn't have a
need for
On Mon, Aug 10, 2009 at 9:07 AM, Chas Emerick wrote:
>
> We have a couple of ant macros that do all of our clojure building for us
> (including auto-detecting namespaces within source directories, compiling
> only those clojure files that have changed since the last build, etc).
>
I've added sup
I'd like to add a :signature entry to the attr-map of defn, that
provides a haskell-style type signature to functions of the
single-arglist-body form. I find the the normal way of providing
hints to a function:
(defn [ #^Class1 var1 #^Class2 var2 #^Class3 var3] ... )
is way too noisy, and the v
This is an interesting path to take. I'm not at all familiar with
haskell, but a couple of thoughts anyway :-) :
- There's already a lot of moving parts to type hinting, so adding
this optional approach into defn seems like it'd lead to unintended
consequences. That said, there's absolute
> - There's already a lot of moving parts to type hinting, so adding
> this optional approach into defn seems like it'd lead to unintended
> consequences. That said, there's absolutely nothing wrong with an
> alternative def form (defh? as in 'define hinted fn') -- there's
> plenty of them throug
My apologies for the noise if this is well known in the Clojure
community, but I'll ask anyway.
One of the tweaks to my Clojure benchmarks that people have suggested
for improving performance, and that does help, is changing some
function definitions to macros. This is in effect inlining those
f
I didn't release it was valid to define names with colons in them.
Maybe that shouldn't be allowed. I'd like to be able to specify type
hints using UML-like syntax like the second example from Chas which
was
(defh foo [s:String unhinted-arg {a:int :a}] ...)
On Wed, Aug 12, 2009 at 1:02 PM, tsura
On Aug 12, 2009, at 2:02 PM, tsuraan wrote:
> I didn't put it in yet, but I was thinking of just having nil in the
> type vector for unhinted variables, so you could have
>
> (defn foo {:signature [ String String nil ]} [ a b c ] ...)
>
> and then c wouldn't be hinted. I hadn't thought of destru
On Aug 12, 2009, at 3:19 PM, Mark Volkmann wrote:
> I didn't release it was valid to define names with colons in them.
> Maybe that shouldn't be allowed. I'd like to be able to specify type
> hints using UML-like syntax like the second example from Chas which
> was
>
> (defh foo [s:String unhinte
> However, I get the feeling Clojure is not the problem.
> I noticed, I forgot the "UTF-8" on the *output*. beh..
> Now, Vim seems to be happy with the file.
I had a similar issue -- every Java component (e.g., Nailgun, which
VimClojure uses) needs to be started with the right character set.
h
> Is there some reason that the Java JIT is not doing this, with the
> original code using defn, as fast as it works when using defmacro?
The macro expands into bytecode within the same Java method, rather
than a method invocation. Some method blocks are too big to inline,
and perhaps the JIT
On Wed, Aug 12, 2009 at 3:59 PM, Richard Newman wrote:
>
>> Is there some reason that the Java JIT is not doing this, with the
>> original code using defn, as fast as it works when using defmacro?
>
> The macro expands into bytecode within the same Java method, rather
> than a method invocation. S
On Aug 12, 2009, at 3:59 PM, Richard Newman wrote:
>> Is there some reason that the Java JIT is not doing this, with the
>> original code using defn, as fast as it works when using defmacro?
>
> The macro expands into bytecode within the same Java method, rather
> than a method invocation. Some m
> I may be wrong, but doesn't a typical function invocation involve
> dereferencing the Var holding the object that implements "IFn" and
> calling invoke? It seems pretty intuitive to me that this would be
> difficult to inline by the JIT, there is a little bit of
> synchronization going on every
On Wed, Aug 12, 2009 at 4:24 PM, Richard Newman wrote:
>
>> I may be wrong, but doesn't a typical function invocation involve
>> dereferencing the Var holding the object that implements "IFn" and
>> calling invoke? It seems pretty intuitive to me that this would be
>> difficult to inline by the J
On Wed, Aug 12, 2009 at 3:03 PM, Andy
Fingerhut wrote:
>
> My apologies for the noise if this is well known in the Clojure
> community, but I'll ask anyway.
>
> One of the tweaks to my Clojure benchmarks that people have suggested
> for improving performance, and that does help, is changing some
>
I'm getting a very significant performance improvement by adding a
couple of JVM parameters (using jdk 1.6.0_14). They are:
-XX:+DoEscapeAnalysis
-XX:+UseBiasedLocking (I think the -server flag is required for those
two flags to do anything).
My runtime with n = 5,000,000 goes from ~7.5 seconds
On Aug 12, 2:25 am, Piyush Ranjan wrote:
> This is a troll question. I have seen similar questions posted on other
> forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran,
> bigloo(?) etc by the same poster.
>
> Try this link:http://www.google.co.in/search?q=fft1976%40gmail.com
On Wed, Aug 12, 2009 at 4:36 PM, fft1976 wrote:
> On Aug 12, 2:25 am, Piyush Ranjan wrote:
>> This is a troll question. I have seen similar questions posted on other
>> forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran,
>> bigloo(?) etc by the same poster.
>>
>> Try this link
On Wed, Aug 12, 2009 at 4:49 PM, Aaron Cohen wrote:
> I'm getting a very significant performance improvement by adding a
> couple of JVM parameters (using jdk 1.6.0_14). They are:
> -XX:+DoEscapeAnalysis
> -XX:+UseBiasedLocking (I think the -server flag is required for those
> two flags to do any
I'm new to clojure and I haven't touched the java platform for longer
than I can remember, and I'm having a little difficulty building
clojure-contrib.
I've made a software/clojure folder, and installed clojure 1.0
release. Under that folder I have made a clojure-contrib folder, and
got the lates
On Wed, Aug 12, 2009 at 5:25 AM, Piyush Ranjan wrote:
> This is a troll question. I have seen similar questions posted on other
> forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran,
> bigloo(?) etc by the same poster.
Hmm. fft1976 = WrexSoul?
--~--~-~--~~---
I've got a Mac and I've set it up to run jvm 1.6.0 instead of 1.5.0,
but I think I've done it with 1.5.0 before, too. You should be fine
there. Also I have ant version 1.7.1, but again, probably not a show
stopper difference.
I put my clojure-contrib in a directory "beside" my clojure directory
Oh, one more thing. If you have latest git clojure-contrib, I'd
recommend trying it with latest git clojure, too. Latest clojure-
contrib might not work with clojure 1.0.0.
Andy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Go
Hello Clojurians,
I've been experimenting with different coding styles, and I'm
interested in the group's opinion. Which set of code is easiest to
read?
A) Traditional definition
(defn str->date-map
[input-string]
((trans :month (comp dec :month))
(apply hash-map (interleave
There is a branch in clojure-contrib that is 1.0 compatible.
Sent from my iPhone
On Aug 12, 2009, at 7:35 PM, Andy Fingerhut wrote:
>
> Oh, one more thing. If you have latest git clojure-contrib, I'd
> recommend trying it with latest git clojure, too. Latest clojure-
> contrib might not work
The first one is still the most straightforward to me personally. I
feel there's no need to introduce function composition if there's no
immediate advantage. In this case, In Clojure's case, I'm guessing
function composition comes with some performance costs as well.
-Patrick
--~--~-~--~
It is my experience also, that inlining gives the greatest performance
gain for functions that expect primitive arguments.
As Chouser said, doing this eliminates the boxing/unboxing overhead.
Here's my take on this:
The Java method signatures created by Clojure will always be Objects
in order to
> Let me know what you all think!
Just thought it worth a mention that another approach to composed
partials is to use a 'pipe' macro (similar to ->). There was a very
good thread about various implementations which I can't find anymore :
( FWIW I like your use of & as comp but $ for partial doe
> I don't think Vars are thread-local. They're one of the shared
> mutable state primitives. They can be defacto thread local if only
> used by a single thread but you need a "sufficiently smart compiler"
> to notice that.
"Vars provide a mechanism to refer to a mutable storage location that
Fixed; thanks.
-SS
On Aug 12, 2:46 am, Anniepoo wrote:
> using http-agent threw
>
> (# matching method found: setFixedLenghtStreamingMode for class
> sun.net.www.protocol.http.HttpURLConnection>)
>
> notice the spelling error in 'setFixedLenghtSttreamingMode' (Lenght)
>
> this from the HEAD of
I would also vote A, seems much more straight forward.
On Wed, Aug 12, 2009 at 8:02 PM, Sean Devlin wrote:
>
> Hello Clojurians,
> I've been experimenting with different coding styles, and I'm
> interested in the group's opinion. Which set of code is easiest to
> read?
>
> A) Traditional definit
>
> There was a good thread on this list some weeks ago which mentioned
> another JVM flag:
> -XX:+PrintOptoAssembly
>
> The original thread:
>
> http://groups.google.com/group/clojure/browse_thread/thread/314952431ec064b7?fwc=1
>
>
There's some more information about it at [1]. It looks like you
> Let me know what you all think!
In this case, A. I've definitely been known to use composition, but
only when the definition is simple and expressive: e.g.,
(def clean-lines (comp non-empty trimmed-lines read-lines))
I find this much nicer than stacking parens:
(defn clean-lines [x]
(no
On Wed, Aug 12, 2009 at 12:03 PM, J. McConnell wrote:
> On Wed, Aug 12, 2009 at 4:00 AM, C. Florian Ebeling <
> florian.ebel...@gmail.com> wrote:
>
>>
>> Thanks for sharing this. What I miss a bit is the ability to set the
>> *compile-path* to something other than "classes".
>
>
> Thanks for your
On Thu, Aug 13, 2009 at 12:34 AM, Richard Newman wrote:
> This is the difference between 'conventional' and point-free style, by
> the way. Many people view point-free as being somehow more elegant,
> and I'm generally inclined to agree... apart from in cases like your
> example, where a ton of p
A point-free definition does not explicitly mention the values of the
space on which the function acts.
See http://www.haskell.org/haskellwiki/Pointfree.
> On Thu, Aug 13, 2009 at 12:34 AM, Richard Newman
> wrote:
> This is the difference between 'conventional' and point-free style, by
> th
Hi,
On Aug 13, 2:02 am, Sean Devlin wrote:
> A) Traditional definition
>
> (defn str->date-map
> [input-string]
> ((trans :month (comp dec :month))
> (apply hash-map (interleave
> [:month :day :year]
> (map parse-int (re-split input-string #"/")))
Hi,
On Aug 13, 6:34 am, Richard Newman wrote:
> I find this much nicer than stacking parens:
>
> (defn clean-lines [x]
> (non-empty
> (trimmed-lines
> (read-lines x)))
There is also the nice -> macro.
(defn clean-lines
[x]
(-> x read-lines trimmed-li
> Also this function generates two classes, while the
> other two variants generate 6.
Thank you for pointing this out! It -- surprisingly -- hadn't occurred
to me before that different approaches to writing the same code would
actually generate different sets of classes, possibly of very
d
64 matches
Mail list logo