On 16 November 2016 at 03:39, Didier wrote:
>
> Currently, this takes about 30s in Clojure, while it only takes around 3s
> for OCaml, Rust and F#.
>
> From what I see, the differences between my code and theirs are:
>
>- Lack of a Point struct, I'm just using a vector.
>- They use a mutab
I'll bet the atom accesses dominate the computation. They are a part of
Clojures software transactional memory (STM) and have a cost.
Something like this (untested) should be faster:
(->> (iterate neighbors #{p}) (drop 1999) first)
neighbors could be:
(into #{} (for [[id jd] [[-1 0] [+1 0] [0
On Wednesday, November 16, 2016 at 8:10:27 AM UTC-6, Jason Felice wrote:
>
> I'll bet the atom accesses dominate the computation. They are a part of
> Clojures software transactional memory (STM) and have a cost.
>
Atoms don't use the STM and if used in a single-threaded context like this,
th
Maybe you don't need to instrument *all* functions in development?
Alternatively, you could instrument and provide simpler replacement specs
to improve speed. For example, an fspec arg could be replaced with ifn?.
On Tuesday, November 15, 2016 at 10:29:34 PM UTC-6, Gal Dolber wrote:
>
> I'm ha
In general, any benchmark code using math should be aware of boxing (old
post here: http://insideclojure.org/2014/12/15/warn-on-boxed/).
I would recommend doing the work to leverage primitive longs and unchecked
math. Generally this makes numeric code like this about 2 orders of
magnitude faste
On Tuesday, November 15, 2016 at 10:11:34 PM UTC-6, Eunmin Kim wrote:
>
> Hi! I had a question while reading Functional Programming in Scala book.
>
> The following code is Exercise 2:
>
> // Exercise 2: Implement a polymorphic function to check whether
> // an `Array[A]` is sorted
>
> def isSort
Thanks for the reply. :)
On Wednesday, November 16, 2016 at 11:44:50 PM UTC+9, Alex Miller wrote:
>
>
>
> On Tuesday, November 15, 2016 at 10:11:34 PM UTC-6, Eunmin Kim wrote:
>>
>> Hi! I had a question while reading Functional Programming in Scala book.
>>
>> The following code is Exercise 2:
>>
Below is the fastest version I tested, using ideas from the various responses
in this thread. It runs in ~4s on my machine, compared with ~27s for the
original version.
The biggest win by far was from James Reeves' suggestion of switching to Java's
mutable HashSet. I'm not sure why; I'd thought
Congrats!
On Monday, November 14, 2016 at 9:09:01 PM UTC-6, Nicolas Modrzyk wrote:
>
> Hi Clojure people,
>
> So after one year and 23 days, (that would be 388 days) the IT book I was
> working on with Makoto (merci!) finally got published!
>
> It has been a long battle with many late nights to g
Thank you, Alex.
Both for the feedback about what I'm doing wrong and for a fix that looks
simple and obvious.
Regards,
James
On Sunday, November 13, 2016 at 9:57:55 AM UTC-6, James Gatannah wrote:
>
> One of my system boundary data structures is particularly ugly. It
> involves things like J
10 matches
Mail list logo