3 ms·
> You see it happen also when cache friendly code and RAII get discussed. To be honest, I can't talk intelligently about cache-friendliness at all. I know that
by catnaroek 11y ago
> You see it happen also when cache friendly code and RAII get discussed.
To be honest, I can't talk intelligently about cache-friendliness at all. I know that there exist models of computation (say, for complexity analysis purposes) that explicitly take memory hierarchies into account, but I've never seen them actually used on anything but the simplest data structures and algorithms.
With respect to RAII, I think the main benefit isn't cache-friendliness, but rather deterministic destruction - you can't delay relinquishing a scarce resource that someone else might want to use.
> So most millennials think that they are some special language capabilities only possible in C and C++.
I'm a millennial, and have to admit with shame that I grew up thinking C++ is the best thing ever. But it's possible to recover from it. :-)
- sklogic 11y ago> but I've never seen them actually used on anything but the simplest data structures and algorithms Take a look at a typical performance-oriented GPU coding, cache is the major analysis parameter there. Data structures are mostly 2D and 1D arrays, but they may be scrambled in a very complex way, and the algorithms are arbitrarily complex.
- catnaroek 11y agoThanks for the pointer. Will have a look.
- pjmlp 11y ago> With respect to RAII, I think the main benefit isn't cache-friendliness, but rather deterministic destruction - you can't delay relinquishing a scarce resource that someone else might want to use. I never said it was related to it, I said it was the other feature many think it is C++ specific, or introduced via C++. Ada also has RAII via controlled types and Object Pascal also had destructors when it was introduced. Functional programming languages that allow for rich macros, support trailing lambdas or currying also allow for RAII like implementations using those features. For example, with-open-file in Common Lisp.