[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-patch-tracker] [patch #10139] interpreter: static instead of dyn
[Octave-patch-tracker] [patch #10139] interpreter: static instead of dynamic casts for speed
Sun, 21 Nov 2021 11:56:23 -0500 (EST)
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Summary: interpreter: static instead of dynamic casts for
Project: GNU Octave
Submitted by: petter
Submitted on: Sun 21 Nov 2021 04:56:21 PM UTC
Category: Core : other
Priority: 5 - Normal
Assigned to: None
Discussion Lock: Any
I've made a patch trying to speed up the interpreter by replacing dynamic_cast
I added a configure flag "--enable-internal-checks" which could be used to
enable expensive runtime checks.
In ops.h I added a macro DYNORSTAT_CAST that is static_cast by default and
dynamic_cast if Octave is built with "internal-checks".
In the operator cc-files a changed all the dynamic_cast of references to
As I understand the code, the objects used by the operators are not supposed
to be of the wrong kind. A std::bad_cast is thrown currently which terminates
Octave, if that is the case, but with this patch any type error would silently
corrupt memory etc.
For scalar heavy code with many ops the speedup is quite substantial. E.g.
function i = foo ()
for i = 1:10e6
i = 0.5 * i / 0.9 + 1 - 8;
Has a speedup of about 15% on my machine.
Date: Sun 21 Nov 2021 04:56:21 PM UTC Name: staticcast_tomner.patch Size:
231KiB By: petter
Reply to this item at:
Message sent via Savannah
|[Prev in Thread]
||[Next in Thread]|
- [Octave-patch-tracker] [patch #10139] interpreter: static instead of dynamic casts for speed,
Petter Tomner <=