From: Nathan Saichek on 24 Jun 2010 20:49 So my problem is unusual for me... It may be commonplace (relatively speaking) in the community, so I figured I'd ask here before I submitted a support request. I've got a class(mysystem) that has an array of handle objects of another class (nodeArray) which will eventually contain a large number of nodes. I initialize the array to a large value and use an index to fill up the array linearly. Unfortunately, this runs extraordinarily slowly, and continually slows down as more nodes get added. The first 50 nodes go in in about 2 seconds, but adding furtner nodes slows down rapidly - after about 300 nodes, it takes more than a second to add a single node. I thought that preallocating and indexing would help speed things up, but for some reason that doesn't seem to be the case. So my class declaration looks like this (simplified / reduced): classdef mysystem < handle properties name = '' NA = node.empty(); NAIndex = 0; end methods function obj = mysystem(myname) if nargin == 1 obj.name = myname; end obj.NA(1:100000) = node(); end function addNodes(mysystem,na) ind = mysystem.NAIndex; mysystem.NA(ind+1:ind+length(na)) = na; mysystem.NAIndex = ind +length(na); end end When I create an instance of the 'mysystem' class, it indeed shows that the node array is indeed being created, and filled up linearly. It seems too simple to fail, and yet it's extraordinarily slow. Properties: name: 'mysys' NA: [1x100000 node] NAIndex: 112 For reference, I expect to add in the neighborhood of 10k - 75k nodes to the array. Any other information I can provide? Suggestions? Thanks in advance!
|
Pages: 1 Prev: Some posts about neural network Next: GUI Stack to include OS? |