bugGNU Octave - Bugs: bug #50688, orderfields is slow

 
 

bug #50688: orderfields is slow

Submitter:  Guillaume <gyom>
Submitted:  Fri 31 Mar 2017 10:02:13 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 05 Apr 2017 07:06:30 PM UTC, comment #2: 

I did some benchmarking and the new code runs in about 1/2 the time of the old code even for small numbers of fieldnames.  I committed the change to the development branch under Guillaume's name here (http://hg.savannah.gnu.org/hgweb/octave/rev/4f07b4770eec).  One change to the patch I did make was to revert to using more explicit error messages for the input validation.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 31 Mar 2017 08:26:19 PM UTC, comment #1: 

What is the benchmarking data for structures with a more ordinary number of fields, say 15?

Ideally, your implementation will be faster for these as well.  But if it isn't, then we don't necessarily want to optimize for the rare case of 2000 fields.

Rik <rik5>
Group administrator
Fri 31 Mar 2017 10:02:13 AM UTC, original submission:  

I noticed in bug #49559 that orderfields() was quite slow for large structures. I rewrote it to minimize the number of calls to sort() and replace the for-loop over fieldnames with a call to struct2cell()/cell2struct(). It seems to be about two orders of magnitude faster for a structure with 2000 fields.

Guillaume <gyom>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #40218:  of.diff added by gyom (4KiB - 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 siko1056 (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by gyom (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 group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-05 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-04-05 siko1056 StatusNone Confirmed
    2017-03-31 gyom Attached File- Added of.diff, #40218

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code