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

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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

Hi!

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 ()

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

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


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

Petter <petter>

 

Attached Files

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

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    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.16-a7ba.
    Corresponding source code