Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1439253773.61538461538461257.0CPython 2.78124806196.30769230769232364.6149921817654Nuitka (historic)8025156319.0000000000001366.3259516934153Nuitka (master)8025078441.69230769230774366.3272909291595Nuitka (develop)8024304564.3846153846155366.34058026846725Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2828510473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)18222092319.0000000000001344.91641992086124Nuitka (master)18222071441.69230769230774344.9166033892719Nuitka (develop)18223639564.3846153846155344.90290441460746Nuitka (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
301     PyObject *tmp_assign_source_10; 301     PyObject *tmp_assign_source_10;
302     PyObject *tmp_assign_source_11; 302     PyObject *tmp_assign_source_11;
303     PyObject *tmp_assign_source_12; 303     PyObject *tmp_assign_source_12;
304     PyObject *tmp_assign_source_13; 304     PyObject *tmp_assign_source_13;
305     PyObject *tmp_called_name_1; 305     PyObject *tmp_called_name_1;
n 306     int tmp_cmp_Eq_1; n
307     int tmp_cmp_Lt_1; 306     int tmp_cmp_Lt_1;
308     PyObject *tmp_compare_left_1; 307     PyObject *tmp_compare_left_1;
n 309     PyObject *tmp_compare_left_2; n
310     PyObject *tmp_compare_right_1; 308     PyObject *tmp_compare_right_1;
n 311     PyObject *tmp_compare_right_2; n
312     PyObject *tmp_compexpr_left_1; 309     PyObject *tmp_compexpr_left_1;
313     PyObject *tmp_compexpr_right_1; 310     PyObject *tmp_compexpr_right_1;
n n 311     int tmp_cond_truth_1;
312     PyObject *tmp_cond_value_1;
314     PyObject *tmp_fromlist_name_1; 313     PyObject *tmp_fromlist_name_1;
315     PyObject *tmp_globals_name_1; 314     PyObject *tmp_globals_name_1;
316     PyObject *tmp_int_arg_1; 315     PyObject *tmp_int_arg_1;
317     PyObject *tmp_iter_arg_1; 316     PyObject *tmp_iter_arg_1;
318     PyObject *tmp_left_name_1; 317     PyObject *tmp_left_name_1;
n 319     PyObject *tmp_left_name_2; n
320     PyObject *tmp_len_arg_1; 318     PyObject *tmp_len_arg_1;
321     PyObject *tmp_level_name_1; 319     PyObject *tmp_level_name_1;
322     PyObject *tmp_locals_name_1; 320     PyObject *tmp_locals_name_1;
323     PyObject *tmp_name_name_1; 321     PyObject *tmp_name_name_1;
324     PyObject *tmp_next_source_1; 322     PyObject *tmp_next_source_1;
325     PyObject *tmp_operand_name_1; 323     PyObject *tmp_operand_name_1;
326     PyObject *tmp_right_name_1; 324     PyObject *tmp_right_name_1;
n 327     PyObject *tmp_right_name_2; n
328     PyObject *tmp_source_name_1; 325     PyObject *tmp_source_name_1;
329     PyObject *tmp_source_name_2; 326     PyObject *tmp_source_name_2;
330     PyObject *tmp_subscribed_name_1; 327     PyObject *tmp_subscribed_name_1;
331     PyObject *tmp_subscript_name_1; 328     PyObject *tmp_subscript_name_1;
332     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 329     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
619 616
620         exception_lineno = 27; 617         exception_lineno = 27;
621         goto try_except_handler_1; 618         goto try_except_handler_1;
622     } 619     }
623     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 ); 620     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 );
n 624     tmp_left_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); n 621     tmp_cond_value_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
625 622
n 626     if (unlikely( tmp_left_name_2 == NULL )) n 623     if (unlikely( tmp_cond_value_1 == NULL ))
627     { 624     {
n 628         tmp_left_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 625         tmp_cond_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
629     } 626     }
630 627
n 631     if ( tmp_left_name_2 == NULL ) n 628     if ( tmp_cond_value_1 == NULL )
632     { 629     {
633 630
634         exception_type = PyExc_NameError; 631         exception_type = PyExc_NameError;
635         Py_INCREF( exception_type ); 632         Py_INCREF( exception_type );
n 636         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); n 633         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
637         exception_tb = NULL; 634         exception_tb = NULL;
638         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 635         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
639         CHAIN_EXCEPTION( exception_value ); 636         CHAIN_EXCEPTION( exception_value );
640 637
n 641         exception_lineno = 30; n 638         exception_lineno = 32;
642         goto try_except_handler_1; 639         goto try_except_handler_1;
643     } 640     }
644 641
n 645     tmp_right_name_2 = const_int_pos_2; n 642     tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
646     tmp_compare_left_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_2, tmp_right_name_2 ); 643     if ( tmp_cond_truth_1 == -1 )
647     if ( tmp_compare_left_2 == NULL )
648     { 644     {
649         assert( ERROR_OCCURRED() ); 645         assert( ERROR_OCCURRED() );
650 646
651         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 647         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
652 648
653 649
n 654         exception_lineno = 30; n 650         exception_lineno = 32;
655         goto try_except_handler_1; 651         goto try_except_handler_1;
656     } 652     }
t 657     tmp_compare_right_2 = const_int_0; t
658     tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 );
659     if ( tmp_cmp_Eq_1 == -1 )
660     {
661         assert( ERROR_OCCURRED() );
662  
663         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
664         Py_DECREF( tmp_compare_left_2 );
665  
666         exception_lineno = 30;
667         goto try_except_handler_1;
668     }
669     Py_DECREF( tmp_compare_left_2 );
670     if ( tmp_cmp_Eq_1 == 1 ) 653     if ( tmp_cond_truth_1 == 1 )
671     { 654     {
672         goto branch_yes_1; 655         goto branch_yes_1;
673     } 656     }
674     else 657     else
675     { 658     {