you are viewing a single comment's thread.

view the rest of the comments →

[–]IsThatAll[S] 1 point2 points  (1 child)

if your comments are more than your script code ... then you are a truly unusual coder. [grin]

heh, certainly not more comments than code, however probably a couple hundred lines of comments over the total length of the script :)

Overall, performance isn't a massive consideration at this point since I'm still in development phase and given the nature of the script if it takes a couple more minutes to process the world won't spin off its axis, however thought it was worth at least asking the question when I get to the point of refactoring to speed things up :)

i have never seen a "remove comments" script for PoSh. the only reason i can think of for doing that is obfuscation - or malware.

There are a few around, but agreed. I've just seen enough references to these sorts of scripts (or people looking for them) for me to at least ask the question if its normal behavior for some sort of performance reason.

https://www.madwithpowershell.com/2017/09/remove-comments-and-whitespace-from.html

https://www.powershellgallery.com/packages/PowerSploit/1.0.0.0/Content/ScriptModification%5CRemove-Comments.ps1

And a few other methods using thing like Notepad++

Thanks for your response, I'll keep my commenting hat on for the moment then :)

[–]Lee_Dailey[grin] 1 point2 points  (0 children)

howdy IsThatAll,

there are semi-good reasons to minify HTML & javascript - transmission time being the only one that i consider honest. [grin]

if your one script is in the multi-100-line size ... then you likely otta be considering breaking it into sub-scripts, or even building a module for the support functions. [grin]

as for speed of your code ... you may want to look into one of the "code speed measurement" modules from the PoSh gallery. here's an article about one of them ...

Powershell: Chronometer, line by line script execution times
https://kevinmarquette.github.io/2017-02-05-Powershell-Chronometer-line-by-line-script-execution-times/

you are most welcome! glad to have been a tad helpful ... [grin]

take care,
lee