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

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

[Octave-patch-tracker] [patch #10147] interpreter: Avoid string construc


From: Petter Tomner
Subject: [Octave-patch-tracker] [patch #10147] interpreter: Avoid string construction
Date: Fri, 26 Nov 2021 09:01:31 -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/?10147>

                 Summary: interpreter: Avoid string construction
                 Project: GNU Octave
            Submitted by: petter
            Submitted on: Fri 26 Nov 2021 02:01:29 PM UTC
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Hi!

There are alot of string construction and destruction in the interpreter that
are unnecessary. 

I split up the function look-up functions in a querry and process part to
avoid constructing strings if no function were found (which are alot since
multiple tables are queried).

Also, I replaced some string literals with static const std::string to avoid
the container overhead constructing a std::string each iteration.

Code like:

for i = 1:100000
        i = sin (i);
end


requires about 34 malloc calls per loop iteration. With this patch I got it
down to 23. Which makes it about 16% faster.

The function fcn-info.cc::get_dispatch_type still makes strings. Changing it
in this patch would make it abit too big. 



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 26 Nov 2021 02:01:29 PM UTC  Name: avoidstringctors_pt.patch  Size:
28KiB   By: petter

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

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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