Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1177849688.95192307692307257.0CPython 2.7850039242.31730769230768486.28138319253094Nuitka (master)850039395.6826923076923486.28138319253094Nuitka (develop)850180549.0480769230769486.27842498214216Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1117227488.95192307692307257.0CPython 3.5950083242.31730769230768483.100851140683Nuitka (master)950083395.6826923076923483.100851140683Nuitka (develop)950158549.0480769230769483.0991922435018Nuitka (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[21]; n 36 static PyObject *mod_consts[20];
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__", 21); n 45     loadConstantsBlob(&mod_consts[0], "__main__", 20);
46 46
47     constants_created = true; 47     constants_created = true;
48 } 48 }
49 49
50 /* Function to verify module private constants for non-corruption. */ 50 /* Function to verify module private constants for non-corruption. */
51 #ifndef __NUITKA_NO_ASSERT__ 51 #ifndef __NUITKA_NO_ASSERT__
52 void checkModuleConstants___main__(void) { 52 void checkModuleConstants___main__(void) {
53     // The module may not have been used at all, then ignore this. 53     // The module may not have been used at all, then ignore this.
54     if (constants_created == false) return; 54     if (constants_created == false) return;
55 55
n 56     checkConstantsBlob(&mod_consts[0], "__main__", 21); n 56     checkConstantsBlob(&mod_consts[0], "__main__", 20);
57 } 57 }
58 #endif 58 #endif
59 59
60 // The module code objects. 60 // The module code objects.
61 static PyCodeObject *codeobj_08d5e0ec182c9b02871179cbcd27df09; 61 static PyCodeObject *codeobj_08d5e0ec182c9b02871179cbcd27df09;
62 static PyCodeObject *codeobj_6578a0ae8a93fe64e6a74ee5f739024d; 62 static PyCodeObject *codeobj_6578a0ae8a93fe64e6a74ee5f739024d;
63 /* For use in "MainProgram.c". */ 63 /* For use in "MainProgram.c". */
64 PyCodeObject *codeobj_main = NULL; 64 PyCodeObject *codeobj_main = NULL;
65 65
66 static void createModuleCodeObjects(void) { 66 static void createModuleCodeObjects(void) {
n 67     module_filename_obj = mod_consts[5]; CHECK_OBJECT(module_filename_obj); n 67     module_filename_obj = mod_consts[4]; CHECK_OBJECT(module_filename_obj);
68     codeobj_08d5e0ec182c9b02871179cbcd27df09 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[18], mod_consts[19], 0, 0, 0); 68     codeobj_08d5e0ec182c9b02871179cbcd27df09 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[17], mod_consts[18], 0, 0, 0);
69     codeobj_6578a0ae8a93fe64e6a74ee5f739024d = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[10], mod_consts[20], 0, 0, 0); 69     codeobj_6578a0ae8a93fe64e6a74ee5f739024d = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[9], mod_consts[19], 0, 0, 0);
70 } 70 }
71 71
72 // The module function declarations. 72 // The module function declarations.
73 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(); 73 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly();
74 74
214     } 214     }
215     { 215     {
216         PyObject *tmp_assign_source_3; 216         PyObject *tmp_assign_source_3;
217         PyObject *tmp_left_name_2; 217         PyObject *tmp_left_name_2;
218         PyObject *tmp_right_name_2; 218         PyObject *tmp_right_name_2;
n n 219         PyObject *tmp_mvar_value_4;
219         CHECK_OBJECT(var_s); 220         CHECK_OBJECT(var_s);
220         tmp_left_name_2 = var_s; 221         tmp_left_name_2 = var_s;
n 221         tmp_right_name_2 = mod_consts[2]; n
222         tmp_result = BINARY_OPERATION_ADD_OBJECT_FLOAT_INPLACE(&tmp_left_name_2, tmp_right_name_2);
223         if (tmp_result == false) {
224             assert(ERROR_OCCURRED());
225  
226             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
227  
228  
229             exception_lineno = 35;
230             type_description_1 = "oo";
231             goto frame_exception_exit_1;
232         }
233         tmp_assign_source_3 = tmp_left_name_2;
234         var_s = tmp_assign_source_3;
235  
236     }
237     {
238         PyObject *tmp_assign_source_4;
239         PyObject *tmp_left_name_3;
240         PyObject *tmp_right_name_3;
241         PyObject *tmp_mvar_value_4;
242         CHECK_OBJECT(var_s);
243         tmp_left_name_3 = var_s;
244         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[3]); 222         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[2]);
245 223
246         if (unlikely(tmp_mvar_value_4 == NULL)) { 224         if (unlikely(tmp_mvar_value_4 == NULL)) {
n 247             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[3]); n 225             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[2]);
248         } 226         }
249 227
250         if (unlikely(tmp_mvar_value_4 == NULL)) { 228         if (unlikely(tmp_mvar_value_4 == NULL)) {
251 229
n 252             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[3]); n 230             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[2]);
253             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 231             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
254             CHAIN_EXCEPTION(exception_value); 232             CHAIN_EXCEPTION(exception_value);
255 233
256             exception_lineno = 37; 234             exception_lineno = 37;
257             type_description_1 = "oo"; 235             type_description_1 = "oo";
258             goto frame_exception_exit_1; 236             goto frame_exception_exit_1;
259         } 237         }
260 238
n 261         tmp_right_name_3 = tmp_mvar_value_4; n 239         tmp_right_name_2 = tmp_mvar_value_4;
262         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_3, tmp_right_name_3); 240         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_2, tmp_right_name_2);
263         if (tmp_result == false) { 241         if (tmp_result == false) {
264             assert(ERROR_OCCURRED()); 242             assert(ERROR_OCCURRED());
265 243
266             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 244             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
267 245
268 246
269             exception_lineno = 37; 247             exception_lineno = 37;
270             type_description_1 = "oo"; 248             type_description_1 = "oo";
271             goto frame_exception_exit_1; 249             goto frame_exception_exit_1;
272         } 250         }
n 273         tmp_assign_source_4 = tmp_left_name_3; n 251         tmp_assign_source_3 = tmp_left_name_2;
274         var_s = tmp_assign_source_4; 252         var_s = tmp_assign_source_3;
275 253
276     } 254     }
277 255
278 #if 0 256 #if 0
279     RESTORE_FRAME_EXCEPTION(frame_6578a0ae8a93fe64e6a74ee5f739024d); 257     RESTORE_FRAME_EXCEPTION(frame_6578a0ae8a93fe64e6a74ee5f739024d);
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 >= 300 375 #if PYTHON_VERSION >= 300
398         NULL, 376         NULL,
399 #endif 377 #endif
400         codeobj_6578a0ae8a93fe64e6a74ee5f739024d, 378         codeobj_6578a0ae8a93fe64e6a74ee5f739024d,
401         NULL, 379         NULL,
792 770
793     // Module code. 771     // Module code.
794     { 772     {
795         PyObject *tmp_assign_source_1; 773         PyObject *tmp_assign_source_1;
796         tmp_assign_source_1 = Py_None; 774         tmp_assign_source_1 = Py_None;
n 797         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_1); n 775         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1);
798     } 776     }
799     { 777     {
800         PyObject *tmp_assign_source_2; 778         PyObject *tmp_assign_source_2;
n 801         tmp_assign_source_2 = mod_consts[5]; n 779         tmp_assign_source_2 = mod_consts[4];
802         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_2); 780         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2);
803     } 781     }
804     { 782     {
805         PyObject *tmp_assign_source_3; 783         PyObject *tmp_assign_source_3;
806         tmp_assign_source_3 = Py_None; 784         tmp_assign_source_3 = Py_None;
n 807         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_3); n 785         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3);
808     } 786     }
809     { 787     {
810         PyObject *tmp_assign_source_4; 788         PyObject *tmp_assign_source_4;
n 811         tmp_assign_source_4 = mod_consts[8]; n 789         tmp_assign_source_4 = mod_consts[7];
812         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 790         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
813     } 791     }
814     { 792     {
815         PyObject *tmp_assign_source_5; 793         PyObject *tmp_assign_source_5;
n 816         tmp_assign_source_5 = mod_consts[9]; n 794         tmp_assign_source_5 = mod_consts[8];
817         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_5); 795         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_5);
818     } 796     }
819     { 797     {
820         PyObject *tmp_assign_source_6; 798         PyObject *tmp_assign_source_6;
821 799
822 800
823         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(); 801         tmp_assign_source_6 = MAKE_FUNCTION___main__$$$function_1_calledRepeatedly();
824 802
n 825         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_6); n 803         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_6);
826     } 804     }
827     { 805     {
828         PyObject *tmp_assign_source_7; 806         PyObject *tmp_assign_source_7;
829         PyObject *tmp_name_name_1; 807         PyObject *tmp_name_name_1;
830         PyObject *tmp_globals_name_1; 808         PyObject *tmp_globals_name_1;
831         PyObject *tmp_locals_name_1; 809         PyObject *tmp_locals_name_1;
832         PyObject *tmp_fromlist_name_1; 810         PyObject *tmp_fromlist_name_1;
833         PyObject *tmp_level_name_1; 811         PyObject *tmp_level_name_1;
n 834         tmp_name_name_1 = mod_consts[11]; n 812         tmp_name_name_1 = mod_consts[10];
835         tmp_globals_name_1 = (PyObject *)moduledict___main__; 813         tmp_globals_name_1 = (PyObject *)moduledict___main__;
836         tmp_locals_name_1 = Py_None; 814         tmp_locals_name_1 = Py_None;
837         tmp_fromlist_name_1 = Py_None; 815         tmp_fromlist_name_1 = Py_None;
n 838         tmp_level_name_1 = mod_consts[12]; n 816         tmp_level_name_1 = mod_consts[11];
839         tmp_assign_source_7 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_name_1, tmp_locals_name_1, tmp_fromlist_name_1, tmp_level_name_1); 817         tmp_assign_source_7 = IMPORT_MODULE5(tmp_name_name_1, tmp_globals_name_1, tmp_locals_name_1, tmp_fromlist_name_1, tmp_level_name_1);
840         assert(!(tmp_assign_source_7 == NULL)); 818         assert(!(tmp_assign_source_7 == NULL));
n 841         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_7); n 819         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_7);
842     } 820     }
843     // Frame without reuse. 821     // Frame without reuse.
844     frame_08d5e0ec182c9b02871179cbcd27df09 = MAKE_MODULE_FRAME(codeobj_08d5e0ec182c9b02871179cbcd27df09, module___main__); 822     frame_08d5e0ec182c9b02871179cbcd27df09 = MAKE_MODULE_FRAME(codeobj_08d5e0ec182c9b02871179cbcd27df09, module___main__);
845 823
846     // Push the new frame as the currently active one, and we should be exclusively 824     // Push the new frame as the currently active one, and we should be exclusively
852     { 830     {
853         PyObject *tmp_assign_source_8; 831         PyObject *tmp_assign_source_8;
854         PyObject *tmp_iter_arg_1; 832         PyObject *tmp_iter_arg_1;
855         PyObject *tmp_called_instance_1; 833         PyObject *tmp_called_instance_1;
856         PyObject *tmp_mvar_value_1; 834         PyObject *tmp_mvar_value_1;
n 857         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[11]); n 835         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]);
858 836
859         if (unlikely(tmp_mvar_value_1 == NULL)) { 837         if (unlikely(tmp_mvar_value_1 == NULL)) {
n 860             tmp_mvar_value_1 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[11]); n 838             tmp_mvar_value_1 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[10]);
861         } 839         }
862 840
863         CHECK_OBJECT(tmp_mvar_value_1); 841         CHECK_OBJECT(tmp_mvar_value_1);
864         tmp_called_instance_1 = tmp_mvar_value_1; 842         tmp_called_instance_1 = tmp_mvar_value_1;
865         frame_08d5e0ec182c9b02871179cbcd27df09->m_frame.f_lineno = 42; 843         frame_08d5e0ec182c9b02871179cbcd27df09->m_frame.f_lineno = 42;
n 866         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(tmp_called_instance_1, mod_consts[13], &PyTuple_GET_ITEM(mod_consts[14], 0)); n 844         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(tmp_called_instance_1, mod_consts[12], &PyTuple_GET_ITEM(mod_consts[13], 0));
867 845
868         if (tmp_iter_arg_1 == NULL) { 846         if (tmp_iter_arg_1 == NULL) {
869             assert(ERROR_OCCURRED()); 847             assert(ERROR_OCCURRED());
870 848
871             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 849             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
920     } 898     }
921     { 899     {
922         PyObject *tmp_assign_source_10; 900         PyObject *tmp_assign_source_10;
923         CHECK_OBJECT(tmp_for_loop_1__iter_value); 901         CHECK_OBJECT(tmp_for_loop_1__iter_value);
924         tmp_assign_source_10 = tmp_for_loop_1__iter_value; 902         tmp_assign_source_10 = tmp_for_loop_1__iter_value;
n 925         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[15], tmp_assign_source_10); n 903         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[14], tmp_assign_source_10);
926     } 904     }
927     { 905     {
928         PyObject *tmp_called_name_1; 906         PyObject *tmp_called_name_1;
929         PyObject *tmp_mvar_value_2; 907         PyObject *tmp_mvar_value_2;
930         PyObject *tmp_call_result_1; 908         PyObject *tmp_call_result_1;
n 931         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]); n 909         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]);
932 910
933         if (unlikely(tmp_mvar_value_2 == NULL)) { 911         if (unlikely(tmp_mvar_value_2 == NULL)) {
n 934             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[10]); n 912             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[9]);
935         } 913         }
936 914
937         if (unlikely(tmp_mvar_value_2 == NULL)) { 915         if (unlikely(tmp_mvar_value_2 == NULL)) {
938 916
n 939             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[10]); n 917             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[9]);
940             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 918             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
941             CHAIN_EXCEPTION(exception_value); 919             CHAIN_EXCEPTION(exception_value);
942 920
943             exception_lineno = 43; 921             exception_lineno = 43;
944 922
1008     tmp_for_loop_1__for_iterator = NULL; 986     tmp_for_loop_1__for_iterator = NULL;
1009 987
1010     { 988     {
1011         PyObject *tmp_called_name_2; 989         PyObject *tmp_called_name_2;
1012         PyObject *tmp_call_result_2; 990         PyObject *tmp_call_result_2;
n 1013         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[16]); n 991         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[15]);
1014         assert(tmp_called_name_2 != NULL); 992         assert(tmp_called_name_2 != NULL);
1015         frame_08d5e0ec182c9b02871179cbcd27df09->m_frame.f_lineno = 45; 993         frame_08d5e0ec182c9b02871179cbcd27df09->m_frame.f_lineno = 45;
t 1016         tmp_call_result_2 = CALL_FUNCTION_WITH_SINGLE_ARG(tmp_called_name_2, mod_consts[17]); t 994         tmp_call_result_2 = CALL_FUNCTION_WITH_SINGLE_ARG(tmp_called_name_2, mod_consts[16]);
1017         if (tmp_call_result_2 == NULL) { 995         if (tmp_call_result_2 == NULL) {
1018             assert(ERROR_OCCURRED()); 996             assert(ERROR_OCCURRED());
1019 997
1020             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 998             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
1021 999