문제

Today I get a task to realise B tree and I am interesting whether unsafe code with fixed buffers will be more effective for working with disk? As we will work with whole segments but not with disparate segments of memory (as would be when we work with safe types and will try to copy "structs" which contains some different variables in different places in memory)? I am sorry if my question is not very concrete, but I don't understand how to concrete it without big piece of code. Thank you an advance.

도움이 되었습니까?

해결책

Performance questions are not answered easily - especially without code.

Why don't you just try both variants?

Then run the test 10 (or even 100 or more) times and get the average value.
This should even out the side effects for both methods - to compare good enought...

If they are "to close together" for a definite answer you should use the "safe way". Because IMO unsafe should only be used if really necessary.

P.S.: I can't recommend any books or similar to such methods - "learning by doing" is my advice here. In such cases I also just try different things and analyze them, maybe search for different approaches or ask here for specific help with a short code example (already done here multiple times successfully). After that I most of the time have better and more performant code and learned something new...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top