Abhinav Gogna writes:
> (defn run-in-parallel
> "run-in-parallel runs 500 different threads.
> you can give each thread number of files you want to generate
> Eg: run-in-parallel 100 will generate 500*100 = 5 files"
> [y]
> (dotimes [_ 500]
> (future
> (.start (Thread. (run-me y
Thanks Guys! Hitesh you were right about rand-nth. I switched to rand-int,
which is much faster.
I found a way. It may not be the most optimal way but I can get about 5
files in 2-3 secs.
I am using cheshire to parse json and pjson to write it back.
(ns jsonworker.core
(:require [chesh
This looks like it's doing too much work to simply generate a random
integer. Are you sure you want to build a lazy list of 999,000 integers
and randomly select into it for every invocation? The garbage collector
will be working overtime.
(defn update-individual [json-string]
(assoc-in json
I think you should move the future inside do times, since then you’ll get a
future for each write.
Also, I don’t think you need to put your json-template in an atom:
(ns jsonworker.foo
(:require [cheshire.core :refer :all ]))
(defn parse-json
[file-loc]
(parse-stream (clojure.java.io/read
Hello,
I am trying to generate lot of files using futures but it hasn't sped up
the process that hoped for. Here is the code I am using. Can someone point
what I am doing wrong?
(ns jsonworker.core
(:require [cheshire.core :refer :all ]))
(defn parse-json
[file-loc]
(parse-stream (cloju