Unboxed mutable variables (was: Easiest way to extend CAS (casMutVar#) to boxed/unboxed Vector elements?)

Johan Tibell johan.tibell at gmail.com
Thu Jan 12 19:37:43 CET 2012

On Thu, Jan 12, 2012 at 10:25 AM, Simon Marlow <marlowsd at gmail.com> wrote:
> I think by (1) you mean mutable variables containing unboxed values, right?


> 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

More information about the Glasgow-haskell-users mailing list