Construct OperationFloatAdd

Performance Diagrams

Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)1017673488.95192307692307257.0CPython 3.102599579242.31730769230768440.9914035402109Nuitka (main)2600243395.6826923076923440.97528003581505Nuitka (develop)2596486549.0480769230769441.06650896053685Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)977800289.78846153846155257.0CPython 3.83050780244.59615384615387427.0142883917468Nuitka (main)3050159399.4038461538462427.029982666901Nuitka (develop)3006773554.2115384615385428.1264590305715Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)1133426988.95192307692307257.0CPython 2.71899648242.31730769230768462.69831165251014Nuitka (main)1899767395.6826923076923462.69571715517037Nuitka (develop)1899309549.0480769230769462.70570269955385Nuitka (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_1a25f5b2633c6a11ea01bfac25cf27e0; 82 static PyCodeObject *codeobj_1a25f5b2633c6a11ea01bfac25cf27e0;
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_e5a40035cd89d8fe02074b301ae6a8a5 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[14], mod_consts[14], NULL, NULL, 0, 0, 0); 88     codeobj_e5a40035cd89d8fe02074b301ae6a8a5 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[13], mod_consts[13], NULL, NULL, 0, 0, 0);
89     codeobj_main = codeobj_e5a40035cd89d8fe02074b301ae6a8a5; 89     codeobj_main = codeobj_e5a40035cd89d8fe02074b301ae6a8a5;
n 90     codeobj_1a25f5b2633c6a11ea01bfac25cf27e0 = 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_1a25f5b2633c6a11ea01bfac25cf27e0 = 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_1a25f5b2633c6a11ea01bfac25cf27e0, 361         codeobj_1a25f5b2633c6a11ea01bfac25cf27e0,
390         NULL, 362         NULL,
770 742
771     // Module code. 743     // Module code.
772     { 744     {
773         PyObject *tmp_assign_source_1; 745         PyObject *tmp_assign_source_1;
774         tmp_assign_source_1 = Py_None; 746         tmp_assign_source_1 = Py_None;
n 775         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 747         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
776     } 748     }
777     { 749     {
778         PyObject *tmp_assign_source_2; 750         PyObject *tmp_assign_source_2;
n 779         tmp_assign_source_2 = mod_consts[4]; n 751         tmp_assign_source_2 = mod_consts[3];
780         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 752         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
781     } 753     }
782     frame_e5a40035cd89d8fe02074b301ae6a8a5 = MAKE_MODULE_FRAME(codeobj_e5a40035cd89d8fe02074b301ae6a8a5, module___main__); 754     frame_e5a40035cd89d8fe02074b301ae6a8a5 = MAKE_MODULE_FRAME(codeobj_e5a40035cd89d8fe02074b301ae6a8a5, module___main__);
783 755
784     // Push the new frame as the currently active one, and we should be exclusively 756     // Push the new frame as the currently active one, and we should be exclusively
785     // owning it. 757     // owning it.
791         PyObject *tmp_assign_source_3; 763         PyObject *tmp_assign_source_3;
792         PyObject *tmp_name_value_1; 764         PyObject *tmp_name_value_1;
793         PyObject *tmp_globals_arg_value_1; 765         PyObject *tmp_globals_arg_value_1;
794         PyObject *tmp_locals_arg_value_1; 766         PyObject *tmp_locals_arg_value_1;
795         PyObject *tmp_fromlist_value_1; 767         PyObject *tmp_fromlist_value_1;
n 796         tmp_name_value_1 = mod_consts[6]; n 768         tmp_name_value_1 = mod_consts[5];
797         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 769         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
798         tmp_locals_arg_value_1 = Py_None; 770         tmp_locals_arg_value_1 = Py_None;
799         tmp_fromlist_value_1 = Py_None; 771         tmp_fromlist_value_1 = Py_None;
800         frame_e5a40035cd89d8fe02074b301ae6a8a5->m_frame.f_lineno = 4; 772         frame_e5a40035cd89d8fe02074b301ae6a8a5->m_frame.f_lineno = 4;
801         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); 773         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);
807 779
808             exception_lineno = 4; 780             exception_lineno = 4;
809 781
810             goto frame_exception_exit_1; 782             goto frame_exception_exit_1;
811         } 783         }
n 812         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 784         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
813     } 785     }
814     { 786     {
815         PyObject *tmp_assign_source_4; 787         PyObject *tmp_assign_source_4;
n 816         tmp_assign_source_4 = mod_consts[7]; n 788         tmp_assign_source_4 = mod_consts[6];
817         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 789         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
818     } 790     }
819     { 791     {
820         PyObject *tmp_assign_source_5; 792         PyObject *tmp_assign_source_5;
n 821         tmp_assign_source_5 = mod_consts[8]; n 793         tmp_assign_source_5 = mod_consts[7];
822         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); 794         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5);
823     } 795     }
824     { 796     {
825         PyObject *tmp_assign_source_6; 797         PyObject *tmp_assign_source_6;
826 798
827 799
828         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 800         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
829 801
n 830         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_6); n 802         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[8], tmp_assign_source_6);
831     } 803     }
832     { 804     {
833         PyObject *tmp_assign_source_7; 805         PyObject *tmp_assign_source_7;
834         PyObject *tmp_iter_arg_1; 806         PyObject *tmp_iter_arg_1;
835         PyObject *tmp_called_instance_1; 807         PyObject *tmp_called_instance_1;
n 836         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 808         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
837 809
838         if (unlikely(tmp_called_instance_1 == NULL)) { 810         if (unlikely(tmp_called_instance_1 == NULL)) {
n 839             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); n 811             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
840         } 812         }
841 813
842         assert(!(tmp_called_instance_1 == NULL)); 814         assert(!(tmp_called_instance_1 == NULL));
843         frame_e5a40035cd89d8fe02074b301ae6a8a5->m_frame.f_lineno = 25; 815         frame_e5a40035cd89d8fe02074b301ae6a8a5->m_frame.f_lineno = 25;
844         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 816         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(
845             tstate, 817             tstate,
846             tmp_called_instance_1, 818             tmp_called_instance_1,
n 847             mod_consts[10], n 819             mod_consts[9],
848             &PyTuple_GET_ITEM(mod_consts[11], 0) 820             &PyTuple_GET_ITEM(mod_consts[10], 0)
849         ); 821         );
850 822
851         if (tmp_iter_arg_1 == NULL) { 823         if (tmp_iter_arg_1 == NULL) {
852             assert(HAS_ERROR_OCCURRED(tstate)); 824             assert(HAS_ERROR_OCCURRED(tstate));
853 825
903     } 875     }
904     { 876     {
905         PyObject *tmp_assign_source_9; 877         PyObject *tmp_assign_source_9;
906         CHECK_OBJECT(tmp_for_loop_1__iter_value); 878         CHECK_OBJECT(tmp_for_loop_1__iter_value);
907         tmp_assign_source_9 = tmp_for_loop_1__iter_value; 879         tmp_assign_source_9 = tmp_for_loop_1__iter_value;
n 908         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[12], tmp_assign_source_9); n 880         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_9);
909     } 881     }
910     { 882     {
911         PyObject *tmp_called_value_1; 883         PyObject *tmp_called_value_1;
912         PyObject *tmp_call_result_1; 884         PyObject *tmp_call_result_1;
n 913         tmp_called_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]); n 885         tmp_called_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[8]);
914 886
915         if (unlikely(tmp_called_value_1 == NULL)) { 887         if (unlikely(tmp_called_value_1 == NULL)) {
n 916             tmp_called_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[9]); n 888             tmp_called_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[8]);
917         } 889         }
918 890
919         if (tmp_called_value_1 == NULL) { 891         if (tmp_called_value_1 == NULL) {
920             assert(HAS_ERROR_OCCURRED(tstate)); 892             assert(HAS_ERROR_OCCURRED(tstate));
921 893
981     Py_XDECREF(tmp_for_loop_1__iter_value); 953     Py_XDECREF(tmp_for_loop_1__iter_value);
982     tmp_for_loop_1__iter_value = NULL; 954     tmp_for_loop_1__iter_value = NULL;
983     CHECK_OBJECT(tmp_for_loop_1__for_iterator); 955     CHECK_OBJECT(tmp_for_loop_1__for_iterator);
984     Py_DECREF(tmp_for_loop_1__for_iterator); 956     Py_DECREF(tmp_for_loop_1__for_iterator);
985     tmp_for_loop_1__for_iterator = NULL; 957     tmp_for_loop_1__for_iterator = NULL;
t 986     tmp_print_value = mod_consts[13]; t 958     tmp_print_value = mod_consts[12];
987     tmp_result = PRINT_ITEM(tmp_print_value); 959     tmp_result = PRINT_ITEM(tmp_print_value);
988     if (tmp_result == false) { 960     if (tmp_result == false) {
989         assert(HAS_ERROR_OCCURRED(tstate)); 961         assert(HAS_ERROR_OCCURRED(tstate));
990 962
991         FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); 963         FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);