My colleague likes to use gcc with '-g -O0' to create binaries for production due to debugging if the main dump happens. He says that there is no need to use compiler optimization or code tuning, because he believes that the production process does not have high CPU utilization, for example. thirty%.
I asked him the reason for this, and he told me: if the processor load is low, the bottleneck should not be our code performance and should be some IO (disk / network). Thus, the use of gcc-O2 is useless to improve latency and throughput. In addition, this also indicates that we have nothing to improve much in the code, because the processor is not a bottleneck. It is right?
, , , , , . "" . , CPU, .
char , , , , , , & hellip; - 0,5% .
char
, , , 30% . , , , , , , 30% .
, - . , sleep , , , .
sleep
tl; dr: , , - .
, , . , -O0 , "" 2016 -O1 -O2. , .
-O0
-O1
-O2
-g , . 45 1 , , .
-g
? , . , , , , .
, . (-O1), (-g); , , .
, :
-O2 -g
strip
, , .
( ).
, 1 , CPU 0,3 - 0,7 . , 100% - , CPU , 0,3 0,15 , 0,85 1 (, - ).
, , . , 100%, , 33%, 30% , . , .
, , , - . "", . ( , "" ), , , , , . , .
gcc -Og -g GCC. -Og .
gcc -Og -g
-Og
, gcc -O1 -g; () , 90% -O2 ( , -O3 ). core .
gcc -O1 -g
-O3
core
. (HPC) .
, -g3 -g (, gcc -Wall -O1 -g3)
-g3
gcc -Wall -O1 -g3
BTW , .
: . , , . , .
, , . 1-2 4- . 0% , , : 30% .
, , . 10% , , , - . , , , , . 1% , , !
: , , , , . , , . " " . , , . , 15 .
, , , , , . , , - .
Source: https://habr.com/ru/post/1623417/More articles:How to return binary data instead of base64 encoded byte [] in spring mvc break controller - javaOpen ResponseEntity PDF in a new browser tab - javaHow to submit a Scala task to Spark? - scalaHow to save UIWebView contents for offline display? - iosjQuery ajaxComplete () detect ajax calls prototypejs? - javascriptIs there a performance improvement when using the JOIN vs WHERE clause? - sqlThe correct way to implement jwplayer in a reaction component using webpack (reactive starter kit) - reactjsText fading into text - vbaSpring @FeignClient with OAuth2FeignRequestInterceptor not working - springScroll webpage input. Up field will prevent hiding with Soft Keyboard - javascriptAll Articles