
12 Jan
2012
12 Jan
'12
1:37 p.m.
On Thu, Jan 12, 2012 at 10:25 AM, Simon Marlow
I think by (1) you mean mutable variables containing unboxed values, right?
Yes.
I normally use an unboxed array of length 1 for these. There's not much overhead - only an extra word in the heap compared to implementing them natively. I'm guessing you care more about the overhead of the operations than the space overhead of the counter itself, and a 1-element unboxed array should be just fine in that respect.
I will run some benchmarks. If it turns out that using an unboxed array is costly, what would it take to get real mutable variables containing unboxed values? -- Johan