Performance of PowerShell v C RRS feed

  • General discussion

  • If anyone stumbles here looking for the most efficient way, well, code something in C# or Go. Warp speed compared to powershell or any cacl flavour.

    can share code, drop me a line.



    C# uses Net same as PS.  It is not that much faster.


    • Split by jrv Saturday, July 15, 2017 2:58 PM
    Wednesday, June 28, 2017 10:20 PM

All replies

  • The handling is much faster in interpretation of steps, logging etc. If you just drop one ACL on a huge folder, it makes no difference, true, .net all the way.


    BR, Ronald

    Saturday, July 15, 2017 2:42 PM
  • With the C compiler and the file system API this is true.  With C# the difference is negligible when using the pipeline as the pipeline is almost all binary code for this operation.

    Enumerating a folder will always cause both programs to be suspended for I/O in blocks which tends to blur the difference.  Since ACLs are written one at a time to completion both programs will be suspended on each write.

    To prove your point you would need to supply a C# program and a PowerShell script and measure the times.  Repeated loops over a set of folders can be averaged to find the overall difference.

    If the PowerShell script has screen output it will run much slower as screen output is throttled by the PowerShell EXE engine.  This makes PowerShell appear to be slower.  C# does not throttle screen output.

    Both tests should run with no screen output to make the test fair.  You can have start and summary info outside of the time measurement.


    Saturday, July 15, 2017 4:13 PM