Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1439234988.95192307692307257.0CPython 2.78000181242.31730769230768366.75297040435544Nuitka (master)7999923395.6826923076923366.75740024198865Nuitka (develop)7999647549.0480769230769366.76213913806134Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2828556688.95192307692307257.0CPython 3.518146742242.31730769230768345.5773115626427Nuitka (master)18146682395.6826923076923345.5778357495399Nuitka (develop)18146852549.0480769230769345.57635055333117Nuitka (factory)Construct RichComparisonConditionStringsTicks

Source Code with Construct

module_value1 = "1000"
module_value2 = "2000"

import sys
loop_count = 50000 if len(sys.argv) < 2 else int(sys.argv[1])

x = 0
import itertools
for _x in itertools.repeat(None, loop_count):
    x += 1
    y = x % 2 == 0

# construct_begin
    if x % 2 == 0:
# construct_alternative


        y = not y

print("OK.")

Source Code without Construct

module_value1 = "1000"
module_value2 = "2000"

import sys
loop_count = 50000 if len(sys.argv) < 2 else int(sys.argv[1])

x = 0
import itertools
for _x in itertools.repeat(None, loop_count):
    x += 1
    y = x % 2 == 0

# construct_begin

# construct_alternative
    if y:
# construct_end
        y = not y

print("OK.")

Context Diff of Source Code


Construct
Baseline
28 for _x in itertools.repeat(None, loop_count): 28 for _x in itertools.repeat(None, loop_count):
29     x += 1 29     x += 1
30     y = x % 2 == 0 30     y = x % 2 == 0
31 31
32 # construct_begin 32 # construct_begin
n 33     if x % 2 == 0: n 33  
34 # construct_alternative 34 # construct_alternative
t 35   t 35     if y:
36   36 # construct_end
37         y = not y 37         y = not y
38 38
39 print("OK.") 39 print("OK.")
40 40

Context Diff of Generated Code


