Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Very high call overhead to a specific C++ object member function

Received: by 10.224.182.74 with SMTP id cb10mr7155766qab.0.1347345947073;
        Mon, 10 Sep 2012 23:45:47 -0700 (PDT)
X-BeenThere: v8-users@googlegroups.com
Received: by 10.224.217.65 with SMTP id hl1ls237326qab.8.gmail; Mon, 10 Sep
 2012 23:45:45 -0700 (PDT)
Received: by 10.224.181.75 with SMTP id bx11mr7145116qab.7.1347345945386;
        Mon, 10 Sep 2012 23:45:45 -0700 (PDT)
Received: by 10.224.181.75 with SMTP id bx11mr7145115qab.7.1347345945373;
        Mon, 10 Sep 2012 23:45:45 -0700 (PDT)
Return-Path: <ernst.matth...@gmail.com>
Received: from mail-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180])
        by gmr-mx.google.com with ESMTPS id fe27si1119112qcb.0.2012.09.10.23.45.45
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 10 Sep 2012 23:45:45 -0700 (PDT)
Received-SPF: pass (google.com: domain of ernst.matth...@gmail.com designates 209.85.216.180 as permitted sender) client-ip=209.85.216.180;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ernst.matth...@gmail.com designates 209.85.216.180 as permitted sender) smtp.mail=ernst.matth...@gmail.com; dkim=pass header...@gmail.com
Received: by qcmv28 with SMTP id v28so77121qcm.25
        for <v8-users@googlegroups.com>; Mon, 10 Sep 2012 23:45:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:sender:in-reply-to:references:date
         :x-google-sender-auth:message-id:subject:from:to:content-type;
        bh=xuAaISeEA0finjOWhv4yCilZVItyPH3CE9fZVkl30ss=;
        b=GZ9ygS11/v6yaPr7r1y85zlX7agv8TcQAQv7OkpZAc7YKXUDQQst1cK4JV+KX/xi0R
         SVIdHPfYWbg+Ovema9o8ubLcKmZ0fySd+GZC7b4XJw0Tt/70Imx2KOnr0w3MikenGg0J
         1ck08GcDpWueGc3WE3nzf8y6ZdrHjB2oEkgp2b5yox8zadv45fO5th4X/7dDwufLBlzk
         NgIezqV5ZML/oG0I6PdI3IcIbarlxBkeks44Vru9NqyDCczs9ZAOdCLnnLPqVBaaWYQ/
         AIOXutJXVFUTh/6Tz9aBxU3TwmIRZz4U6ItKEm6uOxnlcUW6HXRqeazD+T6VRgCSEiZI
         khlA==
MIME-Version: 1.0
Received: by 10.224.209.8 with SMTP id ge8mr5335084qab.0.1347345945121; Mon,
 10 Sep 2012 23:45:45 -0700 (PDT)
Sender: ernst.matth...@gmail.com
Received: by 10.49.75.38 with HTTP; Mon, 10 Sep 2012 23:45:45 -0700 (PDT)
In-Reply-To: <d53225d3-c1bd-4c79-b830-5834993e721c@googlegroups.com>
References: <d53225d3-c1bd-4c79-b830-5834993e721c@googlegroups.com>
Date: Tue, 11 Sep 2012 08:45:45 +0200
Message-ID: <CAKJ3wwG0rSO9mfGwQO9vCSObbF5VPCSPTkFkGJtbM34_M5M...@mail.gmail.com>
Subject: Re: [v8-users] Very high call overhead to a specific C++ object
 member function
From: Matthias Ernst <matth...@mernst.org>
To: v8-users@googlegroups.com
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Sep 11, 2012 at 7:19 AM, Stuart Allen <stu...@lttlrck.com> wrote:
> Hi,
>
> I stumbled across a very strange problem. I'm using 3.12.19.1 on Linux
> 64-bit.
>
> I have an object implemented in C++, I noticed an unexpected slow-down and
> eventually traced it to a particular call.
>
> If the object method is called like this:
>
> this.MyObject.method()
>
>
> it takes 20ms (milliseconds) to execute, when it should be 0ms. I made
> timings inside C++ and they show a total 0ms execution time so the 20ms is
> introduced inside the JS<->C++ boundary.
>
> On a hunch I tried this:
>
> var cn= this.MyObject.method;
> cn();

For the record, this call has different semantics: it won't pass
MyObject, but rather the global object, as "this". Not that that would
immediately explain the timing difference you see.

I think you may need to post some more context code.
Especially regarding the construction of "MyObject" including "method".

Is the timing you see measured as an average of many loop iterations
or just one call?

Matthias

>
>
> and guess what, it takes 0ms!!
>
> methods of the same Object instance are called before and after yet they
> execute as expected with no measurable overhead (in millsecond land).
>
> Is there any foundation for such a problem? Could it be a scoping/resolving
> issue causing problems resolving the method?
>
> Are there any diagnostics that could help here?
>
> Thanks,
>
> Stuart.
>
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users