If you want to be conservative about your data, it looks like Datomic is an excellent choice. It preserves the entire history of your data instead of allowing it to be modified in place.
715 karma · joined August 9, 2009
Honestly though, this misses the point. If your language forces you to use an unsuitable paradigm, it's time to use another language if you can.
import "runtime"
...
runtime.MemStats.EnableGC = false
https://groups.google.com/forum/?fromgroups#!topic/golang-nu...Edit: Looking a bit more, I noticed that ObjectFabric doesn't yet support JavaScript directly, only through GWT.
I posted some code to run the comparison at https://github.com/ijt/fast-as-c-article. Here are the results:
[ issactrotts ~/haskell/fast-as-c-article ] ./compare
== cmean ==
gcc -O2 -o cmean cmean.c
mean: 500000000.500000
real 0m0.774s
user 0m0.770s
sys 0m0.002s
== gomean ==
6g gomean.go
6l -o gomean gomean.6
mean: 500000000.500000
real 0m0.776s
user 0m0.769s
sys 0m0.003s
== hsmean ==
ghc -O2 hsmean.hs -optc-O2 -fvia-C --make
[1 of 1] Compiling Main ( hsmean.hs, hsmean.o )
In file included from /usr/local/Cellar/ghc/7.0.4/lib/ghc-7.0.4/include/Stg.h:230,
from /var/folders/g2/ylbqfw5533n65z6qkxljg0_h0000gn/T/ghc23078_0/ghc23078_0.hc:3:0:
/usr/local/Cellar/ghc/7.0.4/lib/ghc-7.0.4/include/stg/Regs.h:177:0:
sorry, unimplemented: LLVM cannot handle register variable ‘R1’, report a bug
make: *** [hsmean] Error 1
== hsmean_nollvm ==
ghc -O2 hsmean.hs -optc-O2 --make -o hsmean_nollvm
[1 of 1] Compiling Main ( hsmean.hs, hsmean.o )
Linking hsmean_nollvm ...
ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
mean: 500000000.067109
real 0m8.886s
user 0m8.863s
sys 0m0.018s $ ghci
Prelude> let getFromList ls pred = foldl (\x y -> if x `pred` y then x else y) (head ls) (tail ls)
Prelude> getFromList [1..10] (<)
1
Prelude> getFromList [1..10] (>)
10 fizzbuzz x | x `mod` 3 == 0 && x `mod` 5 == 0 = "FizzBuzz"
| x `mod` 3 == 0 = "Fizz"
| x `mod` 5 == 0 = "Buzz"
| otherwise = show x
main = putStr $ unlines $ map fizzbuzz [1..100]let step row = zipWith (+) (0:row) (row++[0])
let triangle = iterate step [1]
take 10 triangle