[MLton-commit] r6064
Vesa Karvonen
vesak at mlton.org
Sun Oct 7 02:25:14 PDT 2007
More accurate size for lists.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/generic/unstable/detail/value/size.sml
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/value/size.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/value/size.sml 2007-10-06 21:29:35 UTC (rev 6063)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/value/size.sml 2007-10-07 09:25:13 UTC (rev 6064)
@@ -130,9 +130,12 @@
fun list xT =
case getT xT
- of STATIC c => DYNAMIC (fn (_, xs) => (c + wordSize) * length xs)
+ of STATIC c =>
+ DYNAMIC (fn (_, xs) => (c + wordSize) * length xs + wordSize)
| DYNAMIC f =>
- DYNAMIC (fn (e, xs) => foldl (fn (x, s) => s + f (e, x)) 0 xs)
+ DYNAMIC (fn (e, xs) =>
+ foldl (fn (x, s) => s + wordSize + f (e, x))
+ wordSize xs)
fun vector xT = DYNAMIC (sequ Vector.length Vector.foldl (getT xT))
More information about the MLton-commit
mailing list