I'm going through a lot of files and on each file I need to obtain owner sid and owner ntaccount. I do this by using GetAccessControl() and GetOwner() which works great, exception for one thing. It's unbeliable slow and as far as I can see it's using a shared resource which mean I can't increase performance by using more threads. Right now I can do between 100 and 200 files a second when running through files on a network share. Is this as fast as it gets, or is there a way to improve performance on this point?
我正在浏览大量文件,并且每个文件都需要获取所有者sid和所有者ntaccount。我这样做是通过使用GetAccessControl()和GetOwner()来实现的,一件事就是异常。这是不可靠的慢,据我所知它使用共享资源,这意味着我不能通过使用更多线程来提高性能。现在,当在网络共享上运行文件时,我可以每秒执行100到200个文件。这是否快得多,或者有没有办法在这一点上提高性能?
Thanks
1 个解决方案
#1
I doubt it since GetAccessControl calls CodeAccessSecurity.Check() under the hood, and that is a static call. An obvious suggestion would be to run this off the machine itself and not through a network share, but I'm not sure you would be able to do that.
我怀疑它,因为GetAccessControl在引擎盖下调用CodeAccessSecurity.Check(),这是一个静态调用。一个明显的建议是从机器本身而不是通过网络共享运行它,但我不确定你能做到这一点。
#1
I doubt it since GetAccessControl calls CodeAccessSecurity.Check() under the hood, and that is a static call. An obvious suggestion would be to run this off the machine itself and not through a network share, but I'm not sure you would be able to do that.
我怀疑它,因为GetAccessControl在引擎盖下调用CodeAccessSecurity.Check(),这是一个静态调用。一个明显的建议是从机器本身而不是通过网络共享运行它,但我不确定你能做到这一点。