Construct OperationFloatAdd

Performance Diagrams

Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1078616488.95192307692307257.0CPython 2.71800837242.31730769230768462.8574797768697Nuitka (master)1800866395.6826923076923462.85681537512744Nuitka (develop)1800866549.0480769230769462.85681537512744Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)1027786588.95192307692307257.0CPython 3.83151008242.31730769230768428.3542655652557Nuitka (master)3150989395.6826923076923428.35472239090063Nuitka (develop)3150989549.0480769230769428.35472239090063Nuitka (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_c17a868ac4e7f8c79c5103e3b1f9a2bb; 82 static PyCodeObject *codeobj_c17a868ac4e7f8c79c5103e3b1f9a2bb;
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_0126e787b9ec1d08562c50299899d6ba = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[18], NULL, NULL, 0, 0, 0); 88     codeobj_0126e787b9ec1d08562c50299899d6ba = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[17], NULL, NULL, 0, 0, 0);
89     codeobj_c17a868ac4e7f8c79c5103e3b1f9a2bb = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[10], mod_consts[19], NULL, 0, 0, 0); 89     codeobj_c17a868ac4e7f8c79c5103e3b1f9a2bb = 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_name_1;
238         PyObject *tmp_right_name_1;
239         CHECK_OBJECT(var_s);
240         tmp_left_name_1 = var_s;
241         tmp_right_name_1 = mod_consts[2];
242         tmp_assign_source_4 = BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(tmp_left_name_1, tmp_right_name_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_c17a868ac4e7f8c79c5103e3b1f9a2bb); 237     RESTORE_FRAME_EXCEPTION(frame_c17a868ac4e7f8c79c5103e3b1f9a2bb);
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_c17a868ac4e7f8c79c5103e3b1f9a2bb, 368         codeobj_c17a868ac4e7f8c79c5103e3b1f9a2bb,
397         NULL, 369         NULL,
767 739
768     // Module code. 740     // Module code.
769     { 741     {
770         PyObject *tmp_assign_source_1; 742         PyObject *tmp_assign_source_1;
771         tmp_assign_source_1 = Py_None; 743         tmp_assign_source_1 = Py_None;
n 772         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 744         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
773     } 745     }
774     { 746     {
775         PyObject *tmp_assign_source_2; 747         PyObject *tmp_assign_source_2;
n 776         tmp_assign_source_2 = mod_consts[4]; n 748         tmp_assign_source_2 = mod_consts[3];
777         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 749         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
778     } 750     }
779     { 751     {
780         PyObject *tmp_assign_source_3; 752         PyObject *tmp_assign_source_3;
781         tmp_assign_source_3 = Py_None; 753         tmp_assign_source_3 = Py_None;
n 782         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 754         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
783     } 755     }
784     { 756     {
785         PyObject *tmp_assign_source_4; 757         PyObject *tmp_assign_source_4;
786         tmp_assign_source_4 = PyDict_New(); 758         tmp_assign_source_4 = PyDict_New();
n 787         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_4); n 759         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4);
788     } 760     }
789     { 761     {
790         PyObject *tmp_assign_source_5; 762         PyObject *tmp_assign_source_5;
n 791         tmp_assign_source_5 = mod_consts[8]; n 763         tmp_assign_source_5 = mod_consts[7];
792         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_5); 764         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_5);
793     } 765     }
794     { 766     {
795         PyObject *tmp_assign_source_6; 767         PyObject *tmp_assign_source_6;
n 796         tmp_assign_source_6 = mod_consts[9]; n 768         tmp_assign_source_6 = mod_consts[8];
797         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6); 769         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6);
798     } 770     }
799     { 771     {
800         PyObject *tmp_assign_source_7; 772         PyObject *tmp_assign_source_7;
801 773
802 774
803         tmp_assign_source_7 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 775         tmp_assign_source_7 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
804 776
n 805         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_7); n 777         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_7);
806     } 778     }
807     { 779     {
808         PyObject *tmp_assign_source_8; 780         PyObject *tmp_assign_source_8;
809         PyObject *tmp_name_name_1; 781         PyObject *tmp_name_name_1;
810         PyObject *tmp_globals_arg_name_1; 782         PyObject *tmp_globals_arg_name_1;
811         PyObject *tmp_locals_arg_name_1; 783         PyObject *tmp_locals_arg_name_1;
812         PyObject *tmp_fromlist_name_1; 784         PyObject *tmp_fromlist_name_1;
813         PyObject *tmp_level_name_1; 785         PyObject *tmp_level_name_1;
n 814         tmp_name_name_1 = mod_consts[11]; n 786         tmp_name_name_1 = mod_consts[10];
815         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__; 787         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__;
816         tmp_locals_arg_name_1 = Py_None; 788         tmp_locals_arg_name_1 = Py_None;
817         tmp_fromlist_name_1 = Py_None; 789         tmp_fromlist_name_1 = Py_None;
n 818         tmp_level_name_1 = mod_consts[12]; n 790         tmp_level_name_1 = mod_consts[11];
819         tmp_assign_source_8 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_arg_name_1, tmp_locals_arg_name_1, tmp_fromlist_name_1, tmp_level_name_1); 791         tmp_assign_source_8 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_arg_name_1, tmp_locals_arg_name_1, tmp_fromlist_name_1, tmp_level_name_1);
820         assert(!(tmp_assign_source_8 == NULL)); 792         assert(!(tmp_assign_source_8 == NULL));
n 821         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_8); n 793         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_8);
822     } 794     }
823     // Frame without reuse. 795     // Frame without reuse.
824     frame_0126e787b9ec1d08562c50299899d6ba = MAKE_MODULE_FRAME(codeobj_0126e787b9ec1d08562c50299899d6ba, module___main__); 796     frame_0126e787b9ec1d08562c50299899d6ba = MAKE_MODULE_FRAME(codeobj_0126e787b9ec1d08562c50299899d6ba, module___main__);
825 797
826     // Push the new frame as the currently active one, and we should be exclusively 798     // Push the new frame as the currently active one, and we should be exclusively
831     // Framed code: 803     // Framed code:
832     { 804     {
833         PyObject *tmp_assign_source_9; 805         PyObject *tmp_assign_source_9;
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[11]); n 808         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]);
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(mod_consts[11]); n 811             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]);
840         } 812         }
841 813
842         assert(!(tmp_called_instance_1 == NULL)); 814         assert(!(tmp_called_instance_1 == NULL));
843         frame_0126e787b9ec1d08562c50299899d6ba->m_frame.f_lineno = 39; 815         frame_0126e787b9ec1d08562c50299899d6ba->m_frame.f_lineno = 39;
844         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 816         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(
845             tmp_called_instance_1, 817             tmp_called_instance_1,
n 846             mod_consts[13], n 818             mod_consts[12],
847             &PyTuple_GET_ITEM(mod_consts[14], 0) 819             &PyTuple_GET_ITEM(mod_consts[13], 0)
848         ); 820         );
849 821
850         if (tmp_iter_arg_1 == NULL) { 822         if (tmp_iter_arg_1 == NULL) {
851             assert(ERROR_OCCURRED()); 823             assert(ERROR_OCCURRED());
852 824
902     } 874     }
903     { 875     {
904         PyObject *tmp_assign_source_11; 876         PyObject *tmp_assign_source_11;
905         CHECK_OBJECT(tmp_for_loop_1__iter_value); 877         CHECK_OBJECT(tmp_for_loop_1__iter_value);
906         tmp_assign_source_11 = tmp_for_loop_1__iter_value; 878         tmp_assign_source_11 = tmp_for_loop_1__iter_value;
n 907         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[15], tmp_assign_source_11); n 879         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[14], tmp_assign_source_11);
908     } 880     }
909     { 881     {
910         PyObject *tmp_called_name_1; 882         PyObject *tmp_called_name_1;
911         PyObject *tmp_call_result_1; 883         PyObject *tmp_call_result_1;
n 912         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]); n 884         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]);
913 885
914         if (unlikely(tmp_called_name_1 == NULL)) { 886         if (unlikely(tmp_called_name_1 == NULL)) {
n 915             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]); n 887             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[9]);
916         } 888         }
917 889
918         if (tmp_called_name_1 == NULL) { 890         if (tmp_called_name_1 == NULL) {
919             assert(ERROR_OCCURRED()); 891             assert(ERROR_OCCURRED());
920 892
983     Py_DECREF(tmp_for_loop_1__for_iterator); 955     Py_DECREF(tmp_for_loop_1__for_iterator);
984     tmp_for_loop_1__for_iterator = NULL; 956     tmp_for_loop_1__for_iterator = NULL;
985     { 957     {
986         PyObject *tmp_called_name_2; 958         PyObject *tmp_called_name_2;
987         PyObject *tmp_call_result_2; 959         PyObject *tmp_call_result_2;
n 988         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[16]); n 960         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[15]);
989         assert(tmp_called_name_2 != NULL); 961         assert(tmp_called_name_2 != NULL);
990         frame_0126e787b9ec1d08562c50299899d6ba->m_frame.f_lineno = 42; 962         frame_0126e787b9ec1d08562c50299899d6ba->m_frame.f_lineno = 42;
t 991         tmp_call_result_2 = CALL_FUNCTION_WITH_POSARGS1(tmp_called_name_2, mod_consts[17]); t 963         tmp_call_result_2 = CALL_FUNCTION_WITH_POSARGS1(tmp_called_name_2, mod_consts[16]);
992 964
993         if (tmp_call_result_2 == NULL) { 965         if (tmp_call_result_2 == NULL) {
994             assert(ERROR_OCCURRED()); 966             assert(ERROR_OCCURRED());
995 967
996             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 968             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);