Construct LocalVariableAccess

Performance Diagrams

Construct LocalVariableAccess 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)853215989.78846153846155257.0CPython 3.104700321244.59615384615387367.98083394294997Nuitka (main)4699990399.4038461538462367.9904206363423Nuitka (develop)4699990554.2115384615385367.9904206363423Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)822297589.78846153846155257.0CPython 3.84599994244.59615384615387365.8771817096891Nuitka (main)4600128399.4038461538462365.87315476548235Nuitka (develop)4600128554.2115384615385365.87315476548235Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)652972189.78846153846155257.0CPython 2.72850096244.59615384615387396.2543337020655Nuitka (main)2850092399.4038461538462396.2544850808975Nuitka (develop)2850092554.2115384615385396.2544850808975Nuitka (factory)Construct LocalVariableAccessTicks

Source Code with Construct

    # construct_begin
    module_value2 = local_value
    # construct_end

    module_value3 = local_value


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

print("OK.")

#     Python test originally created or extracted from other peoples work. The
#     parts from me are licensed as below. It is at least Free Software where
#     it's copied from other people. In these cases, that will normally be
#     indicated.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

Source Code without Construct

    # construct_begin



    module_value3 = local_value


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

print("OK.")

#     Python test originally created or extracted from other peoples work. The
#     parts from me are licensed as below. It is at least Free Software where
#     it's copied from other people. In these cases, that will normally be
#     indicated.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

Context Diff of Source Code


