Construct LocalVariableAccess

Performance Diagrams

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