Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1177851288.95192307692307257.0CPython 2.7850973242.31730769230768486.2618119236637Nuitka (master)850973395.6826923076923486.2618119236637Nuitka (develop)850973549.0480769230769486.2618119236637Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1117227488.95192307692307257.0CPython 3.5951150242.31730769230768483.07725056345186Nuitka (master)951150395.6826923076923483.07725056345186Nuitka (develop)951150549.0480769230769483.07725056345186Nuitka (factory)Construct InplaceOperationFloatAddTicks

Source Code with Construct

module_value1 = 5.0
module_value2 = 3.0

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

    # Make sure we have a local variable s anyway
    s = 2.0

    local_value = module_value1

    s += module_value1
# construct_begin
    s += 1000.0
# construct_end
    s += module_value2

    return s

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

print("OK.")

Source Code without Construct

module_value1 = 5.0
module_value2 = 3.0

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

    # Make sure we have a local variable s anyway
    s = 2.0

    local_value = module_value1

    s += module_value1
# construct_begin


    s += module_value2

    return s

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
30 30
31     local_value = module_value1 31     local_value = module_value1
32 32
33     s += module_value1 33     s += module_value1
34 # construct_begin 34 # construct_begin
t 35     s += 1000.0 t 35  
36 # construct_end 36  
37     s += module_value2 37     s += module_value2
38 38
39     return s 39     return s
40 40
41 import itertools 41 import itertools

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 37
38 static PyObject *module_filename_obj = NULL; 38 static PyObject *module_filename_obj = NULL;
39 39
40 /* Indicator if this modules private constants were created yet. */ 40 /* Indicator if this modules private constants were created yet. */
41 static bool constants_created = false; 41 static bool constants_created = false;
42 42
43 /* Function to create module private constants. */ 43 /* Function to create module private constants. */
44 static void createModuleConstants(void) { 44 static void createModuleConstants(void) {
n 45     loadConstantsBlob(&mod_consts[0], "__main__", 20); n 45     loadConstantsBlob(&mod_consts[0], "__main__", 19);
46 46
47     constants_created = true; 47     constants_created = true;
48 } 48 }
49 49
50 /* For multiprocessing, we want to be able to initialize the __main__ constants. */ 50 /* For multiprocessing, we want to be able to initialize the __main__ constants. */
58 #ifndef __NUITKA_NO_ASSERT__ 58 #ifndef __NUITKA_NO_ASSERT__
59 void checkModuleConstants___main__(void) { 59 void checkModuleConstants___main__(void) {
60     // The module may not have been used at all, then ignore this. 60     // The module may not have been used at all, then ignore this.
61     if (constants_created == false) return; 61     if (constants_created == false) return;
62 62
n 63     checkConstantsBlob(&mod_consts[0], "__main__", 20); n 63     checkConstantsBlob(&mod_consts[0], "__main__", 19);
64 } 64 }
65 #endif 65 #endif
66 66
67 // The module code objects. 67 // The module code objects.
68 static PyCodeObject *codeobj_b66f15575242b65fe0bd01d0498e1439; 68 static PyCodeObject *codeobj_b66f15575242b65fe0bd01d0498e1439;
69 static PyCodeObject *codeobj_85de8085a3f343cd83b57c58ad108f5b; 69 static PyCodeObject *codeobj_85de8085a3f343cd83b57c58ad108f5b;
70 /* For use in "MainProgram.c". */ 70 /* For use in "MainProgram.c". */
71 PyCodeObject *codeobj_main = NULL; 71 PyCodeObject *codeobj_main = NULL;
72 72
73 static void createModuleCodeObjects(void) { 73 static void createModuleCodeObjects(void) {
n 74     module_filename_obj = mod_consts[5]; CHECK_OBJECT(module_filename_obj); n 74     module_filename_obj = mod_consts[4]; CHECK_OBJECT(module_filename_obj);
75     codeobj_b66f15575242b65fe0bd01d0498e1439 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[18], NULL, NULL, 0, 0, 0); 75     codeobj_b66f15575242b65fe0bd01d0498e1439 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[17], NULL, NULL, 0, 0, 0);
76     codeobj_85de8085a3f343cd83b57c58ad108f5b = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[10], mod_consts[19], NULL, 0, 0, 0); 76     codeobj_85de8085a3f343cd83b57c58ad108f5b = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[9], mod_consts[18], NULL, 0, 0, 0);
77 } 77 }
78 78
79 // The module function declarations. 79 // The module function declarations.
80 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 80 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
81 81
223         PyObject *tmp_assign_source_4; 223         PyObject *tmp_assign_source_4;
224         PyObject *tmp_left_name_2; 224         PyObject *tmp_left_name_2;
225         PyObject *tmp_right_name_2; 225         PyObject *tmp_right_name_2;
226         CHECK_OBJECT(var_s); 226         CHECK_OBJECT(var_s);
227         tmp_left_name_2 = var_s; 227         tmp_left_name_2 = var_s;
n 228         tmp_right_name_2 = mod_consts[2]; n
229         tmp_result = BINARY_OPERATION_ADD_OBJECT_FLOAT_INPLACE(&tmp_left_name_2, tmp_right_name_2);
230         if (tmp_result == false) {
231             assert(ERROR_OCCURRED());
232  
233             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
234  
235  
236             exception_lineno = 35;
237             type_description_1 = "oo";
238             goto frame_exception_exit_1;
239         }
240         tmp_assign_source_4 = tmp_left_name_2;
241         var_s = tmp_assign_source_4;
242  
243     }
244     {
245         PyObject *tmp_assign_source_5;
246         PyObject *tmp_left_name_3;
247         PyObject *tmp_right_name_3;
248         CHECK_OBJECT(var_s);
249         tmp_left_name_3 = var_s;
250         tmp_right_name_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[3]); 228         tmp_right_name_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[2]);
251 229
n 252         if (unlikely(tmp_right_name_3 == NULL)) { n 230         if (unlikely(tmp_right_name_2 == NULL)) {
253             tmp_right_name_3 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[3]); 231             tmp_right_name_2 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[2]);
254         } 232         }
255 233
n 256         if (tmp_right_name_3 == NULL) { n 234         if (tmp_right_name_2 == NULL) {
257             assert(ERROR_OCCURRED()); 235             assert(ERROR_OCCURRED());
258 236
259             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 237             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
260 238
261 239
262             exception_lineno = 37; 240             exception_lineno = 37;
263             type_description_1 = "oo"; 241             type_description_1 = "oo";
264             goto frame_exception_exit_1; 242             goto frame_exception_exit_1;
265         } 243         }
n 266         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_3, tmp_right_name_3); n 244         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_2, tmp_right_name_2);
267         if (tmp_result == false) { 245         if (tmp_result == false) {
268             assert(ERROR_OCCURRED()); 246             assert(ERROR_OCCURRED());
269 247
270             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 248             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
271 249
272 250
273             exception_lineno = 37; 251             exception_lineno = 37;
274             type_description_1 = "oo"; 252             type_description_1 = "oo";
275             goto frame_exception_exit_1; 253             goto frame_exception_exit_1;
276         } 254         }
n 277         tmp_assign_source_5 = tmp_left_name_3; n 255         tmp_assign_source_4 = tmp_left_name_2;
278         var_s = tmp_assign_source_5; 256         var_s = tmp_assign_source_4;
279 257
280     } 258     }
281 259
282 #if 0 260 #if 0
283     RESTORE_FRAME_EXCEPTION(frame_85de8085a3f343cd83b57c58ad108f5b); 261     RESTORE_FRAME_EXCEPTION(frame_85de8085a3f343cd83b57c58ad108f5b);
391 369
392 370
393 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() { 371 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() {
394     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 372     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
395         impl___main__$$$function__1_calledRepeatedly, 373         impl___main__$$$function__1_calledRepeatedly,
n 396         mod_consts[10], n 374         mod_consts[9],
397 #if PYTHON_VERSION >= 0x300 375 #if PYTHON_VERSION >= 0x300
398         NULL, 376         NULL,
399 #endif 377 #endif
400         codeobj_85de8085a3f343cd83b57c58ad108f5b, 378         codeobj_85de8085a3f343cd83b57c58ad108f5b,
401         NULL, 379         NULL,
801 779
802     // Module code. 780     // Module code.
803     { 781     {
804         PyObject *tmp_assign_source_1; 782         PyObject *tmp_assign_source_1;
805         tmp_assign_source_1 = Py_None; 783         tmp_assign_source_1 = Py_None;
n 806         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_1); n 784         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1);
807     } 785     }
808     { 786     {
809         PyObject *tmp_assign_source_2; 787         PyObject *tmp_assign_source_2;
n 810         tmp_assign_source_2 = mod_consts[5]; n 788         tmp_assign_source_2 = mod_consts[4];
811         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_2); 789         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2);
812     } 790     }
813     { 791     {
814         PyObject *tmp_assign_source_3; 792         PyObject *tmp_assign_source_3;
815         tmp_assign_source_3 = Py_None; 793         tmp_assign_source_3 = Py_None;
n 816         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_3); n 794         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3);
817     } 795     }
818     { 796     {
819         PyObject *tmp_assign_source_4; 797         PyObject *tmp_assign_source_4;
n 820         tmp_assign_source_4 = mod_consts[8]; n 798         tmp_assign_source_4 = mod_consts[7];
821         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 799         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
822     } 800     }
823     { 801     {
824         PyObject *tmp_assign_source_5; 802         PyObject *tmp_assign_source_5;
n 825         tmp_assign_source_5 = mod_consts[9]; n 803         tmp_assign_source_5 = mod_consts[8];
826         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_5); 804         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_5);
827     } 805     }
828     { 806     {
829         PyObject *tmp_assign_source_6; 807         PyObject *tmp_assign_source_6;
830 808
831 809
832         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 810         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
833 811
n 834         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_6); n 812         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_6);
835     } 813     }
836     { 814     {
837         PyObject *tmp_assign_source_7; 815         PyObject *tmp_assign_source_7;
838         PyObject *tmp_name_name_1; 816         PyObject *tmp_name_name_1;
839         PyObject *tmp_globals_arg_name_1; 817         PyObject *tmp_globals_arg_name_1;
840         PyObject *tmp_locals_arg_name_1; 818         PyObject *tmp_locals_arg_name_1;
841         PyObject *tmp_fromlist_name_1; 819         PyObject *tmp_fromlist_name_1;
842         PyObject *tmp_level_name_1; 820         PyObject *tmp_level_name_1;
n 843         tmp_name_name_1 = mod_consts[11]; n 821         tmp_name_name_1 = mod_consts[10];
844         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__; 822         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__;
845         tmp_locals_arg_name_1 = Py_None; 823         tmp_locals_arg_name_1 = Py_None;
846         tmp_fromlist_name_1 = Py_None; 824         tmp_fromlist_name_1 = Py_None;
n 847         tmp_level_name_1 = mod_consts[12]; n 825         tmp_level_name_1 = mod_consts[11];
848         tmp_assign_source_7 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_arg_name_1, tmp_locals_arg_name_1, tmp_fromlist_name_1, tmp_level_name_1); 826         tmp_assign_source_7 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_arg_name_1, tmp_locals_arg_name_1, tmp_fromlist_name_1, tmp_level_name_1);
849         assert(!(tmp_assign_source_7 == NULL)); 827         assert(!(tmp_assign_source_7 == NULL));
n 850         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_7); n 828         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_7);
851     } 829     }
852     // Frame without reuse. 830     // Frame without reuse.
853     frame_b66f15575242b65fe0bd01d0498e1439 = MAKE_MODULE_FRAME(codeobj_b66f15575242b65fe0bd01d0498e1439, module___main__); 831     frame_b66f15575242b65fe0bd01d0498e1439 = MAKE_MODULE_FRAME(codeobj_b66f15575242b65fe0bd01d0498e1439, module___main__);
854 832
855     // Push the new frame as the currently active one, and we should be exclusively 833     // Push the new frame as the currently active one, and we should be exclusively
860     // Framed code: 838     // Framed code:
861     { 839     {
862         PyObject *tmp_assign_source_8; 840         PyObject *tmp_assign_source_8;
863         PyObject *tmp_iter_arg_1; 841         PyObject *tmp_iter_arg_1;
864         PyObject *tmp_called_instance_1; 842         PyObject *tmp_called_instance_1;
n 865         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[11]); n 843         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]);
866 844
867         if (unlikely(tmp_called_instance_1 == NULL)) { 845         if (unlikely(tmp_called_instance_1 == NULL)) {
n 868             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[11]); n 846             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]);
869         } 847         }
870 848
871         assert(!(tmp_called_instance_1 == NULL)); 849         assert(!(tmp_called_instance_1 == NULL));
872         frame_b66f15575242b65fe0bd01d0498e1439->m_frame.f_lineno = 42; 850         frame_b66f15575242b65fe0bd01d0498e1439->m_frame.f_lineno = 42;
n 873         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(tmp_called_instance_1, mod_consts[13], &PyTuple_GET_ITEM(mod_consts[14], 0)); n 851         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(tmp_called_instance_1, mod_consts[12], &PyTuple_GET_ITEM(mod_consts[13], 0));
874 852
875         if (tmp_iter_arg_1 == NULL) { 853         if (tmp_iter_arg_1 == NULL) {
876             assert(ERROR_OCCURRED()); 854             assert(ERROR_OCCURRED());
877 855
878             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 856             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
927     } 905     }
928     { 906     {
929         PyObject *tmp_assign_source_10; 907         PyObject *tmp_assign_source_10;
930         CHECK_OBJECT(tmp_for_loop_1__iter_value); 908         CHECK_OBJECT(tmp_for_loop_1__iter_value);
931         tmp_assign_source_10 = tmp_for_loop_1__iter_value; 909         tmp_assign_source_10 = tmp_for_loop_1__iter_value;
n 932         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[15], tmp_assign_source_10); n 910         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[14], tmp_assign_source_10);
933     } 911     }
934     { 912     {
935         PyObject *tmp_called_name_1; 913         PyObject *tmp_called_name_1;
936         PyObject *tmp_call_result_1; 914         PyObject *tmp_call_result_1;
n 937         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]); n 915         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]);
938 916
939         if (unlikely(tmp_called_name_1 == NULL)) { 917         if (unlikely(tmp_called_name_1 == NULL)) {
n 940             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]); n 918             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[9]);
941         } 919         }
942 920
943         if (tmp_called_name_1 == NULL) { 921         if (tmp_called_name_1 == NULL) {
944             assert(ERROR_OCCURRED()); 922             assert(ERROR_OCCURRED());
945 923
1006     Py_XDECREF(tmp_for_loop_1__for_iterator); 984     Py_XDECREF(tmp_for_loop_1__for_iterator);
1007     tmp_for_loop_1__for_iterator = NULL; 985     tmp_for_loop_1__for_iterator = NULL;
1008     { 986     {
1009         PyObject *tmp_called_name_2; 987         PyObject *tmp_called_name_2;
1010         PyObject *tmp_call_result_2; 988         PyObject *tmp_call_result_2;
n 1011         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[16]); n 989         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[15]);
1012         assert(tmp_called_name_2 != NULL); 990         assert(tmp_called_name_2 != NULL);
1013         frame_b66f15575242b65fe0bd01d0498e1439->m_frame.f_lineno = 45; 991         frame_b66f15575242b65fe0bd01d0498e1439->m_frame.f_lineno = 45;
t 1014         tmp_call_result_2 = CALL_FUNCTION_WITH_SINGLE_ARG(tmp_called_name_2, mod_consts[17]); t 992         tmp_call_result_2 = CALL_FUNCTION_WITH_SINGLE_ARG(tmp_called_name_2, mod_consts[16]);
1015         if (tmp_call_result_2 == NULL) { 993         if (tmp_call_result_2 == NULL) {
1016             assert(ERROR_OCCURRED()); 994             assert(ERROR_OCCURRED());
1017 995
1018             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 996             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
1019 997