Construct LocalVariableAccess

Performance Diagrams

Construct LocalVariableAccess 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)853215989.78846153846155257.0CPython 3.104700322244.59615384615387367.9808049801301Nuitka (main)4700322399.4038461538462367.9808049801301Nuitka (develop)4700412554.2115384615385367.9781983263376Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)822297589.78846153846155257.0CPython 3.84600369244.59615384615387365.8659122762747Nuitka (main)4600377399.4038461538462365.8656718616952Nuitka (develop)4600200554.2115384615385365.8709910342668Nuitka (factory)Construct LocalVariableAccessTicks Construct LocalVariableAccess 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)652972189.78846153846155257.0CPython 2.72850092244.59615384615387396.2544850808975Nuitka (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_9d92cbbd9d8983f2ca55f357c0b79245; 82 static PyCodeObject *codeobj_9d92cbbd9d8983f2ca55f357c0b79245;
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_60dbcc2361cf13e33808c78a41ca94fd = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[13], mod_consts[13], NULL, NULL, 0, 0, 0); 88     codeobj_60dbcc2361cf13e33808c78a41ca94fd = MAKE_CODE_OBJECT(module_filename_obj, 1, CO_NOFREE, mod_consts[13], mod_consts[13], NULL, NULL, 0, 0, 0);
89     codeobj_main = codeobj_60dbcc2361cf13e33808c78a41ca94fd; 89     codeobj_main = codeobj_60dbcc2361cf13e33808c78a41ca94fd;
90     codeobj_9d92cbbd9d8983f2ca55f357c0b79245 = 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_9d92cbbd9d8983f2ca55f357c0b79245 = 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");
687 681
688     // Module code. 682     // Module code.
689     { 683     {
690         PyObject *tmp_assign_source_1; 684         PyObject *tmp_assign_source_1;
691         tmp_assign_source_1 = Py_None; 685         tmp_assign_source_1 = Py_None;
n 692         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[3], tmp_assign_source_1); n 686         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_1);
693     } 687     }
694     { 688     {
695         PyObject *tmp_assign_source_2; 689         PyObject *tmp_assign_source_2;
n 696         tmp_assign_source_2 = mod_consts[4]; n 690         tmp_assign_source_2 = mod_consts[3];
697         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_2); 691         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[4], tmp_assign_source_2);
698     } 692     }
699     frame_60dbcc2361cf13e33808c78a41ca94fd = MAKE_MODULE_FRAME(codeobj_60dbcc2361cf13e33808c78a41ca94fd, module___main__); 693     frame_60dbcc2361cf13e33808c78a41ca94fd = MAKE_MODULE_FRAME(codeobj_60dbcc2361cf13e33808c78a41ca94fd, module___main__);
700 694
701     // Push the new frame as the currently active one, and we should be exclusively 695     // Push the new frame as the currently active one, and we should be exclusively
702     // owning it. 696     // owning it.
708         PyObject *tmp_assign_source_3; 702         PyObject *tmp_assign_source_3;
709         PyObject *tmp_name_value_1; 703         PyObject *tmp_name_value_1;
710         PyObject *tmp_globals_arg_value_1; 704         PyObject *tmp_globals_arg_value_1;
711         PyObject *tmp_locals_arg_value_1; 705         PyObject *tmp_locals_arg_value_1;
712         PyObject *tmp_fromlist_value_1; 706         PyObject *tmp_fromlist_value_1;
n 713         tmp_name_value_1 = mod_consts[6]; n 707         tmp_name_value_1 = mod_consts[5];
714         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__; 708         tmp_globals_arg_value_1 = (PyObject *)moduledict___main__;
715         tmp_locals_arg_value_1 = Py_None; 709         tmp_locals_arg_value_1 = Py_None;
716         tmp_fromlist_value_1 = Py_None; 710         tmp_fromlist_value_1 = Py_None;
717         frame_60dbcc2361cf13e33808c78a41ca94fd->m_frame.f_lineno = 4; 711         frame_60dbcc2361cf13e33808c78a41ca94fd->m_frame.f_lineno = 4;
718         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); 712         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);
724 718
725             exception_lineno = 4; 719             exception_lineno = 4;
726 720
727             goto frame_exception_exit_1; 721             goto frame_exception_exit_1;
728         } 722         }
n 729         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[6], tmp_assign_source_3); n 723         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[5], tmp_assign_source_3);
730     } 724     }
731     { 725     {
732         PyObject *tmp_assign_source_4; 726         PyObject *tmp_assign_source_4;
n 733         tmp_assign_source_4 = mod_consts[7]; n 727         tmp_assign_source_4 = mod_consts[6];
734         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4); 728         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[0], tmp_assign_source_4);
735     } 729     }
736     { 730     {
737         PyObject *tmp_assign_source_5; 731         PyObject *tmp_assign_source_5;
738         tmp_assign_source_5 = Py_None; 732         tmp_assign_source_5 = Py_None;
n 739         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_5); n 733         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[7], tmp_assign_source_5);
740     } 734     }
741     { 735     {
742         PyObject *tmp_assign_source_6; 736         PyObject *tmp_assign_source_6;
743         tmp_assign_source_6 = Py_None; 737         tmp_assign_source_6 = Py_None;
n 744         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[2], tmp_assign_source_6); n 738         UPDATE_STRING_DICT0(moduledict___main__, (Nuitka_StringObject *)mod_consts[1], tmp_assign_source_6);
745     } 739     }
746     { 740     {
747         PyObject *tmp_assign_source_7; 741         PyObject *tmp_assign_source_7;
748 742
749 743
753     } 747     }
754     { 748     {
755         PyObject *tmp_assign_source_8; 749         PyObject *tmp_assign_source_8;
756         PyObject *tmp_iter_arg_1; 750         PyObject *tmp_iter_arg_1;
757         PyObject *tmp_called_instance_1; 751         PyObject *tmp_called_instance_1;
n 758         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[6]); n 752         tmp_called_instance_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[5]);
759 753
760         if (unlikely(tmp_called_instance_1 == NULL)) { 754         if (unlikely(tmp_called_instance_1 == NULL)) {
t 761             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[6]); t 755             tmp_called_instance_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[5]);
762         } 756         }
763 757
764         assert(!(tmp_called_instance_1 == NULL)); 758         assert(!(tmp_called_instance_1 == NULL));
765         frame_60dbcc2361cf13e33808c78a41ca94fd->m_frame.f_lineno = 27; 759         frame_60dbcc2361cf13e33808c78a41ca94fd->m_frame.f_lineno = 27;
766         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2( 760         tmp_iter_arg_1 = CALL_METHOD_WITH_ARGS2(