Construct
Baseline
16 16
17     # Use writing to global variable as access method. 17     # Use writing to global variable as access method.
18     global module_value2, module_value3 18     global module_value2, module_value3
19 19
20     # construct_begin 20     # construct_begin
t 21     module_value2 = local_value t 21  
22     # construct_end 22  
23 23
24     module_value3 = local_value 24     module_value3 = local_value
25 25
26 26
27 for x in itertools.repeat(None, 50000): 27 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
82 static PyCodeObject *codeobj_9e62b2eb1678bf3e0729846c131e0bc7; 82 static PyCodeObject *codeobj_9e62b2eb1678bf3e0729846c131e0bc7;
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_3b5dbc867ec4fbebb785c821b3f26312 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[13], mod_consts[13], NULL, NULL, 0, 0, 0); 88     codeobj_3b5dbc867ec4fbebb785c821b3f26312 = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[13], mod_consts[13], NULL, NULL, 0, 0, 0);
89     codeobj_main = codeobj_3b5dbc867ec4fbebb785c821b3f26312; 89     codeobj_main = codeobj_3b5dbc867ec4fbebb785c821b3f26312;
90     codeobj_9e62b2eb1678bf3e0729846c131e0bc7 = MAKE_CODE_OBJECT(module_filename_obj, 11, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[8], mod_consts[14], NULL, 0, 0, 0); 90     codeobj_9e62b2eb1678bf3e0729846c131e0bc7 = MAKE_CODE_OBJECT(module_filename_obj, 11, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE, mod_consts[8], mod_consts[8], mod_consts[14], NULL, 0, 0, 0);
91 } 91 }
92 92
231     { 231     {
232         PyObject *tmp_assign_source_2; 232         PyObject *tmp_assign_source_2;
233         CHECK_OBJECT(var_local_value); 233         CHECK_OBJECT(var_local_value);
234         tmp_assign_source_2 = var_local_value; 234         tmp_assign_source_2 = var_local_value;
235         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_2); 235         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_2);
n 236     } n
237     {
238         PyObject *tmp_assign_source_3;
239         CHECK_OBJECT(var_local_value);
240         tmp_assign_source_3 = var_local_value;
241         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_3);
242     } 236     }
243     tmp_return_value = Py_None; 237     tmp_return_value = Py_None;
244     Py_INCREF(tmp_return_value); 238     Py_INCREF(tmp_return_value);
245     goto try_return_handler_1; 239     goto try_return_handler_1;
246     NUITKA_CANNOT_GET_HERE("tried codes exits in all cases"); 240     NUITKA_CANNOT_GET_HERE("tried codes exits in all cases");
685 679
686     // Module code. 680     // Module code.
687     { 681     {
688         PyObject *tmp_assign_source_1; 682         PyObject *tmp_assign_source_1;
689         tmp_assign_source_1 = Py_None; 683         tmp_assign_source_1 = Py_None;
n 690         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 684         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
691     } 685     }
692     { 686     {
693         PyObject *tmp_assign_source_2; 687         PyObject *tmp_assign_source_2;
n 694         tmp_assign_source_2 = mod_consts[4]; n 688         tmp_assign_source_2 = mod_consts[3];
695         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 689         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
696     } 690     }
697     frame_3b5dbc867ec4fbebb785c821b3f26312 = MAKE_MODULE_FRAME(codeobj_3b5dbc867ec4fbebb785c821b3f26312, module___main__); 691     frame_3b5dbc867ec4fbebb785c821b3f26312 = MAKE_MODULE_FRAME(codeobj_3b5dbc867ec4fbebb785c821b3f26312, module___main__);
698 692
699     // Push the new frame as the currently active one, and we should be exclusively 693     // Push the new frame as the currently active one, and we should be exclusively
700     // owning it. 694     // owning it.
706         PyObject *tmp_assign_source_3; 700         PyObject *tmp_assign_source_3;
707         PyObject *tmp_name_value_1; 701         PyObject *tmp_name_value_1;
708         PyObject *tmp_globals_arg_value_1; 702         PyObject *tmp_globals_arg_value_1;
709         PyObject *tmp_locals_arg_value_1; 703         PyObject *tmp_locals_arg_value_1;
710         PyObject *tmp_fromlist_value_1; 704         PyObject *tmp_fromlist_value_1;
n 711         tmp_name_value_1 = mod_consts[6]; n 705         tmp_name_value_1 = mod_consts[5];
712         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 706         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
713         tmp_locals_arg_value_1 = Py_None; 707         tmp_locals_arg_value_1 = Py_None;
714         tmp_fromlist_value_1 = Py_None; 708         tmp_fromlist_value_1 = Py_None;
715         frame_3b5dbc867ec4fbebb785c821b3f26312->m_frame.f_lineno = 4; 709         frame_3b5dbc867ec4fbebb785c821b3f26312->m_frame.f_lineno = 4;
716         tmp_assign_source_3 = IMPORT_MODULE4(tstate, tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1); 710         tmp_assign_source_3 = IMPORT_MODULE4(tstate, tmp_name_value_1, tmp_globals_arg_value_1, tmp_locals_arg_value_1, tmp_fromlist_value_1);
722 716
723             exception_lineno = 4; 717             exception_lineno = 4;
724 718
725             goto frame_exception_exit_1; 719             goto frame_exception_exit_1;
726         } 720         }
n 727         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 721         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
728     } 722     }
729     { 723     {
730         PyObject *tmp_assign_source_4; 724         PyObject *tmp_assign_source_4;
n 731         tmp_assign_source_4 = mod_consts[7]; n 725         tmp_assign_source_4 = mod_consts[6];
732         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 726         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
733     } 727     }
734     { 728     {
735         PyObject *tmp_assign_source_5; 729         PyObject *tmp_assign_source_5;
736         tmp_assign_source_5 = Py_None; 730         tmp_assign_source_5 = Py_None;
n 737         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); n 731         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_5);
738     } 732     }
739     { 733     {
740         PyObject *tmp_assign_source_6; 734         PyObject *tmp_assign_source_6;
741         tmp_assign_source_6 = Py_None; 735         tmp_assign_source_6 = Py_None;
n 742         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_6); n 736         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6);
743     } 737     }
744     { 738     {
745         PyObject *tmp_assign_source_7; 739         PyObject *tmp_assign_source_7;
746 740
747 741
751     } 745     }
752     { 746     {
753         PyObject *tmp_assign_source_8; 747         PyObject *tmp_assign_source_8;
754         PyObject *tmp_iter_arg_1; 748         PyObject *tmp_iter_arg_1;
755         PyObject *tmp_called_instance_1; 749         PyObject *tmp_called_instance_1;
n 756         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 750         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
757 751
758         if (unlikely(tmp_called_instance_1 == NULL)) { 752         if (unlikely(tmp_called_instance_1 == NULL)) {
t 759             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 753             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
760         } 754         }
761 755
762         assert(!(tmp_called_instance_1 == NULL)); 756         assert(!(tmp_called_instance_1 == NULL));
763         frame_3b5dbc867ec4fbebb785c821b3f26312->m_frame.f_lineno = 27; 757         frame_3b5dbc867ec4fbebb785c821b3f26312->m_frame.f_lineno = 27;
764         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 758         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(