bugGNU Octave - Bugs: bug #64557, New Virtual machine (VM):...

 
 

bug #64557: New Virtual machine (VM): Performance issues with structs of cell arrays

Submitter:  None
Submitted:  Wed 16 Aug 2023 01:29:49 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Oct 2023 09:06:06 PM UTC, comment #5: 

No complaints from CI. Closing as fixed.

Arun Giridhar <arungiridhar>
Group Member
Thu 21 Sep 2023 12:27:26 AM UTC, comment #4: 

Thanks. Pushed here: https://hg.savannah.gnu.org/hgweb/octave/rev/906ea9c9c5d9

I edited the commit message to refer to this bug number.

Arun Giridhar <arungiridhar>
Group Member
Wed 20 Sep 2023 09:08:14 PM UTC, comment #3: 

I have attached a patch addressing the issue.

It is a superfluous copy of 'a' that adds time.

(file #55152)

Petter <petter>
Tue 22 Aug 2023 02:14:13 AM UTC, comment #2: 

Add-On:
The same performance issue where the VM is materially slower than the octave interpreter exists for cell arrays containing a cell array or even a cell array containing just a matrix.

So obviously the VM does not cope well with nested data structures from a performance perspective.


function retval = test1()
  a = cell(1,1);
  a{1} = cell(100000,1);
  for i=1:100
     set_idx = rand(100000,1) < 0.001;
     a{1}(set_idx) = [sin(i), cos(i)];
  endfor
  retval = a;
endfunction

clear test1; _enable_vm_eval_ (1); tic; a= test1(); toc;
Elapsed time is 0.14317 seconds.

clear test1; _enable_vm_eval_ (0); tic; a= test1(); toc;
Elapsed time is 0.0665581 seconds

Anonymous
Sat 19 Aug 2023 07:33:08 AM UTC, comment #1: 

Thanks for the test.

My guess without debugging is that there is a superfluous copy of 'a' when it is modified.

Performance of vector operations have not been worked on much since the priority at this point is to get the VM working properly.

But things like this should be addressed at some point.

Petter <petter>
Wed 16 Aug 2023 01:29:49 AM UTC, original submission:  

The new experimental VM has performance issues with structs containing cell arrays and it actually materially (> factor 2) slower than the octave interpreter.

Pure cell arrays (not part a struct variable) do not have these issues.

==========================================================
Cell array part of a struct

function retval = test1()
  a = struct();
  a.b = cell(100000,1);
  for i=1:100
     set_idx = rand(100000,1) < 0.001;
     a.b(set_idx) = [sin(i), cos(i)];
  endfor
  retval = a;
endfunction


clear test1; _enable_vm_eval_ (1); tic; a= test1(); toc;
Elapsed time is 0.141093 seconds.
clear test1; _enable_vm_eval_ (0); tic; a= test1(); toc;
Elapsed time is 0.0670531 seconds.

VM is Factor 2.1 slower




==========================================================
Pure cell array
 
function retval = test1()
  a = cell(100000,1);
  for i=1:100
     set_idx = rand(100000,1) < 0.001;
     a(set_idx) = [sin(i), cos(i)];
  endfor
  retval = a;
endfunction

>> clear test1; _enable_vm_eval_ (1); tic; a= test1(); toc;

Elapsed time is 0.0679698 seconds.

>> clear test1; _enable_vm_eval_ (0); tic; a= test1(); toc;

Elapsed time is 0.075284 seconds.

VM is factor 1.1 faster

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #55152:  octave_32432.patch added by petter (4KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by petter (Posted a comment)
  •  

    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
    2023-10-04 arungiridhar StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-09-21 arungiridhar StatusNone Ready For Test
    2023-09-20 petter Attached File- Added octave_32432.patch, #55152

    Back to the top

    Powered by Savane 3.13-3e34.
    Corresponding source code