From: Nicolas C. <war...@fr...> - 2003-06-16 05:55:41
|
Recently, after the talks of Xavier Leroy on the main ocaml list, it appear that Obj.set_field is not working so good. Jacques Garrigue looked at the generated native code and he noticed that the Obj.set_field is doing additional (useless) operation by testing the block tag for Double_array_tag. Not only the code is bigger, but there is a (very) little speed issue , compared to using a mutable structure like : type 'a mutlist = { h : 'a ; mutable tl : 'a mutlist; } I might then modify ExtList soon to clean theses things. ( please note that we still Obj.magic to convert from/to 'a list. Another problem might come from the "trick" : let x = [ Obj.magic () ] in .... List.tl x who might get outlined by the compiler and thus will be shared by several calls (which is not what we want since we're muting the tail !). A workaround is not to use unit but one of the arguments of the function to prevent to compiler to mark the block as constant. Nicolas Cannasse |