From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id FAA06287; Tue, 6 Aug 2002 05:22:10 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 FAA06384 for ; Tue, 6 Aug 2002 05:22:09 +0200 (MET DST) Received: from mail2.tpgi.com.au (mail.tpgi.com.au [203.12.160.58]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g763M7D18380 for ; Tue, 6 Aug 2002 05:22:08 +0200 (MET DST) Received: from ozemail.com.au (syd-ts15-2600-197.tpgi.com.au [203.213.83.197] (may be forged)) (authenticated (0 bits)) by mail2.tpgi.com.au (8.11.6/8.11.6) with ESMTP id g763M3Z23303 for ; Tue, 6 Aug 2002 13:22:04 +1000 Message-ID: <3D4F40DA.5040006@ozemail.com.au> Date: Tue, 06 Aug 2002 13:22:02 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] ocaml-3.05: a performance experience References: <3D49FD72.68388864@quasar.ipa.nw.ru> <20020803123311.GA631@ice.gerd-stolpmann.de> <3D4C965D.775F23DD@quasar.ipa.nw.ru> <20020804204532.GA9405@ice.gerd-stolpmann.de> <3D4E972D.6000706@ozemail.com.au> <021e01c23c9c$86d0c9b0$240f2744@cc1003186f> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Mike Lin wrote: >>I'm intrigued by the relationship between these two parsers. In >> > particular, > >>note that my Felix compiler takes 'pull' code, and automatically >>translates it >>to the much more efficient 'push' model: ie. it switches the client/server >>relationship around, a process I call control inversion. >> > > I'm just curious if you could elaborate on in what respect a push parser is > "much more efficient"? Blocking IO using OS resources is very slow -- O(log N) is good. User space dispatching is typically very fast: O(1) [using a hashtable] So if you're parsing XML being read over the internet, the push technology is superior -- if you can bypass the high level socket interface (which is non-trivial :-( >>From my experience pull parsers tend to be easier to > use because they don't impose an event-driven model on the driver program, Absolutely! That is why Felix exists. To allow one to write 'pull' code, which does blocking reads of data, but have the code translated to 'push' code, where a thread is resumed by a dispatcher when the data is available. For some applications like telephony, where the number of connections is rather large, event driven code is the ONLY option. Unix OS are typically incapable of handling millions of threads, a user space dispatcher has no trouble at all, even on a small Linux PC. The reason is: client level code 'knows' the encoding of messages and can sort out where to send it much faster than any generic OS facilities can: OS schedulers are designed to run arbitrary mixtures of programs, not millions of threads of the same application. > and also it is trivial to build a push parser on top of a pull parser. Yep. Just write a dispatch loop :-) -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners