From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 116D1BC88 for ; Fri, 4 Feb 2005 13:46:32 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j14CkVpe008156 for ; Fri, 4 Feb 2005 13:46:31 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA19396 for ; Fri, 4 Feb 2005 13:46:31 +0100 (MET) Received: from qrnik.knm.org.pl (paf87.warszawa.sdi.tpnet.pl [217.96.225.87]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j14CkTxn027939 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 4 Feb 2005 13:46:30 +0100 Received: from qrczak by qrnik.knm.org.pl with local (Exim 3.36 #1) id 1Cx2qz-0002Pp-00 for caml-list@inria.fr; Fri, 04 Feb 2005 13:46:29 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Estimating the size of the ocaml community X-Face: OW>RV&gN+&b-aiNY|U)f=S%w+/rK!);f>/W9IXg})]&F>ht.1Up8@04+_!gOp(_/l_-+E^. 2\vI)1=D,%HWiq)r(M/V~dr^5T^KF/[w5YZ4<0Sus3+O>l3uA/&W_21m?.s,Po8{pb0@ References: <20050204.111102.71086746.oandrieu@nerim.net> <005501c50aaa$b35d9560$0100a8c0@mshome.net> <20050204121505.GA31752@furbychan.cocan.org> From: "Marcin 'Qrczak' Kowalczyk" Mail-Followup-To: caml-list@inria.fr Date: Fri, 04 Feb 2005 13:46:29 +0100 In-Reply-To: <20050204121505.GA31752@furbychan.cocan.org> (Richard Jones's message of "Fri, 4 Feb 2005 12:15:06 +0000") Message-ID: <876518h4re.fsf@qrnik.zagroda> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: "Marcin 'Qrczak' Kowalczyk" X-Miltered: at nez-perce with ID 42036EA7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42036EA5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 arrays:01 constructors:01 arrays:01 constructors:01 imho:01 unifying:01 char:01 imho:01 bool:01 writes:01 structures:01 slower:01 strings:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Richard Jones writes: > 0 used for tuples, arrays, records > 1-251 used for constructors (eg. Some, None) > 252 marks strings > 253 marks floats > 254 marks float arrays > 255 marks structures with custom ops (lots of stuff, like Int32.t) > > It's not clear to me why so much "tag space" is used for constructed > values, at the same time limiting you to around 250 different > constructors in a type definition. Couldn't the constructor number be > encoded in the first field in the value (obviously shifting all the > subsequent fields along one, and making constructed values 4 bytes > larger)? Then the tag could be reduced to a few bits, making strings > a few orders larger. If all constructed values were larger, it would be a noticeable overhead. For example a list of ints would take 4/3 times more space than currently. IMHO a better design would distinguish fixed size blocks from variable length blocks and enlarge only the latter. For example: - fixed size blocks: 15 bits of the tag, 15 bits of the size (assuming a 32-bit platform) - variable size blocks (arrays and strings): a special value in the header, the actual length is in the next field As for unifying strings with char arrays, it would make all array accesses slower. They already have a performance hit because of float arrays; in particular almost all functions from the Array module make a conditional jump for float arrays in their inner loops. IMHO it would be better if float arrays were a separate type, and the type system would somehow allow writing code which is generic wrt. the type of the sequence. Then more kinds of arrays could be added without increasing the overhead for plain arrays, e.g. bool arrays as packed bits. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/