Construct OperationFloatAdd

Performance Diagrams

Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)1017673488.95192307692307257.0CPython 3.102549686242.31730769230768442.20292463181215Nuitka (main)2549323395.6826923076923442.2117391379804Nuitka (develop)2549511549.0480769230769442.20717404938637Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)977800289.78846153846155257.0CPython 3.83049021244.59615384615387427.0587428683913Nuitka (main)3048926399.4038461538462427.06114376394623Nuitka (develop)3049560554.2115384615385427.0451209451898Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)1133426988.95192307692307257.0CPython 2.71901223242.31730769230768462.66397271713026Nuitka (main)1901223395.6826923076923462.66397271713026Nuitka (develop)1901223549.0480769230769462.66397271713026Nuitka (factory)Construct OperationFloatAddTicks

Source Code with Construct

    # construct_end

    return s, t, local_value


for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

#     Python test originally created or extracted from other peoples work. The
#     parts from me are licensed as below. It is at least Free Software where
#     it's copied from other people. In these cases, that will normally be
#     indicated.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

Source Code without Construct

    return s, t, local_value


for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

#     Python test originally created or extracted from other peoples work. The
#     parts from me are licensed as below. It is at least Free Software where
#     it's copied from other people. In these cases, that will normally be
#     indicated.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

Context Diff of Source Code


