patchGNU Octave - Patches: patch #10140, interpreter: Inline nil_rep and...


patch #10140: interpreter: Inline nil_rep and make it immortal

Submitter:  Petter <petter>
Submitted:  Mon 22 Nov 2021 01:28:58 AM UTC
Category:  Core : other Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Mon 22 Nov 2021 01:28:58 AM UTC, original submission:  


I've made a patch trying to speed up the interpreter a bit.

Essentially I've added two special nil classes for octave_base_value and idx_vector_rep that are constructed with an extra count.

In that way, some checks for equality with the nil object is unnecessary in some dtors that currently are afraid of calling delete on the nil object (which is not allocated on the heap).

Also, I moved the nil_rep getter function to the header together with the object itself, to allow for inlining in other translational units.

function i = testspeed ()

        for i = 1:10e6
                i = 3* i / 2 + 1 - 88;

        for i = 1:1000000
                qwe = [1:2000]; %idx_vector_rep
                qwe (3) = 43;
                qwe = qwe + 1;

For code like that, there seem to be a ~4% speed increase.

Petter <petter>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #52318:  nil_rep-pt.patch added by petter (6KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by petter (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-22 petter Attached File- Added nil_rep-pt.patch, #52318

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code