Construct OperationFloatAdd

Performance Diagrams

Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1078616488.95192307692307257.0CPython 2.71801032242.31730769230768462.85301224791317Nuitka (master)1801051395.6826923076923462.85257695021994Nuitka (develop)1852340549.0480769230769461.6775251930301Nuitka (factory)Construct OperationFloatAddTicks Construct OperationFloatAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)1027786588.95192307692307257.0CPython 3.83100841242.31730769230768429.5604535722007Nuitka (master)3100841395.6826923076923429.5604535722007Nuitka (develop)3150568549.0480769230769428.3648446854553Nuitka (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 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;
70 static PyCodeObject *codeobj_b3262f40b5f05646350d8a2e02718123; 70 static PyCodeObject *codeobj_b3262f40b5f05646350d8a2e02718123;
71 /* For use in "MainProgram.c". */ 71 /* For use in "MainProgram.c". */
72 PyCodeObject *codeobj_main = NULL; 72 PyCodeObject *codeobj_main = NULL;
73 73
74 static void createModuleCodeObjects(void) { 74 static void createModuleCodeObjects(void) {
n 75     module_filename_obj = mod_consts[4]; CHECK_OBJECT(module_filename_obj); n 75     module_filename_obj = mod_consts[3]; CHECK_OBJECT(module_filename_obj);
76     codeobj_d6dbc75f64f187feab5e29e2ed22ee97 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[18], NULL, NULL, 0, 0, 0); 76     codeobj_d6dbc75f64f187feab5e29e2ed22ee97 = MAKE_CODEOBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[17], NULL, NULL, 0, 0, 0);
77     codeobj_b3262f40b5f05646350d8a2e02718123 = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[10], mod_consts[19], NULL, 0, 0, 0); 77     codeobj_b3262f40b5f05646350d8a2e02718123 = MAKE_CODEOBJECT(module_filename_obj, 24, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[9], mod_consts[18], NULL, 0, 0, 0);
78 } 78 }
79 79
80 // The module function declarations. 80 // The module function declarations.
81 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 81 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
82 82
217             goto frame_exception_exit_1; 217             goto frame_exception_exit_1;
218         } 218         }
219         assert(var_t == NULL); 219         assert(var_t == NULL);
220         Py_INCREF(tmp_assign_source_3); 220         Py_INCREF(tmp_assign_source_3);
221         var_t = tmp_assign_source_3; 221         var_t = tmp_assign_source_3;
n 222     } n
223     {
224         PyObject *tmp_assign_source_4;
225         PyObject *tmp_left_name_1;
226         PyObject *tmp_right_name_1;
227         CHECK_OBJECT(var_s);
228         tmp_left_name_1 = var_s;
229         tmp_right_name_1 = mod_consts[2];
230         tmp_assign_source_4 = BINARY_OPERATION_ADD_OBJECT_OBJECT_FLOAT(tmp_left_name_1, tmp_right_name_1);
231         if (tmp_assign_source_4 == NULL) {
232             assert(ERROR_OCCURRED());
233  
234             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
235  
236  
237             exception_lineno = 33;
238             type_description_1 = "ooo";
239             goto frame_exception_exit_1;
240         }
241         {
242             PyObject *old = var_t;
243             assert(old != NULL);
244             var_t = tmp_assign_source_4;
245             Py_DECREF(old);
246         }
247  
248     } 222     }
249 223
250 #if 0 224 #if 0
251     RESTORE_FRAME_EXCEPTION(frame_b3262f40b5f05646350d8a2e02718123); 225     RESTORE_FRAME_EXCEPTION(frame_b3262f40b5f05646350d8a2e02718123);
252 #endif 226 #endif
339 313
340     Py_XDECREF(var_local_value); 314     Py_XDECREF(var_local_value);
341     var_local_value = NULL; 315     var_local_value = NULL;
342     Py_XDECREF(var_s); 316     Py_XDECREF(var_s);
343     var_s = NULL; 317     var_s = NULL;
n 344     Py_XDECREF(var_t); n
345     var_t = NULL;
346     // Re-raise. 318     // Re-raise.
347     exception_type = exception_keeper_type_1; 319     exception_type = exception_keeper_type_1;
348     exception_value = exception_keeper_value_1; 320     exception_value = exception_keeper_value_1;
349     exception_tb = exception_keeper_tb_1; 321     exception_tb = exception_keeper_tb_1;
350     exception_lineno = exception_keeper_lineno_1; 322     exception_lineno = exception_keeper_lineno_1;
375 347
376 348
377 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() { 349 static PyObject *MAKE_FUNCTION___main__$$$function__1_calledRepeatedly() {
378     struct Nuitka_FunctionObject *result = Nuitka_Function_New( 350     struct Nuitka_FunctionObject *result = Nuitka_Function_New(
379         impl___main__$$$function__1_calledRepeatedly, 351         impl___main__$$$function__1_calledRepeatedly,
n 380         mod_consts[10], n 352         mod_consts[9],
381 #if PYTHON_VERSION >= 0x300 353 #if PYTHON_VERSION >= 0x300
382         NULL, 354         NULL,
383 #endif 355 #endif
384         codeobj_b3262f40b5f05646350d8a2e02718123, 356         codeobj_b3262f40b5f05646350d8a2e02718123,
385         NULL, 357         NULL,
757 729
758     // Module code. 730     // Module code.
759     { 731     {
760         PyObject *tmp_assign_source_1; 732         PyObject *tmp_assign_source_1;
761         tmp_assign_source_1 = Py_None; 733         tmp_assign_source_1 = Py_None;
n 762         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 734         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
763     } 735     }
764     { 736     {
765         PyObject *tmp_assign_source_2; 737         PyObject *tmp_assign_source_2;
n 766         tmp_assign_source_2 = mod_consts[4]; n 738         tmp_assign_source_2 = mod_consts[3];
767         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 739         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
768     } 740     }
769     { 741     {
770         PyObject *tmp_assign_source_3; 742         PyObject *tmp_assign_source_3;
771         tmp_assign_source_3 = Py_None; 743         tmp_assign_source_3 = Py_None;
n 772         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 744         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
773     } 745     }
774     { 746     {
775         PyObject *tmp_assign_source_4; 747         PyObject *tmp_assign_source_4;
776         tmp_assign_source_4 = PyDict_New(); 748         tmp_assign_source_4 = PyDict_New();
n 777         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_4); n 749         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_4);
778     } 750     }
779     { 751     {
780         PyObject *tmp_assign_source_5; 752         PyObject *tmp_assign_source_5;
n 781         tmp_assign_source_5 = mod_consts[8]; n 753         tmp_assign_source_5 = mod_consts[7];
782         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_5); 754         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_5);
783     } 755     }
784     { 756     {
785         PyObject *tmp_assign_source_6; 757         PyObject *tmp_assign_source_6;
n 786         tmp_assign_source_6 = mod_consts[9]; n 758         tmp_assign_source_6 = mod_consts[8];
787         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6); 759         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6);
788     } 760     }
789     { 761     {
790         PyObject *tmp_assign_source_7; 762         PyObject *tmp_assign_source_7;
791 763
792 764
793         tmp_assign_source_7 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly(); 765         tmp_assign_source_7 = MAKE_FUNCTION___main__$$$function__1_calledRepeatedly();
794 766
n 795         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_7); n 767         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[9], tmp_assign_source_7);
796     } 768     }
797     { 769     {
798         PyObject *tmp_assign_source_8; 770         PyObject *tmp_assign_source_8;
799         PyObject *tmp_name_name_1; 771         PyObject *tmp_name_name_1;
800         PyObject *tmp_globals_arg_name_1; 772         PyObject *tmp_globals_arg_name_1;
801         PyObject *tmp_locals_arg_name_1; 773         PyObject *tmp_locals_arg_name_1;
802         PyObject *tmp_fromlist_name_1; 774         PyObject *tmp_fromlist_name_1;
803         PyObject *tmp_level_name_1; 775         PyObject *tmp_level_name_1;
n 804         tmp_name_name_1 = mod_consts[11]; n 776         tmp_name_name_1 = mod_consts[10];
805         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__; 777         tmp_globals_arg_name_1 = (PyObject *)moduledict___main__;
806         tmp_locals_arg_name_1 = Py_None; 778         tmp_locals_arg_name_1 = Py_None;
807         tmp_fromlist_name_1 = Py_None; 779         tmp_fromlist_name_1 = Py_None;
n 808         tmp_level_name_1 = mod_consts[12]; n 780         tmp_level_name_1 = mod_consts[11];
809         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); 781         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);
810         assert(!(tmp_assign_source_8 == NULL)); 782         assert(!(tmp_assign_source_8 == NULL));
n 811         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[11], tmp_assign_source_8); n 783         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[10], tmp_assign_source_8);
812     } 784     }
813     // Frame without reuse. 785     // Frame without reuse.
814     frame_d6dbc75f64f187feab5e29e2ed22ee97 = MAKE_MODULE_FRAME(codeobj_d6dbc75f64f187feab5e29e2ed22ee97, module___main__); 786     frame_d6dbc75f64f187feab5e29e2ed22ee97 = MAKE_MODULE_FRAME(codeobj_d6dbc75f64f187feab5e29e2ed22ee97, module___main__);
815 787
816     // Push the new frame as the currently active one, and we should be exclusively 788     // Push the new frame as the currently active one, and we should be exclusively
821     // Framed code: 793     // Framed code:
822     { 794     {
823         PyObject *tmp_assign_source_9; 795         PyObject *tmp_assign_source_9;
824         PyObject *tmp_iter_arg_1; 796         PyObject *tmp_iter_arg_1;
825         PyObject *tmp_called_instance_1; 797         PyObject *tmp_called_instance_1;
n 826         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[11]); n 798         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]);
827 799
828         if (unlikely(tmp_called_instance_1 == NULL)) { 800         if (unlikely(tmp_called_instance_1 == NULL)) {
n 829             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[11]); n 801             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]);
830         } 802         }
831 803
832         assert(!(tmp_called_instance_1 == NULL)); 804         assert(!(tmp_called_instance_1 == NULL));
833         frame_d6dbc75f64f187feab5e29e2ed22ee97->m_frame.f_lineno = 39; 805         frame_d6dbc75f64f187feab5e29e2ed22ee97->m_frame.f_lineno = 39;
834         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 806         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(
835             tmp_called_instance_1, 807             tmp_called_instance_1,
n 836             mod_consts[13], n 808             mod_consts[12],
837             &PyTuple_GET_ITEM(mod_consts[14], 0) 809             &PyTuple_GET_ITEM(mod_consts[13], 0)
838         ); 810         );
839 811
840         if (tmp_iter_arg_1 == NULL) { 812         if (tmp_iter_arg_1 == NULL) {
841             assert(ERROR_OCCURRED()); 813             assert(ERROR_OCCURRED());
842 814
892     } 864     }
893     { 865     {
894         PyObject *tmp_assign_source_11; 866         PyObject *tmp_assign_source_11;
895         CHECK_OBJECT(tmp_for_loop_1__iter_value); 867         CHECK_OBJECT(tmp_for_loop_1__iter_value);
896         tmp_assign_source_11 = tmp_for_loop_1__iter_value; 868         tmp_assign_source_11 = tmp_for_loop_1__iter_value;
n 897         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[15], tmp_assign_source_11); n 869         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[14], tmp_assign_source_11);
898     } 870     }
899     { 871     {
900         PyObject *tmp_called_name_1; 872         PyObject *tmp_called_name_1;
901         PyObject *tmp_call_result_1; 873         PyObject *tmp_call_result_1;
n 902         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[10]); n 874         tmp_called_name_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[9]);
903 875
904         if (unlikely(tmp_called_name_1 == NULL)) { 876         if (unlikely(tmp_called_name_1 == NULL)) {
n 905             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[10]); n 877             tmp_called_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[9]);
906         } 878         }
907 879
908         if (tmp_called_name_1 == NULL) { 880         if (tmp_called_name_1 == NULL) {
909             assert(ERROR_OCCURRED()); 881             assert(ERROR_OCCURRED());
910 882
973     Py_DECREF(tmp_for_loop_1__for_iterator); 945     Py_DECREF(tmp_for_loop_1__for_iterator);
974     tmp_for_loop_1__for_iterator = NULL; 946     tmp_for_loop_1__for_iterator = NULL;
975     { 947     {
976         PyObject *tmp_called_name_2; 948         PyObject *tmp_called_name_2;
977         PyObject *tmp_call_result_2; 949         PyObject *tmp_call_result_2;
n 978         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[16]); n 950         tmp_called_name_2 = LOOKUP_BUILTIN(mod_consts[15]);
979         assert(tmp_called_name_2 != NULL); 951         assert(tmp_called_name_2 != NULL);
980         frame_d6dbc75f64f187feab5e29e2ed22ee97->m_frame.f_lineno = 42; 952         frame_d6dbc75f64f187feab5e29e2ed22ee97->m_frame.f_lineno = 42;
t 981         tmp_call_result_2 = CALL_FUNCTION_WITH_SINGLE_ARG(tmp_called_name_2, mod_consts[17]); t 953         tmp_call_result_2 = CALL_FUNCTION_WITH_SINGLE_ARG(tmp_called_name_2, mod_consts[16]);
982         if (tmp_call_result_2 == NULL) { 954         if (tmp_call_result_2 == NULL) {
983             assert(ERROR_OCCURRED()); 955             assert(ERROR_OCCURRED());
984 956
985             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 957             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
986 958