{"id":1885,"date":"2015-09-03T18:02:41","date_gmt":"2015-09-03T17:02:41","guid":{"rendered":"http:\/\/www.unicoda.com\/?p=1885"},"modified":"2015-09-03T15:15:50","modified_gmt":"2015-09-03T14:15:50","slug":"performance-entre-compute-et-move","status":"publish","type":"post","link":"https:\/\/www.unicoda.com\/?p=1885","title":{"rendered":"Performance entre compute et move"},"content":{"rendered":"<pre><span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">WORKING-STORAGE<\/span> <span style=\"color: #00ff00;\">SECTION<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n<span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">01<\/span><span style=\"color: #ffffff;\"> WORKING-VAR.<\/span><\/span>\r\n<span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">   05<\/span><span style=\"color: #ffffff;\"> W-TAU-3-6         <\/span><span style=\"color: #00ff00;\">PIC<\/span><\/span><span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">S9(3)V9(6)<\/span> <span style=\"color: #00ff00;\">COMP-3<\/span><\/span><span style=\"color: #ffffff; font-size: small;\">.<\/span>\r\n<span style=\"font-size: small;\"><span style=\"color: #ffffff;\">\u00a0<span style=\"color: #ff0000;\">   05<\/span>  W-TAU-2-5        <\/span><\/span><span style=\"color: #00ff00; font-size: small;\">PIC<\/span> <span style=\"color: #ff0000; font-size: small;\">S9(2)V9(5)<\/span><span style=\"color: #ffffff; font-size: small;\">.<\/span>\r\n<span style=\"font-size: small;\"> <span style=\"color: #ff0000;\">   05<\/span><span style=\"color: #ffffff;\"> W-CPT             <\/span><span style=\"color: #00ff00;\">PIC<\/span> <span style=\"color: #ff0000;\">9(09)<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n\r\n<span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">PROCEDURE<\/span> <span style=\"color: #00ff00;\">DIVISION<\/span><span style=\"color: #ffffff;\">.<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span> <span style=\"color: #ff0000;\">123,123456<\/span>       <span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-TAU-3-6<\/span><\/span>\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span> <span style=\"color: #ff0000;\">12,12345   <\/span>      <span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-TAU-2-5<\/span><\/span>\r\n\r\n   <span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">perform<\/span> <span style=\"color: #00ff00;\">until<\/span><span style=\"color: #ffffff;\"> W-CPT <\/span><span style=\"color: #00ff00;\">=<\/span> <span style=\"color: #ff0000;\">999999999<\/span><\/span>\r\n<span style=\"font-size: small;\"><span style=\"color: #ffff80;\">*<\/span><span style=\"color: #97b4ff;\">      compute W-TAU-3-6 = W-TAU-2-5<\/span><\/span>\r\n   <span style=\"font-size: small;\">    <span style=\"color: #00ff00;\">move<\/span><span style=\"color: #ffffff;\"> W-TAU-2-5     <\/span><span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-TAU-3-6<\/span><\/span>\r\n   <span style=\"font-size: small;\">    <span style=\"color: #00ff00;\">add<\/span> <span style=\"color: #ff0000;\">1<\/span>              <span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-CPT<\/span><\/span>\r\n<span style=\"font-size: small;\">    <span style=\"color: #00ff00;\">end-perform\r\n<\/span><\/span><\/pre>\n<p>Aujourd&rsquo;hui, j&rsquo;ai voulu savoir ce qui est le mieux \u00e0 utiliser entre un compute et un move pour renseigner un champ. J&rsquo;ai donc ex\u00e9cuter le petit bout de code si dessus.<br \/>\nR\u00e9sultats :<\/p>\n<table width=\"434\">\n<tbody>\n<tr>\n<td width=\"80\"><\/td>\n<td width=\"177\">Temps d&rsquo;ex\u00e9cution<\/td>\n<td width=\"177\">Temps CPU<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\">Move<\/td>\n<td>45.49<\/td>\n<td>1,814<\/td>\n<\/tr>\n<tr>\n<td>35.9<\/td>\n<td>1,81<\/td>\n<\/tr>\n<tr>\n<td>1.05.83<\/td>\n<td>1,818<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"3\">Compute<\/td>\n<td>49.44<\/td>\n<td>2,429<\/td>\n<\/tr>\n<tr>\n<td>38.66<\/td>\n<td>2,421<\/td>\n<\/tr>\n<tr>\n<td>1.16.26<\/td>\n<td>2,441<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Apr\u00e8s 3 ex\u00e9cutions de chaque on distingue bien que le compute mange beaucoup plus de CPU que le move pour le m\u00eame r\u00e9sultat (Ici environ 1\/4 de plus). Conclusion, utiliser les compute seulement en cas de calcul et non pour renseigner une variable.<\/p>\n<p>Mise \u00e0 jour apr\u00e8s un second test qui met sur un pied d&rsquo;\u00e9galit\u00e9 le compute et le move\u00a0(2.500 Temps CPU pour les deux) :<\/p>\n<p><span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">compute<\/span><span style=\"color: #ffffff;\"> W-TAU-2-5 <\/span><span style=\"color: #00ff00;\">=<\/span><span style=\"color: #ffffff;\"> W-TAU-3-6<\/span><\/span><br \/>\n<span style=\"font-size: small;\"> <span style=\"color: #00ff00;\">move<\/span><span style=\"color: #ffffff;\"> W-TAU-3-6 <\/span><span style=\"color: #00ff00;\">to<\/span><span style=\"color: #ffffff;\"> W-TAU-2-5<\/span><\/span><\/p>\n<p>Dans le cas o\u00f9 l&rsquo;on met une zone plus grande dans une zone plus petite le compute et le move on les m\u00eames performances, avec une petite pr\u00e9f\u00e9rence personnelle pour le compute qui \u00e9vite quelques Warning dans ce cas bien pr\u00e9cis. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>WORKING-STORAGE SECTION. 01 WORKING-VAR. 05 W-TAU-3-6 PIC S9(3)V9(6) COMP-3. \u00a0 05 W-TAU-2-5 PIC S9(2)V9(5). 05 W-CPT PIC 9(09). PROCEDURE DIVISION. move 123,123456 to W-TAU-3-6 move 12,12345 to W-TAU-2-5 perform until W-CPT = 999999999 * compute W-TAU-3-6 = W-TAU-2-5 move W-TAU-2-5 to W-TAU-3-6 add 1 to W-CPT end-perform Aujourd&rsquo;hui, j&rsquo;ai voulu savoir ce qui est le &hellip; <a href=\"https:\/\/www.unicoda.com\/?p=1885\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;Performance entre compute et move&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[243,3,40],"tags":[],"class_list":["post-1885","post","type-post","status-publish","format-standard","hentry","category-cobol","category-code","category-info"],"_links":{"self":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1885","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1885"}],"version-history":[{"count":7,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1885\/revisions"}],"predecessor-version":[{"id":1892,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1885\/revisions\/1892"}],"wp:attachment":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}