|
From: | Rik |
Subject: | Re: assert () taking long time |
Date: | Thu, 19 Sep 2013 13:06:24 -0700 |
On 09/19/2013 10:00 AM,
address@hidden wrote:
9/19/13Message: 2 Date: Thu, 19 Sep 2013 17:16:41 +0200 From: Daniel Kraft <address@hidden> To: "John W. Eaton" <address@hidden> Cc: address@hidden Subject: Re: assert() taking long time Message-ID: <address@hidden> Content-Type: text/plain; charset="utf-8" ********* *BEGIN ENCRYPTED or SIGNED PART* ********* On 2013-09-19 16:54, John W. Eaton wrote: Daniel, Are you working from the development version of Octave in the Mercurial repository? The assert function has been massively re-written on the development branch and it may, or may not, still have performance issues. Assuming you are using the latest assert.m, what kind of performance hit are you seeing? Is it 1% or 10% of your script running time? For the version in the repository, the calls to deblank could easily be avoided. We pre-calculate an error message using deblank, but only print it if there is a problem. You could move the calculation of the message inside the error checking code so that it is only generated if needed. Look for the variable "in" in the code; It is used in two if branches so you would need to duplicate it for each if body, but that is simple. --Rik Maybe I'll try out how much of a difference that would already make, even though it is not optimal (there's still the overhead of calling the assert function, the condition is still evaluated and so on). I presume this would go without too much disturbance to the Octave core? If this is not enough, I know that the parser can't rely on assert() being actually the assert function that should be ignored in some cases -- but would it be ok to still do so conditionally (default to off of course), when those who enable the option do so on their own responsibility? Furthermore, couldn't the interpreter -- after resolving the target of a function call -- check whether the function being called is the intrinsic assert or something else? So that only calls to assert() proper will be disabled. What do you think? Yours, Daniel |
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |