From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 14E6FBB84 for ; Tue, 18 Apr 2006 14:00:20 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3IC0J7Q024256 for ; Tue, 18 Apr 2006 14:00:19 +0200 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 OAA14237 for ; Tue, 18 Apr 2006 14:00:18 +0200 (MET DST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3IC0I79024244 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 18 Apr 2006 14:00:18 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FVosF-0003YQ-Hi for caml-list@inria.fr; Tue, 18 Apr 2006 14:00:04 +0200 Received: from vpn-epfl-a096.epfl.ch ([128.178.83.116]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Apr 2006 14:00:03 +0200 Received: from Michel.Schinz by vpn-epfl-a096.epfl.ch with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Apr 2006 14:00:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Michel Schinz Subject: Re: Performance of threaded interpreter on hyper-threaded CPU Date: Tue, 18 Apr 2006 13:59:55 +0200 Message-ID: References: <4444A46C.5000102@inria.fr> <9d3ec8300604180440s74c5c908pe2c9f6f8d344bab7@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: vpn-epfl-a096.epfl.ch User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Cancel-Lock: sha1:KmMvy4wstzawt/AI4g/wCLCH3as= Sender: news X-Miltered: at concorde with ID 4444D4D3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4444D4D2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; schinz:01 schinz:01 epfl:01 dispatching:01 complang:01 tuwien:01 ocaml:01 gcc:01 dispatching:01 writes:01 michel:01 michel:01 clarify:02 seems:03 threaded:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 "Till Varoquaux" writes: [...] > Could you try running your multithreaded code on only one of the > virtual cpu to see the improvement hyperthreading really brings in? To clarify things: I'm not talking about a multi-threaded program. "Threaded code" is a technique which is commonly used to speed up dispatching in interpreters. It is relatively well described on the following page: http://www.complang.tuwien.ac.at/forth/threaded-code.html The OCaml VM is written in such a way that it uses that technique if possible (basically if it is compiled using a recent gcc, which offers the extensions needed to implement threaded code), and falls back to a "standard" switch-based dispatching technique otherwise. My observation is that in some circumstances, threaded code seems to slow down the VM instead of speeding it up as it should. (The biggest slowdown being observed on a hyper-threaded architecture, but I have no idea why). Michel.