Construct
Baseline
314     PyObject *tmp_assign_source_16; 314     PyObject *tmp_assign_source_16;
315     PyObject *tmp_assign_source_17; 315     PyObject *tmp_assign_source_17;
316     PyObject *tmp_assign_source_18; 316     PyObject *tmp_assign_source_18;
317     PyObject *tmp_called_name_1; 317     PyObject *tmp_called_name_1;
318     PyObject *tmp_called_name_2; 318     PyObject *tmp_called_name_2;
n 319     int tmp_cmp_Eq_1; n
320     int tmp_cmp_Lt_1; 319     int tmp_cmp_Lt_1;
321     PyObject *tmp_compare_left_1; 320     PyObject *tmp_compare_left_1;
n 322     PyObject *tmp_compare_left_2; n
323     PyObject *tmp_compare_right_1; 321     PyObject *tmp_compare_right_1;
n 324     PyObject *tmp_compare_right_2; n
325     PyObject *tmp_compexpr_left_1; 322     PyObject *tmp_compexpr_left_1;
326     PyObject *tmp_compexpr_right_1; 323     PyObject *tmp_compexpr_right_1;
n n 324     int tmp_cond_truth_1;
325     PyObject *tmp_cond_value_1;
327     PyObject *tmp_fromlist_name_1; 326     PyObject *tmp_fromlist_name_1;
328     PyObject *tmp_fromlist_name_2; 327     PyObject *tmp_fromlist_name_2;
329     PyObject *tmp_globals_name_1; 328     PyObject *tmp_globals_name_1;
330     PyObject *tmp_globals_name_2; 329     PyObject *tmp_globals_name_2;
331     PyObject *tmp_int_arg_1; 330     PyObject *tmp_int_arg_1;
332     PyObject *tmp_iter_arg_1; 331     PyObject *tmp_iter_arg_1;
333     PyObject *tmp_left_name_1; 332     PyObject *tmp_left_name_1;
334     PyObject *tmp_left_name_2; 333     PyObject *tmp_left_name_2;
n 335     PyObject *tmp_left_name_3; n
336     PyObject *tmp_len_arg_1; 334     PyObject *tmp_len_arg_1;
337     PyObject *tmp_level_name_1; 335     PyObject *tmp_level_name_1;
338     PyObject *tmp_level_name_2; 336     PyObject *tmp_level_name_2;
339     PyObject *tmp_locals_name_1; 337     PyObject *tmp_locals_name_1;
340     PyObject *tmp_locals_name_2; 338     PyObject *tmp_locals_name_2;
342     PyObject *tmp_name_name_2; 340     PyObject *tmp_name_name_2;
343     PyObject *tmp_next_source_1; 341     PyObject *tmp_next_source_1;
344     PyObject *tmp_operand_name_1; 342     PyObject *tmp_operand_name_1;
345     PyObject *tmp_right_name_1; 343     PyObject *tmp_right_name_1;
346     PyObject *tmp_right_name_2; 344     PyObject *tmp_right_name_2;
n 347     PyObject *tmp_right_name_3; n
348     PyObject *tmp_source_name_1; 345     PyObject *tmp_source_name_1;
349     PyObject *tmp_source_name_2; 346     PyObject *tmp_source_name_2;
350     PyObject *tmp_source_name_3; 347     PyObject *tmp_source_name_3;
351     PyObject *tmp_subscribed_name_1; 348     PyObject *tmp_subscribed_name_1;
352     PyObject *tmp_subscript_name_1; 349     PyObject *tmp_subscript_name_1;
745         exception_lineno = 30; 742         exception_lineno = 30;
746 743
747         goto try_except_handler_1; 744         goto try_except_handler_1;
748     } 745     }
749     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_17 ); 746     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_17 );
n 750     tmp_left_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); n 747     tmp_cond_value_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
751 748
n 752     if (unlikely( tmp_left_name_3 == NULL )) n 749     if (unlikely( tmp_cond_value_1 == NULL ))
753     { 750     {
n 754         tmp_left_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 751         tmp_cond_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
755     } 752     }
756 753
n 757     if ( tmp_left_name_3 == NULL ) n 754     if ( tmp_cond_value_1 == NULL )
758     { 755     {
759 756
760         exception_type = PyExc_NameError; 757         exception_type = PyExc_NameError;
761         Py_INCREF( exception_type ); 758         Py_INCREF( exception_type );
n 762         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); n 759         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
763         exception_tb = NULL; 760         exception_tb = NULL;
764         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 761         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
765         CHAIN_EXCEPTION( exception_value ); 762         CHAIN_EXCEPTION( exception_value );
766 763
n 767         exception_lineno = 33; n 764         exception_lineno = 35;
768 765
769         goto try_except_handler_1; 766         goto try_except_handler_1;
770     } 767     }
771 768
n 772     tmp_right_name_3 = const_int_pos_2; n 769     tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
773     tmp_compare_left_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_3, tmp_right_name_3 ); 770     if ( tmp_cond_truth_1 == -1 )
774     if ( tmp_compare_left_2 == NULL )
775     { 771     {
776         assert( ERROR_OCCURRED() ); 772         assert( ERROR_OCCURRED() );
777 773
778         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 774         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
779 775
780 776
n 781         exception_lineno = 33; n 777         exception_lineno = 35;
782 778
783         goto try_except_handler_1; 779         goto try_except_handler_1;
784     } 780     }
t 785     tmp_compare_right_2 = const_int_0; t
786     tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 );
787     if ( tmp_cmp_Eq_1 == -1 )
788     {
789         assert( ERROR_OCCURRED() );
790  
791         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
792         Py_DECREF( tmp_compare_left_2 );
793  
794         exception_lineno = 33;
795  
796         goto try_except_handler_1;
797     }
798     Py_DECREF( tmp_compare_left_2 );
799     if ( tmp_cmp_Eq_1 == 1 ) 781     if ( tmp_cond_truth_1 == 1 )
800     { 782     {
801         goto branch_yes_1; 783         goto branch_yes_1;
802     } 784     }
803     else 785     else
804     { 786     {