简体   繁体   English

有没有一种方法可以加快GetAccessControl和GetOwner

[英]Is there a way to speed up GetAccessControl and GetOwner

I'm going through a lot of files and on each file I need to obtain owner sid and owner ntaccount. 我正在处理大量文件,并且在每个文件上我都需要获取所有者sid和所有者ntaccount。 I do this by using GetAccessControl() and GetOwner() which works great, exception for one thing. 我通过使用GetAccessControl()和GetOwner()来做到这一点,这很好,一件事情是例外。 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. 现在,通过网络共享上的文件运行时,我每秒可以处理100到200个文件。 Is this as fast as it gets, or is there a way to improve performance on this point? 这是速度之快,还是有办法提高性能呢?

Thanks 谢谢

I doubt it since GetAccessControl calls CodeAccessSecurity.Check() under the hood, and that is a static call. 我很怀疑,因为GetAccessControl在后台调用了CodeAccessSecurity.Check(),这是一个静态调用。 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. 一个明显的建议是在计算机本身上而不是通过网络共享来运行它,但是我不确定您是否能够做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM