octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #10140] interpreter: Inline nil_rep and ma


From: Petter Tomner
Subject: [Octave-patch-tracker] [patch #10140] interpreter: Inline nil_rep and make it immortal
Date: Sun, 21 Nov 2021 20:29:00 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

URL:
  <https://savannah.gnu.org/patch/?10140>

                 Summary: interpreter: Inline nil_rep and make it immortal
                 Project: GNU Octave
            Submitted by: petter
            Submitted on: Mon 22 Nov 2021 01:28:58 AM UTC
                Category: Core : other
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 22 Nov 2021 01:28:58 AM UTC  Name: nil_rep-pt.patch  Size: 6KiB  
By: petter

<http://savannah.gnu.org/patch/download.php?file_id=52318>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?10140>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]