Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)3357621473.61538461538461370.9351291420962CPython 2.762300519196.30769230769232257.0Nuitka (historic)24255142319.0000000000001407.9072174854965Nuitka (master)24255685441.69230769230774407.9050636727194Nuitka (develop)24255769564.3846153846155407.90473048621243Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4297426073.61538461538461273.9560635480203CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)46121577319.0000000000001257.09982579305324Nuitka (master)46049604441.69230769230774257.4852950673393Nuitka (develop)46140216564.3846153846155257.0Nuitka (factory)Construct InplaceOperationStringAddTicks

Source Code with Construct

module_value1 = 5

additiv_global = '*' * 1000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable s anyway
    s = '2'

    additiv = additiv_global

    s += additiv
# construct_begin
    s += additiv
# construct_end

    return s

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 5

additiv_global = '*' * 1000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable s anyway
    s = '2'

    additiv = additiv_global

    s += additiv
# construct_begin



    return s

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
31 31
32     additiv = additiv_global 32     additiv = additiv_global
33 33
34     s += additiv 34     s += additiv
35 # construct_begin 35 # construct_begin
t 36     s += additiv t 36  
37 # construct_end 37  
38 38
39     return s 39     return s
40 40
41 for x in xrange(50000): 41 for x in xrange(50000):
42     calledRepeatedly() 42     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
135     PyObject *exception_keeper_value_1; 135     PyObject *exception_keeper_value_1;
136     PyTracebackObject *exception_keeper_tb_1; 136     PyTracebackObject *exception_keeper_tb_1;
137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
138     PyObject *tmp_assign_source_1; 138     PyObject *tmp_assign_source_1;
139     PyObject *tmp_assign_source_2; 139     PyObject *tmp_assign_source_2;
n 140     PyObject *tmp_assign_source_3; n
141     PyObject *tmp_left_name_1; 140     PyObject *tmp_left_name_1;
n 142     PyObject *tmp_left_name_2; n
143     bool tmp_result;
144     PyObject *tmp_return_value; 141     PyObject *tmp_return_value;
145     PyObject *tmp_right_name_1; 142     PyObject *tmp_right_name_1;
n 146     PyObject *tmp_right_name_2; n
147     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 143     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
148     static struct Nuitka_FrameObject *cache_frame_d1b8f258499ee0bca0cce9aa45fb8a5d = NULL; 144     static struct Nuitka_FrameObject *cache_frame_d1b8f258499ee0bca0cce9aa45fb8a5d = NULL;
149 145
150     struct Nuitka_FrameObject *frame_d1b8f258499ee0bca0cce9aa45fb8a5d; 146     struct Nuitka_FrameObject *frame_d1b8f258499ee0bca0cce9aa45fb8a5d;
151 147
228         type_description = "oo"; 224         type_description = "oo";
229         goto frame_exception_exit_1; 225         goto frame_exception_exit_1;
230     } 226     }
231     assert( var_s == NULL ); 227     assert( var_s == NULL );
232     var_s = tmp_assign_source_2; 228     var_s = tmp_assign_source_2;
n 233   n
234     tmp_left_name_2 = var_s;
235  
236     CHECK_OBJECT( tmp_left_name_2 );
237     tmp_right_name_2 = var_additiv;
238  
239     if ( tmp_right_name_2 == NULL )
240     {
241  
242         exception_type = PyExc_UnboundLocalError;
243         Py_INCREF( exception_type );
244         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
245         exception_tb = NULL;
246         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
247         CHAIN_EXCEPTION( exception_value );
248  
249         exception_lineno = 36;
250         type_description = "oo";
251         goto frame_exception_exit_1;
252     }
253  
254     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
255     tmp_assign_source_3 = tmp_left_name_2;
256     if ( tmp_result == false )
257     {
258         assert( ERROR_OCCURRED() );
259  
260         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
261  
262  
263         exception_lineno = 36;
264         type_description = "oo";
265         goto frame_exception_exit_1;
266     }
267     var_s = tmp_assign_source_3;
268 229
269 230
270 #if 0 231 #if 0
271     RESTORE_FRAME_EXCEPTION( frame_d1b8f258499ee0bca0cce9aa45fb8a5d ); 232     RESTORE_FRAME_EXCEPTION( frame_d1b8f258499ee0bca0cce9aa45fb8a5d );
272 #endif 233 #endif
337     exception_keeper_lineno_1 = exception_lineno; 298     exception_keeper_lineno_1 = exception_lineno;
338     exception_type = NULL; 299     exception_type = NULL;
339     exception_value = NULL; 300     exception_value = NULL;
340     exception_tb = NULL; 301     exception_tb = NULL;
341     exception_lineno = -1; 302     exception_lineno = -1;
t 342   t
343     Py_XDECREF( var_s );
344     var_s = NULL;
345 303
346     Py_XDECREF( var_additiv ); 304     Py_XDECREF( var_additiv );
347     var_additiv = NULL; 305     var_additiv = NULL;
348 306
349     // Re-raise. 307     // Re-raise.