官术网_书友最值得收藏!

Performance considerations

This book dives into important performance considerations for your scripts. Since PowerShell is an extremely flexible language, you can complete the same activity in multiple ways. While both sets of code get the script to create the same results, there are ways to optimize your code to make it much more efficient. This becomes increasingly important as you evaluate large amounts of data.

Execution time for file scanning, for example, exponentially grows with the quantity of files and the file sizes. 100 files with 100 lines of code can quickly create 10,000 evaluations. Now, if you scale that to 6 million files in a storage volume times 100 lines of code, you are performing 600 million evaluations. Small code performance improvements can significantly optimize your scanning of scripts at scale.

Some of the performance considerations include:

  • Measuring commands: You will evaluate a technique to measure the execution time for commands.
  • Cmdlet considerations: You will learn which cmdlets are more efficient than others and how to avoid common cmdlet mistakes.
  • Regular expressions over arrays: Regular expressions can be difficult to learn, but they provide significant performance improvements to your scripts. You will learn how to properly implement dynamic regular expressions in your scripts.
  • Switch statements: You will evaluate how to perform data sorting with switches and why switch statements are significantly faster.
主站蜘蛛池模板: 赞皇县| 绵阳市| 灵武市| 宜宾市| 本溪市| 宁河县| 政和县| 锡林郭勒盟| 吕梁市| 泰来县| 南投市| 南雄市| 普陀区| 娱乐| 石泉县| 上高县| 石嘴山市| 定日县| 兴安县| 社旗县| 丽江市| 东丽区| 嘉鱼县| 东港市| 昌乐县| 台中市| 岱山县| 治县。| 简阳市| 中超| 青浦区| 十堰市| 镇原县| 灵石县| 鞍山市| 晋江市| 义马市| 潍坊市| 团风县| 安仁县| 龙井市|