Construct
Baseline
14     local_value = module_value1 14     local_value = module_value1
15 15
16     s = module_value1 16     s = module_value1
17     t = module_value2 17     t = module_value2
18     # construct_begin 18     # construct_begin
t 19     t = s + 1.0 t 19  
20     # construct_end 20  
21 21
22     return s, t, local_value 22     return s, t, local_value
23 23
24 24
25 for x in itertools.repeat(None, 50000): 25 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
31 31
32 PyObject *module___main__; 32 PyObject *module___main__;
33 PyDictObject *moduledict___main__; 33 PyDictObject *moduledict___main__;
34 34
35 /* The declarations of module constants used, if any. */ 35 /* The declarations of module constants used, if any. */
n 36 static PyObject *mod_consts[16]; n 36 static PyObject *mod_consts[15];
37 #ifndef __NUITKA_NO_ASSERT__ 37 #ifndef __NUITKA_NO_ASSERT__
n 38 static Py_hash_t mod_consts_hash[16]; n 38 static Py_hash_t mod_consts_hash[15];
39 #endif 39 #endif
40 40
41 static PyObject *module_filename_obj = NULL; 41 static PyObject *module_filename_obj = NULL;
42 42
43 /* Indicator if this modules private constants were created yet. */ 43 /* Indicator if this modules private constants were created yet. */
48     if (constants_created == false) { 48     if (constants_created == false) {
49         loadConstantsBlob(tstate, &mod_consts[0], UNTRANSLATE("__main__")); 49         loadConstantsBlob(tstate, &mod_consts[0], UNTRANSLATE("__main__"));
50         constants_created = true; 50         constants_created = true;
51 51
52 #ifndef __NUITKA_NO_ASSERT__ 52 #ifndef __NUITKA_NO_ASSERT__
n 53         for (int i = 0; i < 16; i++) { n 53         for (int i = 0; i < 15; i++) {
54             mod_consts_hash[i] = DEEP_HASH(tstate, mod_consts[i]); 54             mod_consts_hash[i] = DEEP_HASH(tstate, mod_consts[i]);
55         } 55         }
56 #endif 56 #endif
57     } 57     }
58 } 58 }
68 #ifndef __NUITKA_NO_ASSERT__ 68 #ifndef __NUITKA_NO_ASSERT__
69 void checkModuleConstants___main__(PyThreadState *tstate) { 69 void checkModuleConstants___main__(PyThreadState *tstate) {
70     // The module may not have been used at all, then ignore this. 70     // The module may not have been used at all, then ignore this.
71     if (constants_created == false) return; 71     if (constants_created == false) return;
72 72
n 73     for (int i = 0; i < 16; i++) { n 73     for (int i = 0; i < 15; i++) {
74         assert(mod_consts_hash[i] == DEEP_HASH(tstate, mod_consts[i])); 74         assert(mod_consts_hash[i] == DEEP_HASH(tstate, mod_consts[i]));
75         CHECK_OBJECT_DEEP(mod_consts[i]); 75         CHECK_OBJECT_DEEP(mod_consts[i]);
76     } 76     }
77 } 77 }
78 #endif 78 #endif
82 static PyCodeObject *codeobj_b1e49b71cab4de7f310d9f5605260c9a; 82 static PyCodeObject *codeobj_b1e49b71cab4de7f310d9f5605260c9a;
83 /* For use in "MainProgram.c". */ 83 /* For use in "MainProgram.c". */
84 PyCodeObject *codeobj_main = NULL; 84 PyCodeObject *codeobj_main = NULL;
85 85
86 static void createModuleCodeObjects(void) { 86 static void createModuleCodeObjects(void) {
n 87     module_filename_obj = mod_consts[4]; CHECK_OBJECT(module_filename_obj); n 87     module_filename_obj = mod_consts[3]; CHECK_OBJECT(module_filename_obj);
88     codeobj_4b65cf76ac9bb14844846c01d168ed32 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[14], mod_consts[14], NULL, NULL, 0, 0, 0); 88     codeobj_4b65cf76ac9bb14844846c01d168ed32 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[13], mod_consts[13], NULL, NULL, 0, 0, 0);
89     codeobj_main = codeobj_4b65cf76ac9bb14844846c01d168ed32; 89     codeobj_main = codeobj_4b65cf76ac9bb14844846c01d168ed32;
n 90     codeobj_b1e49b71cab4de7f310d9f5605260c9a = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[9], mod_consts[9], mod_consts[15], NULL, 0, 0, 0); n 90     codeobj_b1e49b71cab4de7f310d9f5605260c9a = MAKE_CODE_OBJECT(module_filename_obj, 10, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[8], mod_consts[14], NULL, 0, 0, 0);
91 } 91 }
92 92
93 // The module function declarations. 93 // The module function declarations.
94 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 94 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
95 95
230             goto frame_exception_exit_1; 230             goto frame_exception_exit_1;
231         } 231         }
232         assert(var_t == NULL); 232         assert(var_t == NULL);
233         Py_INCREF(tmp_assign_source_3); 233         Py_INCREF(tmp_assign_source_3);
234         var_t = tmp_assign_source_3; 234         var_t = tmp_assign_source_3;
n 235     } n
236     {
237         PyObject *tmp_assign_source_4;
238         PyObject *tmp_add_expr_left_1;
239         PyObject *tmp_add_expr_right_1;
240         CHECK_OBJECT(var_s);
241         tmp_add_expr_left_1 = var_s;
242         tmp_add_expr_right_1 = mod_consts[2];
243         tmp_assign_source_4 = BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(tmp_add_expr_left_1, tmp_add_expr_right_1);
244         if (tmp_assign_source_4 == NULL) {
245             assert(HAS_ERROR_OCCURRED(tstate));
246  
247             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
248  
249  
250             exception_lineno = 19;
251             type_description_1 = "ooo";
252             goto frame_exception_exit_1;
253         }
254         {
255             PyObject *old = var_t;
256             assert(old != NULL);
257             var_t = tmp_assign_source_4;
258             Py_DECREF(old);
259         }
260  
261     } 235     }
262 236
263 237
264     // Put the previous frame back on top. 238     // Put the previous frame back on top.
265     popFrameStack(tstate); 239     popFrameStack(tstate);
343 317
344     Py_XDECREF(var_local_value); 318     Py_XDECREF(var_local_value);
345     var_local_value = NULL; 319     var_local_value = NULL;
346     Py_XDECREF(var_s); 320     Py_XDECREF(var_s);
347     var_s = NULL; 321     var_s = NULL;
n 348     Py_XDECREF(var_t); n
349     var_t = NULL;
350     // Re-raise. 322     // Re-raise.
351     exception_type = exception_keeper_type_1; 323     exception_type = exception_keeper_type_1;
352     exception_value = exception_keeper_value_1; 324     exception_value = exception_keeper_value_1;
353     exception_tb = exception_keeper_tb_1; 325     exception_tb = exception_keeper_tb_1;
354     exception_lineno = exception_keeper_lineno_1; 326     exception_lineno = exception_keeper_lineno_1;
380 352
381 353
382 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() { 354 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() {
383     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 355     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
384         impl___main__$$$function__1_calledRepeatedly, 356         impl___main__$$$function__1_calledRepeatedly,
n 385         mod_consts[9], n 357         mod_consts[8],
386 #if PYTHON_VERSION >= 0x300 358 #if PYTHON_VERSION >= 0x300
387         NULL, 359         NULL,
388 #endif 360 #endif
389         codeobj_b1e49b71cab4de7f310d9f5605260c9a, 361         codeobj_b1e49b71cab4de7f310d9f5605260c9a,
390         NULL, 362         NULL,
762 734
763     // Module code. 735     // Module code.
764     { 736     {
765         PyObject *tmp_assign_source_1; 737         PyObject *tmp_assign_source_1;
766         tmp_assign_source_1 = Py_None; 738         tmp_assign_source_1 = Py_None;
n 767         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 739         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
768     } 740     }
769     { 741     {
770         PyObject *tmp_assign_source_2; 742         PyObject *tmp_assign_source_2;
n 771         tmp_assign_source_2 = mod_consts[4]; n 743         tmp_assign_source_2 = mod_consts[3];
772         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 744         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
773     } 745     }
774     frame_4b65cf76ac9bb14844846c01d168ed32 = MAKE_MODULE_FRAME(codeobj_4b65cf76ac9bb14844846c01d168ed32, module___main__); 746     frame_4b65cf76ac9bb14844846c01d168ed32 = MAKE_MODULE_FRAME(codeobj_4b65cf76ac9bb14844846c01d168ed32, module___main__);
775 747
776     // Push the new frame as the currently active one, and we should be exclusively 748     // Push the new frame as the currently active one, and we should be exclusively
777     // owning it. 749     // owning it.
783         PyObject *tmp_assign_source_3; 755         PyObject *tmp_assign_source_3;
784         PyObject *tmp_name_value_1; 756         PyObject *tmp_name_value_1;
785         PyObject *tmp_globals_arg_value_1; 757         PyObject *tmp_globals_arg_value_1;
786         PyObject *tmp_locals_arg_value_1; 758         PyObject *tmp_locals_arg_value_1;
787         PyObject *tmp_fromlist_value_1; 759         PyObject *tmp_fromlist_value_1;
n 788         tmp_name_value_1 = mod_consts[6]; n 760         tmp_name_value_1 = mod_consts[5];
789         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 761         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
790         tmp_locals_arg_value_1 = Py_None; 762         tmp_locals_arg_value_1 = Py_None;
791         tmp_fromlist_value_1 = Py_None; 763         tmp_fromlist_value_1 = Py_None;
792         frame_4b65cf76ac9bb14844846c01d168ed32->m_frame.f_lineno = 4; 764         frame_4b65cf76ac9bb14844846c01d168ed32->m_frame.f_lineno = 4;
793         tmp_assign_source_3 = IMPORT_MODULE4(tstate, tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1); 765         tmp_assign_source_3 = IMPORT_MODULE4(tstate, tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1);
799 771
800             exception_lineno = 4; 772             exception_lineno = 4;
801 773
802             goto frame_exception_exit_1; 774             goto frame_exception_exit_1;
803         } 775         }
n 804         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 776         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
805     } 777     }
806     { 778     {
807         PyObject *tmp_assign_source_4; 779         PyObject *tmp_assign_source_4;
n 808         tmp_assign_source_4 = mod_consts[7]; n 780         tmp_assign_source_4 = mod_consts[6];
809         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 781         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
810     } 782     }
811     { 783     {
812         PyObject *tmp_assign_source_5; 784         PyObject *tmp_assign_source_5;
n 813         tmp_assign_source_5 = mod_consts[8]; n 785         tmp_assign_source_5 = mod_consts[7];
814         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); 786         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5);
815     } 787     }
816     { 788     {
817         PyObject *tmp_assign_source_6; 789         PyObject *tmp_assign_source_6;
818 790
819 791
820         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 792         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
821 793
n 822         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_6); n 794         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[8], tmp_assign_source_6);
823     } 795     }
824     { 796     {
825         PyObject *tmp_assign_source_7; 797         PyObject *tmp_assign_source_7;
826         PyObject *tmp_iter_arg_1; 798         PyObject *tmp_iter_arg_1;
827         PyObject *tmp_called_instance_1; 799         PyObject *tmp_called_instance_1;
n 828         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 800         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
829 801
830         if (unlikely(tmp_called_instance_1 == NULL)) { 802         if (unlikely(tmp_called_instance_1 == NULL)) {
n 831             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); n 803             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
832         } 804         }
833 805
834         assert(!(tmp_called_instance_1 == NULL)); 806         assert(!(tmp_called_instance_1 == NULL));
835         frame_4b65cf76ac9bb14844846c01d168ed32->m_frame.f_lineno = 25; 807         frame_4b65cf76ac9bb14844846c01d168ed32->m_frame.f_lineno = 25;
836         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 808         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(
837             tstate, 809             tstate,
838             tmp_called_instance_1, 810             tmp_called_instance_1,
n 839             mod_consts[10], n 811             mod_consts[9],
840             &PyTuple_GET_ITEM(mod_consts[11], 0) 812             &PyTuple_GET_ITEM(mod_consts[10], 0)
841         ); 813         );
842 814
843         if (tmp_iter_arg_1 == NULL) { 815         if (tmp_iter_arg_1 == NULL) {
844             assert(HAS_ERROR_OCCURRED(tstate)); 816             assert(HAS_ERROR_OCCURRED(tstate));
845 817
895     } 867     }
896     { 868     {
897         PyObject *tmp_assign_source_9; 869         PyObject *tmp_assign_source_9;
898         CHECK_OBJECT(tmp_for_loop_1__iter_value); 870         CHECK_OBJECT(tmp_for_loop_1__iter_value);
899         tmp_assign_source_9 = tmp_for_loop_1__iter_value; 871         tmp_assign_source_9 = tmp_for_loop_1__iter_value;
n 900         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[12], tmp_assign_source_9); n 872         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_9);
901     } 873     }
902     { 874     {
903         PyObject *tmp_called_value_1; 875         PyObject *tmp_called_value_1;
904         PyObject *tmp_call_result_1; 876         PyObject *tmp_call_result_1;
n 905         tmp_called_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]); n 877         tmp_called_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[8]);
906 878
907         if (unlikely(tmp_called_value_1 == NULL)) { 879         if (unlikely(tmp_called_value_1 == NULL)) {
n 908             tmp_called_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[9]); n 880             tmp_called_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[8]);
909         } 881         }
910 882
911         if (tmp_called_value_1 == NULL) { 883         if (tmp_called_value_1 == NULL) {
912             assert(HAS_ERROR_OCCURRED(tstate)); 884             assert(HAS_ERROR_OCCURRED(tstate));
913 885
973     Py_XDECREF(tmp_for_loop_1__iter_value); 945     Py_XDECREF(tmp_for_loop_1__iter_value);
974     tmp_for_loop_1__iter_value = NULL; 946     tmp_for_loop_1__iter_value = NULL;
975     CHECK_OBJECT(tmp_for_loop_1__for_iterator); 947     CHECK_OBJECT(tmp_for_loop_1__for_iterator);
976     Py_DECREF(tmp_for_loop_1__for_iterator); 948     Py_DECREF(tmp_for_loop_1__for_iterator);
977     tmp_for_loop_1__for_iterator = NULL; 949     tmp_for_loop_1__for_iterator = NULL;
t 978     tmp_print_value = mod_consts[13]; t 950     tmp_print_value = mod_consts[12];
979     tmp_result = PRINT_ITEM(tmp_print_value); 951     tmp_result = PRINT_ITEM(tmp_print_value);
980     if (tmp_result == false) { 952     if (tmp_result == false) {
981         assert(HAS_ERROR_OCCURRED(tstate)); 953         assert(HAS_ERROR_OCCURRED(tstate));
982 954
983         FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); 955         FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);