Scalability of the add-member cmdlet.




I observe some strange behavior with the add-member cmdlet and would like to
get your ideas on this issue.
Basically, I have a script that creates MSH objects and add new propeties to
the objects using the add-member cmdlet.
Here is the script:

--------PerfAM.msh-----------------

param($Max_Object=(read-host "Number of objects"),
$MaxAttributes= (read-host "Number of attributes") )

for ( $j =0 ; $j -lt $Max_Object; $j++)
{
$script:LogObj = new-object System.Management.Automation.MshObject


for ($i = 0; $i -lt $MaxAttributes ; $i++)
{
add-member -in $script:LogObj -Type NoteProperty -Name
"Attribute$i" -Value $i -force > $Null
}

$script:LogObj


}
------------------------------------
Here are my observations when running the script on a Pentium M 2 GHz with 2
GB of RAM

Num of objects | Num of Attributes | Processing-time
---------------------------------------------------------
1K | 1 | 00:00:01
1K | 10 | 00:00:07
1K | 100 | 00:01:04
1K | 1000 | 00:10:55
1M | 1 | 00:19:11

During the execution of the script, the CPU is constantly at 100%
occupation.

I am not able to run the script with 1M objects and 10 attributes.
Monad throws a memeory exception even though my machine has 1 GB of
available memory!

Has anyone seen this behavior?

Thanks for any advice on how to optimize the script,

/Dung


.



Relevant Pages

  • help with GD and gd
    ... please observe that GD!= gd. ... the following CPAN-modules are installed: ... we run the script in question on an apache web server. ...
    (comp.lang.perl.modules)
  • help with GD and gd
    ... please observe that GD!= gd. ... the following CPAN-modules are installed: ... we run the script in question on an apache web server. ...
    (comp.lang.perl.misc)
  • Re: Algorithm to extract lines of a tab with the max value for a given reference number
    ... It's good to see that you've got your script. ... I was just planning on ... writing it. ... But it feels great to observe the speed in which you get ...
    (comp.programming)
  • Re: Vbscript, jscript or java script?
    ... And Microsoft's java script. ... What could be causing this strange behavior? ... > Roland Hall ... without even the implied warranty of merchantability ...
    (microsoft.public.scripting.jscript)
  • Re: Vbscript, jscript or java script?
    ... Right now I seem to have one particular script problem, ... What could be causing this strange behavior? ... You're in a development support area and you're not ... without even the implied warranty of merchantability ...
    (microsoft.public.scripting.jscript)