From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 17EC7BBAF for ; Sat, 28 Feb 2009 21:18:49 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AowGANEqqUlDWxLCaWdsb2JhbACBWJMKFAQiBLMIhiWITIQaBg X-IronPort-AV: E=Sophos;i="4.38,282,1233529200"; d="scan'208";a="23672698" Received: from ip67-91-18-194.z18-91-67.customer.algx.net (HELO server1.bertec.net) ([67.91.18.194]) by mail3-smtp-sop.national.inria.fr with ESMTP; 28 Feb 2009 21:18:47 +0100 Received: from pc54.bertec.net (pc54.bertec.net [192.168.2.54]) by server1.bertec.net (Postfix) with ESMTP id 4683D10575C for ; Sat, 28 Feb 2009 15:18:41 -0500 (EST) Message-Id: From: Kuba Ober To: caml-list@yquem.inria.fr In-Reply-To: <200902280112.24115.jon@ffconsultancy.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: [Caml-list] Odd performance result with HLVM Date: Sat, 28 Feb 2009 15:18:40 -0500 References: <200902280112.24115.jon@ffconsultancy.com> X-Mailer: Apple Mail (2.930.3) X-Spam: no; 0.00; high-level:01 ocaml:01 compilation:01 ocaml-like:01 ocamlc:01 ocamlopt:01 ocamlopt:01 high-level:01 ocaml:01 invokes:01 bytecode:01 cheers:01 neck:98 compile:01 exception:01 > I am developing a high-level virtual machine built upon LLVM and > written in > OCaml that uses JIT compilation to execute OCaml-like code at break- > neck > speeds. > > I just stumbled upon a weird performance result: compiling my VM > with ocamlc > and ocamlopt produces very different benchmark results for the > performance of > the generated code (which should be identical). For example, my > float-based > Fibonacci function becomes 70% slower if I use ocamlopt and some other > float-based functions also see big performance drops. > > What is ocamlopt doing that might explain this? I assume it is > fiddling with > the floating point state somehow... You didn't let us in on how it really works. You said "high-level virtual machine built upon LLVM and written in OCaml". LLVM means too many things to be able to decipher what you mean, and your statement is too general. I'm assuming, but that's forced, so don't shoot if I make an asinus out of myself ;) So, it's a VM and it runs native jit-ted code like say .net would. So presumably you have some OCaml code that then invokes jit and some native functions to dispatch to jit-ted code? Do you interpret any bytecode, or always compile? Do you even have to have any OCaml code running in the process where the jit-ted code runs in? I presume you use the LLVM infrastructure to do the jit-ting, but without knowing exactly what code runs in the process space of the application, it's hard to tell what's going on. There's no floating point state to change that would slow things up that much. At least I have never seen anything like that. Maybe the FP exceptions are being fired somehow? You can always set a breakpoint in exception handler(s). Cheers, Kuba