Are there any performance penalties when I use several nested structures / classes (sort of like using mutation heap arrays) or is it just an organizational feature of the language to make it easier to track data and the compiler doesn't really see any difference?
thank
Not really. Classes / structures simply define offsets in memory, so if you have a class inside a class inside a class, the compiler just adds offsets.
, ( - L2) ( , ).
EDIT: , , - , , , . , L2, , -, 60 , .
. , .
Mostly not, as others have mentioned. However, there is a slight exception: placing structures inside structures can lead to a small restriction on memory usage due to alignment problems, compared to the same primitives that fit directly into one structure. This can lead to a failure in theoretical costs, which degrades performance. For instance:
#include <iostream> using namespace std; // So sue me struct A { double d; int i; }; struct B { int j; int k; int l; }; struct AB { A a; B b; }; struct C { double d; int i; int j; int k; int l; }; int main() { cout << sizeof(AB) << endl; // 32 cout << sizeof(C) << endl; // 24 }
Short answer: None.
Source: https://habr.com/ru/post/1765209/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1765204/question-about-web-programming-maps-to-be-specific&usg=ALkJrhhieKYqLIIBl76JEpZiZSGN9__yiwHow to determine the "lowest" coding? - c #Authentication of WCF service using System.Web.ApplicationServices.AuthenticationService, I can not authenticate membership provider - authenticationHaskell: type deduction function - typesChanging a database in symfony (doctrine) - phpHow to change jqGrid theme? - jqueryCall WCF service from SQL CLR procedure in C # - sqlServer Side Permission with OAuth - authenticationDoes MongoDB Map / Reduce save results in floats? - mongodbWCF service call from SQL CLR stored procedure - sqlAll Articles