Advertisement
Guest User

Untitled

a guest
May 16th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn -main []
  2.   (with-open [reader (new BufferedReader (new FileReader "src/simple/10000000_20_10_50"))]
  3.     (let [
  4.          
  5.           accounts        (generate-accounts 10)
  6.           agents          (map-agents (take 2 (repeat 0)))
  7.           expected_sum    (reduce + 0 (map (fn [acct] @(:balance acct))
  8.                                            (vals accounts)))]
  9.       ; load transactions in ram
  10.       (defn parse-and-process [trans]
  11.         (process-transaction
  12.           (parse-transaction trans 10)
  13.           expected_sum
  14.           accounts))                  
  15.           ; Suddenly drops my cpu usage to 1% after running 10 sec
  16.           ; (dorun (pmap parse-and-process (rest (line-seq reader))))
  17.           ; works..
  18.           (dorun (map parse-and-process (rest (line-seq reader))))
  19.       )))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement