Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1439253773.61538461538461257.0CPython 2.78124806196.30769230769232364.6149921817654Nuitka (historic)8025082319.0000000000001366.3272222504034Nuitka (master)8025132441.69230769230774366.326363765952Nuitka (develop)8025132564.3846153846155366.326363765952Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2828510473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)18221635319.0000000000001344.92041254294134Nuitka (master)18221000441.69230769230774344.9259602782168Nuitka (develop)18222730564.3846153846155344.9108459758128Nuitka (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])

for x in xrange(loop_count):
    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])

for x in xrange(loop_count):
    y = x % 2 == 0

# construct_begin

# construct_alternative
    if y:
# construct_end
        y = not y

print("OK.")

Context Diff of Source Code


Construct
Baseline
25 25
26 for x in xrange(loop_count): 26 for x in xrange(loop_count):
27     y = x % 2 == 0 27     y = x % 2 == 0
28 28
29 # construct_begin 29 # construct_begin
n 30     if x % 2 == 0: n 30  
31 # construct_alternative 31 # construct_alternative
t 32   t 32     if y:
33   33 # construct_end
34         y = not y 34         y = not y
35 35
36 print("OK.") 36 print("OK.")
37 37

Context Diff of Generated Code


Construct
Baseline
298     PyObject *tmp_assign_source_10; 298     PyObject *tmp_assign_source_10;
299     PyObject *tmp_assign_source_11; 299     PyObject *tmp_assign_source_11;
300     PyObject *tmp_assign_source_12; 300     PyObject *tmp_assign_source_12;
301     PyObject *tmp_assign_source_13; 301     PyObject *tmp_assign_source_13;
302     PyObject *tmp_called_name_1; 302     PyObject *tmp_called_name_1;
n 303     int tmp_cmp_Eq_1; n
304     int tmp_cmp_Lt_1; 303     int tmp_cmp_Lt_1;
305     PyObject *tmp_compare_left_1; 304     PyObject *tmp_compare_left_1;
n 306     PyObject *tmp_compare_left_2; n
307     PyObject *tmp_compare_right_1; 305     PyObject *tmp_compare_right_1;
n 308     PyObject *tmp_compare_right_2; n
309     PyObject *tmp_compexpr_left_1; 306     PyObject *tmp_compexpr_left_1;
310     PyObject *tmp_compexpr_right_1; 307     PyObject *tmp_compexpr_right_1;
n n 308     int tmp_cond_truth_1;
309     PyObject *tmp_cond_value_1;
311     PyObject *tmp_import_globals_1; 310     PyObject *tmp_import_globals_1;
312     PyObject *tmp_int_arg_1; 311     PyObject *tmp_int_arg_1;
313     PyObject *tmp_iter_arg_1; 312     PyObject *tmp_iter_arg_1;
314     PyObject *tmp_left_name_1; 313     PyObject *tmp_left_name_1;
n 315     PyObject *tmp_left_name_2; n
316     PyObject *tmp_len_arg_1; 314     PyObject *tmp_len_arg_1;
317     PyObject *tmp_next_source_1; 315     PyObject *tmp_next_source_1;
318     PyObject *tmp_operand_name_1; 316     PyObject *tmp_operand_name_1;
319     PyObject *tmp_right_name_1; 317     PyObject *tmp_right_name_1;
n 320     PyObject *tmp_right_name_2; n
321     PyObject *tmp_source_name_1; 318     PyObject *tmp_source_name_1;
322     PyObject *tmp_source_name_2; 319     PyObject *tmp_source_name_2;
323     PyObject *tmp_subscribed_name_1; 320     PyObject *tmp_subscribed_name_1;
324     PyObject *tmp_subscript_name_1; 321     PyObject *tmp_subscript_name_1;
325     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 322     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
618 615
619         exception_lineno = 27; 616         exception_lineno = 27;
620         goto try_except_handler_1; 617         goto try_except_handler_1;
621     } 618     }
622     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 ); 619     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 );
n 623     tmp_left_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); n 620     tmp_cond_value_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
624 621
n 625     if (unlikely( tmp_left_name_2 == NULL )) n 622     if (unlikely( tmp_cond_value_1 == NULL ))
626     { 623     {
n 627         tmp_left_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 624         tmp_cond_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
628     } 625     }
629 626
n 630     if ( tmp_left_name_2 == NULL ) n 627     if ( tmp_cond_value_1 == NULL )
631     { 628     {
632 629
633         exception_type = PyExc_NameError; 630         exception_type = PyExc_NameError;
634         Py_INCREF( exception_type ); 631         Py_INCREF( exception_type );
n 635         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); n 632         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
636         exception_tb = NULL; 633         exception_tb = NULL;
637         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 634         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
638         CHAIN_EXCEPTION( exception_value ); 635         CHAIN_EXCEPTION( exception_value );
639 636
n 640         exception_lineno = 30; n 637         exception_lineno = 32;
641         goto try_except_handler_1; 638         goto try_except_handler_1;
642     } 639     }
643 640
n 644     tmp_right_name_2 = const_int_pos_2; n 641     tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
645     tmp_compare_left_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_2, tmp_right_name_2 ); 642     if ( tmp_cond_truth_1 == -1 )
646     if ( tmp_compare_left_2 == NULL )
647     { 643     {
648         assert( ERROR_OCCURRED() ); 644         assert( ERROR_OCCURRED() );
649 645
650         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 646         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
651 647
652 648
n 653         exception_lineno = 30; n 649         exception_lineno = 32;
654         goto try_except_handler_1; 650         goto try_except_handler_1;
655     } 651     }
t 656     tmp_compare_right_2 = const_int_0; t
657     tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 );
658     if ( tmp_cmp_Eq_1 == -1 )
659     {
660         assert( ERROR_OCCURRED() );
661  
662         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
663         Py_DECREF( tmp_compare_left_2 );
664  
665         exception_lineno = 30;
666         goto try_except_handler_1;
667     }
668     Py_DECREF( tmp_compare_left_2 );
669     if ( tmp_cmp_Eq_1 == 1 ) 652     if ( tmp_cond_truth_1 == 1 )
670     { 653     {
671         goto branch_yes_1; 654         goto branch_yes_1;
672     } 655     }
673     else 656     else
674     { 657     {