Construct OperationFloatAdd

Performance Diagrams

Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)1078616488.95192307692307257.0CPython 2.71800927242.31730769230768462.85541784042823Nuitka (main)1800841395.6826923076923462.85738813525006Nuitka (develop)1800841549.0480769230769462.85738813525006Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)1027786588.95192307692307257.0CPython 3.83149221242.31730769230768428.39723121933923Nuitka (main)3149221395.6826923076923428.39723121933923Nuitka (develop)3149221549.0480769230769428.39723121933923Nuitka (factory)Construct OperationFloatAddTicks

Source Code with Construct

module_value1 = 5000.0
module_value2 = 3000.0

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    s = module_value1
    t = module_value2
# construct_begin
    t = s + 1.0
# construct_end

    return s, t, local_value

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

print("OK.")

Source Code without Construct

module_value1 = 5000.0
module_value2 = 3000.0

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    s = module_value1
    t = module_value2
# construct_begin



    return s, t, local_value

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
28     local_value = module_value1 28     local_value = module_value1
29 29
30     s = module_value1 30     s = module_value1
31     t = module_value2 31     t = module_value2
32 # construct_begin 32 # construct_begin
t 33     t = s + 1.0 t 33  
34 # construct_end 34  
35 35
36     return s, t, local_value 36     return s, t, local_value
37 37
38 import itertools 38 import itertools
39 for x in itertools.repeat(None, 50000): 39 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[20]; n 36 static PyObject *mod_consts[19];
37 #ifndef __NUITKA_NO_ASSERT__ 37 #ifndef __NUITKA_NO_ASSERT__
n 38 static Py_hash_t mod_consts_hash[20]; n 38 static Py_hash_t mod_consts_hash[19];
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(&mod_consts[0], UNTRANSLATE("__main__")); 49         loadConstantsBlob(&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 < 20; i++) { n 53         for(int i = 0; i < 19; i++) {
54             mod_consts_hash[i] = DEEP_HASH(mod_consts[i]); 54             mod_consts_hash[i] = DEEP_HASH(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__(void) { 69 void checkModuleConstants___main__(void) {
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 < 20; i++) { n 73     for(int i = 0; i < 19; i++) {
74         assert(mod_consts_hash[i] == DEEP_HASH(mod_consts[i])); 74         assert(mod_consts_hash[i] == DEEP_HASH(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_efcbdbe9fa61cf07509cc28f1e8f4e7e; 82 static PyCodeObject *codeobj_efcbdbe9fa61cf07509cc28f1e8f4e7e;
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_7a7825e015c2c8e703a8c000ebddb901 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[18], NULL, NULL, 0, 0, 0); 88     codeobj_7a7825e015c2c8e703a8c000ebddb901 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[17], NULL, NULL, 0, 0, 0);
89     codeobj_efcbdbe9fa61cf07509cc28f1e8f4e7e = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[10], mod_consts[19], NULL, 0, 0, 0); 89     codeobj_efcbdbe9fa61cf07509cc28f1e8f4e7e = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[9], mod_consts[18], NULL, 0, 0, 0);
90 } 90 }
91 91
92 // The module function declarations. 92 // The module function declarations.
93 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 93 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
94 94
229             goto frame_exception_exit_1; 229             goto frame_exception_exit_1;
230         } 230         }
231         assert(var_t == NULL); 231         assert(var_t == NULL);
232         Py_INCREF(tmp_assign_source_3); 232         Py_INCREF(tmp_assign_source_3);
233         var_t = tmp_assign_source_3; 233         var_t = tmp_assign_source_3;
n 234     } n
235     {
236         PyObject *tmp_assign_source_4;
237         PyObject *tmp_left_value_1;
238         PyObject *tmp_right_value_1;
239         CHECK_OBJECT(var_s);
240         tmp_left_value_1 = var_s;
241         tmp_right_value_1 = mod_consts[2];
242         tmp_assign_source_4 = BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(tmp_left_value_1, tmp_right_value_1);
243         if (tmp_assign_source_4 == NULL) {
244             assert(ERROR_OCCURRED());
245  
246             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
247  
248  
249             exception_lineno = 33;
250             type_description_1 = "ooo";
251             goto frame_exception_exit_1;
252         }
253         {
254             PyObject *old = var_t;
255             assert(old != NULL);
256             var_t = tmp_assign_source_4;
257             Py_DECREF(old);
258         }
259  
260     } 234     }
261 235
262 #if 0 236 #if 0
263     RESTORE_FRAME_EXCEPTION(frame_efcbdbe9fa61cf07509cc28f1e8f4e7e); 237     RESTORE_FRAME_EXCEPTION(frame_efcbdbe9fa61cf07509cc28f1e8f4e7e);
264 #endif 238 #endif
351 325
352     Py_XDECREF(var_local_value); 326     Py_XDECREF(var_local_value);
353     var_local_value = NULL; 327     var_local_value = NULL;
354     Py_XDECREF(var_s); 328     Py_XDECREF(var_s);
355     var_s = NULL; 329     var_s = NULL;
n 356     Py_XDECREF(var_t); n
357     var_t = NULL;
358     // Re-raise. 330     // Re-raise.
359     exception_type = exception_keeper_type_1; 331     exception_type = exception_keeper_type_1;
360     exception_value = exception_keeper_value_1; 332     exception_value = exception_keeper_value_1;
361     exception_tb = exception_keeper_tb_1; 333     exception_tb = exception_keeper_tb_1;
362     exception_lineno = exception_keeper_lineno_1; 334     exception_lineno = exception_keeper_lineno_1;
387 359
388 360
389 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() { 361 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() {
390     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 362     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
391         impl___main__$$$function__1_calledRepeatedly, 363         impl___main__$$$function__1_calledRepeatedly,
n 392         mod_consts[10], n 364         mod_consts[9],
393 #if PYTHON_VERSION >= 0x300 365 #if PYTHON_VERSION >= 0x300
394         NULL, 366         NULL,
395 #endif 367 #endif
396         codeobj_efcbdbe9fa61cf07509cc28f1e8f4e7e, 368         codeobj_efcbdbe9fa61cf07509cc28f1e8f4e7e,
397         NULL, 369         NULL,
772 744
773     // Module code. 745     // Module code.
774     { 746     {
775         PyObject *tmp_assign_source_1; 747         PyObject *tmp_assign_source_1;
776         tmp_assign_source_1 = Py_None; 748         tmp_assign_source_1 = Py_None;
n 777         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 749         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
778     } 750     }
779     { 751     {
780         PyObject *tmp_assign_source_2; 752         PyObject *tmp_assign_source_2;
n 781         tmp_assign_source_2 = mod_consts[4]; n 753         tmp_assign_source_2 = mod_consts[3];
782         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 754         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
783     } 755     }
784     { 756     {
785         PyObject *tmp_assign_source_3; 757         PyObject *tmp_assign_source_3;
786         tmp_assign_source_3 = Py_None; 758         tmp_assign_source_3 = Py_None;
n 787         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 759         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
788     } 760     }
789     { 761     {
790         PyObject *tmp_assign_source_4; 762         PyObject *tmp_assign_source_4;
791         tmp_assign_source_4 = PyDict_New(); 763         tmp_assign_source_4 = PyDict_New();
n 792         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_4); n 764         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4);
793     } 765     }
794     { 766     {
795         PyObject *tmp_assign_source_5; 767         PyObject *tmp_assign_source_5;
n 796         tmp_assign_source_5 = mod_consts[8]; n 768         tmp_assign_source_5 = mod_consts[7];
797         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_5); 769         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_5);
798     } 770     }
799     { 771     {
800         PyObject *tmp_assign_source_6; 772         PyObject *tmp_assign_source_6;
n 801         tmp_assign_source_6 = mod_consts[9]; n 773         tmp_assign_source_6 = mod_consts[8];
802         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6); 774         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6);
803     } 775     }
804     { 776     {
805         PyObject *tmp_assign_source_7; 777         PyObject *tmp_assign_source_7;
806 778
807 779
808         tmp_assign_source_7 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 780         tmp_assign_source_7 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
809 781
n 810         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_7); n 782         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_7);
811     } 783     }
812     { 784     {
813         PyObject *tmp_assign_source_8; 785         PyObject *tmp_assign_source_8;
814         PyObject *tmp_name_value_1; 786         PyObject *tmp_name_value_1;
815         PyObject *tmp_globals_arg_value_1; 787         PyObject *tmp_globals_arg_value_1;
816         PyObject *tmp_locals_arg_value_1; 788         PyObject *tmp_locals_arg_value_1;
817         PyObject *tmp_fromlist_value_1; 789         PyObject *tmp_fromlist_value_1;
818         PyObject *tmp_level_value_1; 790         PyObject *tmp_level_value_1;
n 819         tmp_name_value_1 = mod_consts[11]; n 791         tmp_name_value_1 = mod_consts[10];
820         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 792         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
821         tmp_locals_arg_value_1 = Py_None; 793         tmp_locals_arg_value_1 = Py_None;
822         tmp_fromlist_value_1 = Py_None; 794         tmp_fromlist_value_1 = Py_None;
n 823         tmp_level_value_1 = mod_consts[12]; n 795         tmp_level_value_1 = mod_consts[11];
824         tmp_assign_source_8 = IMPORT_MODULE5(tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1, tmp_level_value_1); 796         tmp_assign_source_8 = IMPORT_MODULE5(tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1, tmp_level_value_1);
825         assert(!(tmp_assign_source_8 == NULL)); 797         assert(!(tmp_assign_source_8 == NULL));
n 826         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_8); n 798         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_8);
827     } 799     }
828     // Frame without reuse. 800     // Frame without reuse.
829     frame_7a7825e015c2c8e703a8c000ebddb901 = MAKE_MODULE_FRAME(codeobj_7a7825e015c2c8e703a8c000ebddb901, module___main__); 801     frame_7a7825e015c2c8e703a8c000ebddb901 = MAKE_MODULE_FRAME(codeobj_7a7825e015c2c8e703a8c000ebddb901, module___main__);
830 802
831     // Push the new frame as the currently active one, and we should be exclusively 803     // Push the new frame as the currently active one, and we should be exclusively
836     // Framed code: 808     // Framed code:
837     { 809     {
838         PyObject *tmp_assign_source_9; 810         PyObject *tmp_assign_source_9;
839         PyObject *tmp_iter_arg_1; 811         PyObject *tmp_iter_arg_1;
840         PyObject *tmp_called_instance_1; 812         PyObject *tmp_called_instance_1;
n 841         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[11]); n 813         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]);
842 814
843         if (unlikely(tmp_called_instance_1 == NULL)) { 815         if (unlikely(tmp_called_instance_1 == NULL)) {
n 844             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[11]); n 816             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]);
845         } 817         }
846 818
847         assert(!(tmp_called_instance_1 == NULL)); 819         assert(!(tmp_called_instance_1 == NULL));
848         frame_7a7825e015c2c8e703a8c000ebddb901->m_frame.f_lineno = 39; 820         frame_7a7825e015c2c8e703a8c000ebddb901->m_frame.f_lineno = 39;
849         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 821         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(
850             tmp_called_instance_1, 822             tmp_called_instance_1,
n 851             mod_consts[13], n 823             mod_consts[12],
852             &PyTuple_GET_ITEM(mod_consts[14], 0) 824             &PyTuple_GET_ITEM(mod_consts[13], 0)
853         ); 825         );
854 826
855         if (tmp_iter_arg_1 == NULL) { 827         if (tmp_iter_arg_1 == NULL) {
856             assert(ERROR_OCCURRED()); 828             assert(ERROR_OCCURRED());
857 829
907     } 879     }
908     { 880     {
909         PyObject *tmp_assign_source_11; 881         PyObject *tmp_assign_source_11;
910         CHECK_OBJECT(tmp_for_loop_1__iter_value); 882         CHECK_OBJECT(tmp_for_loop_1__iter_value);
911         tmp_assign_source_11 = tmp_for_loop_1__iter_value; 883         tmp_assign_source_11 = tmp_for_loop_1__iter_value;
n 912         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[15], tmp_assign_source_11); n 884         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[14], tmp_assign_source_11);
913     } 885     }
914     { 886     {
915         PyObject *tmp_called_value_1; 887         PyObject *tmp_called_value_1;
916         PyObject *tmp_call_result_1; 888         PyObject *tmp_call_result_1;
n 917         tmp_called_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]); n 889         tmp_called_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]);
918 890
919         if (unlikely(tmp_called_value_1 == NULL)) { 891         if (unlikely(tmp_called_value_1 == NULL)) {
n 920             tmp_called_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]); n 892             tmp_called_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[9]);
921         } 893         }
922 894
923         if (tmp_called_value_1 == NULL) { 895         if (tmp_called_value_1 == NULL) {
924             assert(ERROR_OCCURRED()); 896             assert(ERROR_OCCURRED());
925 897
988     Py_DECREF(tmp_for_loop_1__for_iterator); 960     Py_DECREF(tmp_for_loop_1__for_iterator);
989     tmp_for_loop_1__for_iterator = NULL; 961     tmp_for_loop_1__for_iterator = NULL;
990     { 962     {
991         PyObject *tmp_called_value_2; 963         PyObject *tmp_called_value_2;
992         PyObject *tmp_call_result_2; 964         PyObject *tmp_call_result_2;
n 993         tmp_called_value_2 = LOOKUP_BUILTIN(mod_consts[16]); n 965         tmp_called_value_2 = LOOKUP_BUILTIN(mod_consts[15]);
994         assert(tmp_called_value_2 != NULL); 966         assert(tmp_called_value_2 != NULL);
995         frame_7a7825e015c2c8e703a8c000ebddb901->m_frame.f_lineno = 42; 967         frame_7a7825e015c2c8e703a8c000ebddb901->m_frame.f_lineno = 42;
t 996         tmp_call_result_2 = CALL_FUNCTION_WITH_POSARGS1(tmp_called_value_2, mod_consts[17]); t 968         tmp_call_result_2 = CALL_FUNCTION_WITH_POSARGS1(tmp_called_value_2, mod_consts[16]);
997 969
998         if (tmp_call_result_2 == NULL) { 970         if (tmp_call_result_2 == NULL) {
999             assert(ERROR_OCCURRED()); 971             assert(ERROR_OCCURRED());
1000 972
1001             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 973             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);