PowerShell Studio - Performance Issue

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 8 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
Trevis
Posts: 1
Last visit: Fri Oct 23, 2015 10:25 am

PowerShell Studio - Performance Issue

Post by Trevis »

Hello,

I have a question about script performance in the PowerShell Studio 2015 (4.2.95). I wrote very short test script.

Running time in the Powershell Studio is longer then in the Powershell Console.

Can I ask someone for the explanation? Where is the problem? It has also impact to the (built) executable file.

This is the script:
PowerShell Code
Double-click the code block to select all.
$PerfStart = (Get-Date)
Get-Module -ListAvailable
$PerfEnd = (Get-Date)

Write-Host "Total time: " (($PerfEnd - $PerfStart).totalseconds)
Output from the Powershell Studio:
Total time: 20,9452221
Output from the Powershell console:
Total time:  3,9927442
Thank you.
Trevis
User avatar
SAPIEN Support Forums
Posts: 945
Last visit: Thu Oct 22, 2015 1:10 pm

PowerShell Studio - Performance Issue

Post by SAPIEN Support Forums »

This is an automated post. A real person will respond soon.

Thank you for posting, Trevis.

Did you remember to include the following?
  • 1. Product, version and build (e.g. Product: PrimalScript 2014, Version & Build: 7.0.46. Version and build information can be found in the product's About box accessed by clicking the blue icon with the 'i' in the upper right hand corner of the ribbon.)
    2. Specify if you are running a 32 or 64 bit version
    3. Specify your operating system and if it is 32 or 64 bit.
    4. Attach a screenshot if your issue can be seen on the screen
    5. Attach a zip file if you have multiple files (crash reports, log entries, etc.) related to your issue.
If not, please take a moment to edit your original post or reply to this one.

*** Make sure you do not post any licensing information ***
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: PowerShell Studio - Performance Issue

Post by davidc »

The cmdlet is handled directly by PowerShell itself and not the host. Chances are that PowerShell console has already cached the values of the modules by the time you run the command.

If you add "Get-Module -ListAvailable" to the line before the timer you will see the difference it makes.
PowerShell Code
Double-click the code block to select all.
Get-Module -ListAvailable
$PerfStart = (Get-Date)
Get-Module -ListAvailable
$PerfEnd = (Get-Date)
 
Write-Host "Total time: " (($PerfEnd - $PerfStart).totalseconds)
David
David
SAPIEN Technologies, Inc.
This topic is 8 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.