All persistent data structures are immutable, but not all immutable data
structures are persistent.
For example, imagine an immutable array that, unlike Clojure's vector data
structure, implemented "conj" by copying the entire array into a new one
with the original elements plus the new one. Immu
at I can't trace to memory resource
> contention, etc.
>
> I have similar issues sometimes when I launch parallel threads via sends to
> agents. Will this behave similarly to pmap? If so, is there a
> straightforward way to get the same kind of benefit as medusa-pmap in an
> agent c
To be very precise, (conj v new-elem) is O(log n) in time and space, but it
is "constant-ish" because the base of the logarithm is something like 32,
rather than something like 2, so the constant factor multiplying the log n
is typically pretty small.
Also, there is no difference in Clojure's beha
pmap will limit the maximum number of simultaneous threads. So will the
medusa library's medusa-pmap.
The difference is that if one job early in the list takes, e.g., 100 times
longer than the next 20, and you have 4 cpus available, pmap will start the
first (4+2)=6 in parallel threads, let jobs
pmap already uses future/deref in its implementation. When it does so, it
limits the *maximum* parallelism possible to be at most (number-of-cpus + 2)
threads running at a time, and depending upon the time taken by each of the
objects you are mapping over, it can be less then that.
I don't know i
There is definitely a particular width that it was made for the layout to
work well. I'm not enough of an HTML guru to know whether there is a good
way to make it automatically adjust to display at other screen widths, but
if you or someone else is, you can download the Clojure program that
genera
g. Does someone have a pointer to the rationale?
>
> Cheers,
>
> - Chas
>
> On Sep 18, 11:20 am, Andy Fingerhut wrote:
> > One more detail. The Scala program, and I think all of the fastest
> programs
> > for that problem, use the GNU GMP library for big integer a
uch a submission would be
acceptable.
Andy
On Sun, Sep 18, 2011 at 8:16 AM, Andy Fingerhut wrote:
> Everyone is welcome to make faster versions if they can figure out how.
>
> I suspect that most of the time is spent in BigInteger math in that
> particular program. If so, type annotation wo
Everyone is welcome to make faster versions if they can figure out how.
I suspect that most of the time is spent in BigInteger math in that
particular program. If so, type annotation won't speed that up.
Glad to be proved wrong, though!
Andy
On Sun, Sep 18, 2011 at 12:02 AM, Vagif Verdi wrote
To my knowledge, there are no built-in data structures that are mutable and
that use the same access functions.
There are built-in data structures called transients that are mutable, and
use almost the same hash functions. Read the docs on transient,
persistent!, conj!, etc. Transient data struc
I didn't see Penumbra or Calx mentioned in this thread yet (sorry if they
were and I missed it).
See this thread:
http://groups.google.com/group/clojure/browse_thread/thread/5703f75f2ccf0bec
Penumbra:
https://github.com/ztellman/penumbra
Calx:
https://github.com/ztellman/calx
Andy
On Fri,
I've created a modified version of the cheatsheet, including PDF files with
clickable links, here:
http://homepage.mac.com/jafingerhut/files/cheatsheet-2.0.html
There is a list of changes made, including the one you mention, Stuart, and
some others regarding transients that had been suggested a w
Isaac, all of the programs that fail with Clojure 1.3 now can be made to
compile and run on both 1.2 and 1.3 by changing a relatively small part of
the programs.
I have them on my computer (and probably checked into the github repo
clojure-benchmarks), but haven't put them on the benchmarks game w
I suspect that (rand), which calls java.lang.Math.random(), is a
synchronized method, meaning that if you try to call it from many parallel
threads, even those on physically separate cores, will execute one at a
time. Things could even take more time if you try to execute them in
parallel than seq
6m). Unlike your
programs, this one is not lazy on the input sequence -- it always processes the
whole thing. I don't hold it up as a model of Clojure code for readability or
maintainability, but for squeezing run time out of the inner loop.
Andy Fingerhut
(ns movavg
(:gen-class))
(se
Caveat: The following fact may already be well known to those discussing this
issue, and I may not be clear on the goal of this effort.
If the goal is to have functions compare as equal whenever they are equivalent
in some sense, then that is an undecidable problem, even if the two functions
ar
There is a significant time required to run "Hello, world" on a JVM,
significantly more so than the corresponding C program on the same machine, due
to all kinds of initialization to start up the JVM, even if the compile time is
negligible.
There is additional initialization time when you start
I'm signed up for future notices.
Think of it like a book about Clojure and some of its libraries on a web site,
except it is more index than prose. People seem to give books a chance quite
often, if they are informative enough. (Chas, feel free to use an analogy like
that on the web site. T
, 28 Mar 2011 18:10:31 -0700
> Andy Fingerhut wrote:
>> Changing subject line for this one.
>
> I almost did that myself.
>
>> On Mar 28, 2011, at 5:38 PM, Mike Meyer wrote:
>>>
>>> Consider this a features request for cake/leiningen:
>>> 1) A ta
Changing subject line for this one.
On Mar 28, 2011, at 5:38 PM, Mike Meyer wrote:
>
> Consider this a features request for cake/leiningen:
> 1) A task to search clojars.
> 2) A task take a name from #1 and add the appropriate data to project.clj.
> 3) Extend the "deps" task to install libraries
There was a recent discussion on clojure-dev about this question. I don't
understand the details myself, so I'll point you at the thread. The relevant
part starts about 2/3 of the way through this 51-message thread, around March
19, between Sean Corfield and Stuart Sierra (sorry, I don't know
I'm not an expert on this, but I believe that whenever you have generics in
Java, they have no effect on the bytecode, e.g. a HashMap has
the same type in the bytecode as any other HashMap. The part
is only used in some checks made by the Java compiler when compiling Java
source code, and in
I've been using a project.clj file like this in Leiningen to get 1.3 alpha1
through alpha6:
(defproject clj-1.3.0-alpha5 "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.3.0-alpha5"]])
Leiningen uses Maven under the hood, so if you have any Maven pom.xml fi
ts the
> messurments on the shootout.
>
> On Mar 15, 7:06 pm, Andy Fingerhut wrote:
>> Well, if the default max heap of your JVM is not enough to run the program
>> successfully to completion, then I don't think that you will be very happy
>> in getting the program to
ze in the standart case?
>
>
> On Mar 15, 5:19 am, Andy Fingerhut wrote:
>> On a MacBook Pro with 2.4 GHz Intel Core 2 Duo and 3 GB of RAM (although the
>> program only used about half a gig at most), that program finished in about
>> 33 seconds, using 38.5 sec of user
On a MacBook Pro with 2.4 GHz Intel Core 2 Duo and 3 GB of RAM (although the
program only used about half a gig at most), that program finished in about 33
seconds, using 38.5 sec of user + system CPU time. The average CPU utilization
was 126% (all of one CPU core, and 26% of another, on averag
Oh, one other thing, although it might actually be slower than 1.3's primitive
goodness:
If you want to keep the unchecked operations, and make them on 32-bit ints,
I've been using macros like this so that the same file can compile with both
1.2 and 1.3:
(defmacro my-unchecked-inc-int [& args]
I'm no expert on the new way of doing things in 1.3, but I found that if you
remove the ^long type hint on the return value from item-check, it compiles
without errors or warnings.
Andy
On Mar 13, 2011, at 10:36 AM, Nick Zbinden wrote:
> Hallo all,
>
> I have been looking at the binary-trees
i.e. is there a way in a Clojure source file to generate a class like
the one named GmpUtil in this Java program?
http://shootout.alioth.debian.org/u32/program.php?test=pidigits&lang=java&id=4
(class GmpUtil is near the end of the program -- here is a copy)
class GmpUtil {
static {
S
On Feb 13, 2011, at 10:11 AM, Mark Fredrickson wrote:
Hello friends,
I am writing a program to generate directions for humans to read. The
directions are composed of a collection with a series of steps, some
of which may be duplicated:
[:a :b :c :a :b :c]
I would like to compress them by ind
On Feb 12, 2011, at 6:53 AM, Aaron Cohen wrote:
On Sat, Feb 12, 2011 at 8:28 AM, timc wrote:
Further investigation reveals that
(def b (byte i))
is doing something equivalent to this internally:
byte b = Byte.parseByte(String.format("%d",i));
which does indeed throw a NumberFormatExceptio
ering that question
- "Both the C++ program and the Clojure program use a much more
efficient algorithm than the other programs. That may violate the
rules."
But what about that fasta Java 6 -server #3 program?
On Feb 10, 1:02 pm, Andy Fingerhut wrote:
It would be easier for submitters
What can you not do with the signed byte type and arrays of bytes
(Java byte[] and Clojure (byte-array ...))?
I believe these are frequently used for Java I/O, and can be used for
Clojure I/O as well.
Andy
On Feb 11, 2011, at 9:22 AM, timc wrote:
How on earth is one supposed to do commun
On Feb 10, 2011, at 4:49 PM, Andy Fingerhut wrote:
I've published that program at the link below. It contains comments
marking two lines in the function gen-random-fast where the Hotspot
JVM profiler tells me that the CPU is spending lots of time in
java.lang.Integer.valueOf (Cl
On Feb 10, 2011, at 6:37 PM, Ken Wesson wrote:
On Thu, Feb 10, 2011 at 7:49 PM, Andy Fingerhut
wrote:
I've published that program at the link below. It contains
comments marking
two lines in the function gen-random-fast where the Hotspot JVM
profiler
tells me that the CPU is spe
On Feb 10, 2011, at 1:41 PM, Bill James wrote:
On Feb 10, 2:47 pm, Isaac Gouy wrote:
On Feb 10, 1:17 am, Bill James wrote:
http://shootout.alioth.debian.org/u32/benchmark.php?
test=fasta〈=all
The fastest program shown here is in Java and runs in 1.72 seconds.
However, at the bottom of t
It would be easier for submitters to answer that question if it was
more obvious *why* a program is in the "interesting alternative"
program section. Even a brief note in comments at the top of such
programs explaining the reason for their alternative status would be
enlightening.
Thanks
On Feb 7, 2011, at 12:37 PM, Bill James wrote:
Since this program eliminates so much of the work, it's disappointing
that
there wasn't more of a speedup.
Can you (or anyone) speed it up even further?
I spent some time doing some small tweaks.
On one machine I have, your version runs in as l
s!
Andy
On Feb 6, 2011, at 5:01 PM, Bill James wrote:
On Feb 3, 12:22 am, Andy Fingerhut wrote:
I've done a pass through most of the Clojure programs on the shootout
web site recently, making some of them faster, and choosing -Xmx
command line arguments when running them to keep the memo
I've done a pass through most of the Clojure programs on the shootout
web site recently, making some of them faster, and choosing -Xmx
command line arguments when running them to keep the memory usage down
to a reasonable level -- not always the smallest heap size that works,
mind you -- ju
I wanted to compare some similar code for 1.2 versus 1.3 alpha4, and
I'm having trouble finding something I want that compiles with 1.3
alpha4.
Here is one try, stored in a file knucleotide.clj. It is not the
complete program, but it does exhibit the error I'm having trouble
with, and is
ed to the previous fastest
Clojure program I had for this problem. It should be up on the
Shootout web site in a day or two.
Thanks,
Andy
On Jan 28, 2011, at 4:20 PM, Andy Fingerhut wrote:
That was what I was missing. Thanks, Aaron.
Regarding using :gen-class in the ns macro, and also (g
anks,
Andy
On Jan 28, 2011, at 4:07 PM, Aaron Cohen wrote:
On Fri, Jan 28, 2011 at 6:13 PM, Andy Fingerhut
wrote:
(ns andy.try
(:gen-class))
(gen-class
:name andy.try.ReversibleByteArray
:prefix rba-)
I find it confusing that you have both of ":gen-class in the ns macro"
(I guess
for class andy.try.ReversibleByteArray
Andy
On Jan 28, 2011, at 3:04 PM, Andy Fingerhut wrote:
Thanks for the suggestion. I'm not sure I implemented it
correctly. Still no joy. Here is exactly what I tried:
% ls -R
andy
./andy:
try.clj
% cat andy/try.clj
(ns andy.try
(:gen-class))
(
ng.RestFn.applyTo(RestFn.java:138)
at andy.try.main(Unknown Source)
Andy
On Jan 28, 2011, at 2:46 PM, Ken Wesson wrote:
On Fri, Jan 28, 2011 at 5:20 PM, Andy Fingerhut
wrote:
--
(ns try
(:gen-class))
Try using a two
Sigh. Sorry, I'm not an experienced Java developer, and I'm sure
there are basic things relating Java packages, directories in
classpaths, and Clojure hierarchical namespaces that I just don't have
in my head yet. Right now I feel like I'm banging my head against a
wall and not getting an
In my original message describing pmap's behavior, there was a little
"gotcha" near the end:
"Note: Sometimes working at odds with pmap's "Don't work too far
ahead" approach is if the input sequence to pmap is chunked. When a
chunk is reached, all elements in that chunk have threads start
No, you cannot rely on pmap to do that.
pmap is lazy in the sequence it produces, so it tries not to work
farther ahead of the consumer of its "output sequence" than the amount
of parallelism it uses, which is the number of available processors
plus 2.
Suppose you have 4 available process
David:
Here is a link to the exact source code of the program I was running
for my recently published results in the sister thread titled "Problem
with garbage collection? Was Euler 14".
https://github.com/jafingerhut/clojure-benchmarks/blob/master/collatz/collatz.clj-1.clj
Is this code al
I would recommend that anyone who publishes their results running this
code specify what OS, JVM, and version of Clojure they are using. I
don't know yet whether OS and JVM version make any difference, but at
least on Ubuntu 10.4 Linux, the 64-bit version, and Sun/Oracle's
Hotspot 1.6.0_22
Here is a list of steps that should get you to a working Emacs+Clojure
SLIME on Mac OS X. I've also used it on Linux (without the MacPorts
command, instead using its package manager to install a working GNU
emacs).
If you don't have many MacPorts programs installed, or don't mind
reinsta
Sunil, is there any particular reason why you are looking for when
results of operations have identical? return true, rather than merely
= return true?
If it is for some reduction in allocating new memory when it is not
necessary, then I can understand your motivation, although it really
The amount of work in each element of the pmap is so small that the overhead
per element is dominating the CPU usage, e.g. overhead like constructing a
future for each element of the collection you are mapping over. Try a test
case where the computation being done in the function you supply to
generate somewhat less garbage
needing collection while you are building it, too.
[1] see http://clojure.org/transients
Andy
On Nov 3, 2010, at 6:31 PM, Andy Fingerhut wrote:
In addition to this, note that every java.lang.String, i.e. every
"A" in your example data struct
In addition to this, note that every java.lang.String, i.e. every "A"
in your example data structures below, requires storage for one
java.lang.Object (8 bytes on 32-bit JVMs, 16 bytes on 64-bit JVMs)
plus an array of java char's, where I think that is equal to the size
of a java.lang.Objec
I use MacPorts:
http://www.macports.org/
and then this command to install emacs from source code:
sudo port install em...@+gtk+x11
It does require running X11 (in Applications/Utilities) in order to
get color highlighting, etc., but others have mentioned before on this
list that SLIME and
user> (def a ["a" "a" "a" "b" "c" "c" "a"])
#'user/a
user> (pack a)
(("a" "a" "a") ("b") ("c" "c") ("a"))
Now calling (map f (pack a)) will cause the function you give as the
first argument of map to be called with each of the elements of the
collection (pack a) in turn. Those elements are,
I updated my Clojure shootout web site benchmark programs so they
worked on 1.3 alpha1, and ran them on 4 JVMs on 3 different OSs. The
timing results are collected on the following ugly but quick-to-create-
from-an-Excel-spreadsheet web page:
http://homepage.mac.com/jafingerhut/files/clojur
I don't know if it makes a difference, but I was doing AOT compilation
on a file nbody.clj containing the program in my message.
I replied to my own message with a workaround that it seems to be
related to the variable 'nbody' having the same name as the one in the
'ns' declaration.
Thank
lection warning here
dy (- y (.y nbo)) ; second here
dz (- z (.z nbo)) ; third here
If I then change the ns declaration at the top to "ns nbo", the
reflection warnings come back again.
Easy to avoid the problem, once you know.
Andy
On Sep 27, 2010, at 1:58
The following program compiles and runs perfectly fine in both 1.2 and
1.3 alpha1. It has no reflection warnings in 1.2, but it does in 1.3
alpha1. I have tried several variations, but I haven't yet been able
to figure out how to write type declarations that avoid reflection in
1.3 alpha1
I believe
http://clojars.org
is intended to fill the purpose you describe, except using Leiningen
or Maven instead of apt-get. I do not know yet how good its inter-
library dependency info is, but there is some there.
Andy
On Sep 27, 2010, at 9:12 AM, Tim Daly wrote:
There is a movement
to compact things down into the smallest space possible, no
matter what? I am aware of several pages of documentation on
HotSpot's GC options, and I've been reading some of them, but it is a
lot to wade through.
Thanks,
Andy
On Sep 26, 2010, at 4:30 PM, Andy Fingerhut wrote:
While up
While updating the benchmark programs I wrote for the shootout web
site for 1.3 alpha1, I came across a program that required much more
memory to complete in 1.3 than it did in 1.2. I boiled it down to a
simpler program that has similar properties.
This happens for me on a Mac OS X system, and an Ubuntu Linux system,
and with Clojure 1.2.0 and 1.3.0-alpha1. Here are steps for me to
reproduce with Clojure 1.2.0.
Install Leiningen.
% lein new clj-1.2.0
% cd clj-1.2.0
[ Optionally edit project.clj to remove dependency on contrib, leavin
Yep, I got the same thing yesterday.
See my message in the thread "Re: building new contrib against a
specific clojure jar" from last night for a patch that corrects this,
and causes 1.3.0-master-SNAPSHOT version of clojure to be used for
compilation everywhere in contrib instead of 1.2.0 v
ein repl' will have to do for now.
Andy
On Sep 22, 2010, at 9:10 PM, Andy Fingerhut wrote:
OK, it appears one more line of change allows clojure-contrib latest
as of today to build with clojure 1.3.0-master-SNAPSHOT. See inline
below for slightly modified instructions that worked f
OK, it appears one more line of change allows clojure-contrib latest
as of today to build with clojure 1.3.0-master-SNAPSHOT. See inline
below for slightly modified instructions that worked for me on both OS
X and Ubuntu Linux.
On Sep 22, 2010, at 6:16 PM, Andy Fingerhut wrote:
So I
So I'm trying to start from a Mac OS X 10.5.8 system with java and mvn
installed, but not Clojure, and with no Maven repo (i.e. ~/.m2 does
not exist yet), and trying to build the latest Clojure and contrib
from the git repos using something as close to the recommended
instructions that come
Oskar:
I once did installations like this of SLIME for interaction with SBCL
on my computers, and I did it once for Clojure about a year ago, but
when I tried to upgrade that SLIME/Clojure interaction software
recently, I had trouble trying to do so in a similar way that I had
done it in
Greetings:
I am trying to use bit-shift-left and/or bit-shift-right with the
first arg being a number that is larger than 32 bits, so it cannot be
an int, and the second arg must be a variable, not a constant, e.g.
(set! *warn-on-reflection* true)
(defn my-left-shift [a-is-bigger-than-int b-is-r
On Jan 27, 8:21 pm, Scott wrote:
> wondering if I can please get some advice on how to improve the
> performance of this piece of code
>
> (defn select-n-tournament
> [popu fit-fn n]
> (let [k 7]
> (take n (repeatedly #(first (sort-by fit-fn > (take k (shuffle
> popu))
> )
> )
I don
I don't have broad experience with various Lisps, but I have also done
some programming in Scheme and Common Lisp.
You can program in a functional style in both, or in an imperative
style in both. In Scheme, functional style is a bit more idiomatic,
so you will find more examples of functional st
Is there any reason to keep aset-* functions around in Clojure? I
guess backwards compatibility?
It definitely seems worth flagging them when *warn-on-reflection* is
true, in a similar way to other warnings it enables. Perhaps that
might be overloading the meaning of *warn-on-reflection*, but I
During the Clojure for Lispers talk in Boston (see clojure.blip.tv if
you want to watch it), someone asked Rich about enforcing the no-side-
effect rule in transactions. Rich answered that he couldn't do that,
because "I'm a dynamic language." (audience got a chuckle out of that
way of putting i
On Aug 19, 2:38 am, Christophe Grand wrote:
> Imagine a persistent data structure S1 with a root node A and two child
> nodes B and C.
> On this data structure you call transient, make some updates and call
> persistent! which yields an updated persistent data structure S2 with the
> root node
On Aug 17, 3:51 am, Christophe Grand wrote:
> On Sat, Aug 15, 2009 at 4:23 PM, Andy Fingerhut <
>
> andy_finger...@alum.wustl.edu> wrote:
> > Not to say this ought to be done, but would it be possible to have no
> > 'edit' field *at all* for persis
On Aug 15, 9:45 am, Nicolas Oury wrote:
> Thank you very much for your answers.
> The syntax was difficult to guess.
> Is there a general rule for forming the internal name of types?
>
> It seems after a few tests that is is slightly slower (15-20%) than
> making a final static function:
>
> st
On Aug 15, 5:44 am, Christophe Grand wrote:
> I wouldn't call this a memory leak: vectors have a bigger memory overhead
> than before (additional PersistentVector$Node and AtomicReference).
>
> On Sat, Aug 15, 2009 at 2:13 AM, Andy Fingerhut <
>
> andy_finger...@alum.wu
If there is a better place to report things like this, let me know.
I've done some looking at how much memory various kinds of Clojure
data structures use, and come across some behavior that I think might
be a memory leak, in the sense that perhaps a reference to a
java.util.concurrent.atomic.Ato
This is the same Clojure for Lispers talk with audio, and video of
slides, available on clojure.blip.tv, among others, from the September
2008 Boston Lisp meeting.
It has been uploaded to the files section of the group with this name:
clojure-for-lispers-transcript.txt
I've added a very few ref
I know that if you have a dosync call in some function executed by a
thread, and then that function calls other functions (which might have
their own dosyncs, which get bundled together with the original
transaction), then everything is fine. It seems common that all of
that work would be done se
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
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
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
On Aug 11, 2:36 pm, Aaron Cohen wrote:
> At that point is it possible you're just paying the price of
> PersistentVector for the "bodies" vector? Does it improve much if you
> change bodies to an array?
About 7% faster changing bodies to a Java array of java.lang.Object's,
each of which happens
On Aug 11, 4:27 pm, Stuart Halloway wrote:
> If I am reading the README correctly, clj-8 is 10.8 times slower than
> Java, but clj-9 does better: 3.2 times slower.
>
> Stu
You are reading that correctly. My clj-9 wasn't created until after
fft1976's message starting this thread.
Andy
--~--~
In case it matters to anyone, my intent in creating these Clojure
programs to compare their speed to others isn't to try to rip into
Clojure, or start arguments. It is for me to get my feet wet with
Clojure, and perhaps produce some examples that others can learn from
on what performs well in Clo
On Aug 10, 11:15 am, Christophe Grand wrote:
> Hi Andy,
>
> On Thu, Aug 6, 2009 at 7:40 PM, Andy Fingerhut <
>
>
>
> andy_finger...@alum.wustl.edu> wrote:
> > Thank you, Christophe! I've been wanting to try those out.
>
> > I made changes to 3 l
On Aug 10, 11:50 pm, Christophe Grand wrote:
> Hi Andy,
>
> On Tue, Aug 11, 2009 at 8:15 AM, Andy Fingerhut <
>
> andy_finger...@alum.wustl.edu> wrote:
> > I've tried an approach like you suggest, using mutable Java arrays of
> > doubles, macros using aget
On Aug 10, 11:33 pm, Mark Engelberg wrote:
> On Mon, Aug 10, 2009 at 11:15 PM, Andy
>
> Fingerhut wrote:
> > I suspect I'm doing something wrong in my mutable Java array
> > implementation, but I don't see what it could be.
>
> There still seems to be a lot
On Aug 10, 5:57 pm, Mark Engelberg wrote:
> Andy,
>
> My understanding is that any double that gets stored in a vector or
> map is boxed, and therefore, the vast majority of your double
> conversions aren't really doing anything, because when you pull them
> out of the vector or map, they'll just
OK, I've got a new Clojure program for the n-body benchmark, and it is
significantly faster than my previous one -- down from 138 x Java run
time, to 37 x Java run time. Still room for improvement somewhere
there, I'm sure, including perhaps using Java arrays instead of
Clojure vectors.
http://g
On Aug 10, 2:19 pm, Jonathan Smith wrote:
> 1.) use something mutable
> 2.) unroll all the loops (mapping is a loop)
> 3.) try not to coerce between seq/vec/hash-map too much.
>
> in real world, stuff like the shootout is pretty useless, as generally
> you'd reach for a better algorithm rather th
On Aug 10, 11:35 am, fft1976 wrote:
> On Aug 10, 4:46 am, Jarkko Oranen wrote:
>
> > I'm not going to start optimising,
>
> Somebody'd better!
>
> You always hear this dogma that one should write "elegant" code first
> and optimize later, and when you do that, a few little changes can
> make Clo
On Aug 8, 2:16 pm, John Harrop wrote:
> On Sat, Aug 8, 2009 at 5:23 AM, Mark Engelberg
> wrote:
>
>
>
> > On Fri, Aug 7, 2009 at 5:14 PM, John Harrop wrote:
> > > (if (and (not (= 0 i)) (< (+ zr2 zi2 limit-square)))
>
> > I believe that (zero? i) is faster than (= 0 i).
>
> On primitive ints
Johann, if you are still following this thread, could you try running
this Clojure program on your 8 core machine?
http://github.com/jafingerhut/clojure-benchmarks/blob/3e45bd8f6c3eba47f982a0f6083493a9f076d0e9/misc/pmap-testing.clj
These first set of parameters below will do 8 jobs sequentially,
On Aug 7, 5:14 pm, John Harrop wrote:
> Your core loop seems to be:
> (loop [zr (double 0.0)
> zi (double 0.0)
> zr2 (double 0.0)
> zi2 (double 0.0)
> iterations-remaining iterations-remaining]
> (if (and (not (neg? iterations-remaining))
> (<
On Aug 7, 6:17 pm, Sean Devlin wrote:
> Ok, I need some help. I'm writing some tests for c.c.seq-utils, and I
> ran into a problem defining a test for both shuffle and rand-elt.
>
> Does anyone here have any experience writing tests for random
> functions? Am I going to need to use serious stat
On Aug 6, 6:49 pm, John Harrop wrote:
> On Thu, Aug 6, 2009 at 6:57 PM, Andy Fingerhut <
>
> andy_finger...@alum.wustl.edu> wrote:
> > You are correct. I've updated that file:
>
> >http://github.com/jafingerhut/clojure-benchmarks/blob/bb9755bdeeccae8...
>
801 - 900 of 912 matches
Mail list logo