TAILIEUCHUNG - Expert C++/CLI .NET for Visual C++ Programmers phần 8

cơ thể của các ChangedFileDumper, các thành viên gcroot dữ liệu được sử dụng như thể nó là của ^ FileSystemWatcher loại. Chú ý rằng tài sản Path là một tài sản của FileSystemWatcher, không phải là một tài sản của gcroot. Hành vi này có thể bởi vì gcroot | CHAPTER 9 MANAGED-UNMANAGED TRANSITIONS 225 As you can see in both tables calls across managed-unmanaged boundaries produced by C CLI can be more than 500 percent slower than calls without transitions. However unless you have a large number of transitions this overhead can likely be ignored. The difference in overhead between the 10 million calls to fManagedLocal from native callers and the 10 million calls from managed callers is about seconds. In addition to the measured time both tables also show the transitions that occur in the different scenarios. For example for the direct call to fManagedLocal from managed code the text M M shows that a call from managed code to managed code has occurred. Cells with the text U M indicate an unmanaged-to-managed transition. Likewise M U stands for a managed-to-unmanaged transition. For the indirect call to fManagedLocal from managed code the text M U M indicates a transition from managed code to unmanaged code and back to managed code. This is the double-thunking scenario discussed earlier. In addition to the double-thunking case Table 92 also shows the cost for an indirect method call with a_clrcall function pointer which can prevent double thunking as discussed earlier. As you can see double thunking can easily increase the costs for method calls by more than 600 percent. Table 9-3 shows similar results for the double-thunking problem related to virtual function calls. Optimizing Thunks For unmanaged-to-managed transitions there is no potential for improving the performance of the generated thunks. There are no hidden keywords or attributes that can be used for optimizations of transitions in this direction. An unmanaged-to-managed thunk has to perform certain expensive operations. For example it is possible that a managed function is called by a thread that has not yet executed managed code. The unmanaged-to-managed thunk must be prepared for that case so that a native thread will be automatically promoted

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.