Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1439253773.61538461538461257.0CPython 2.78124806196.30769230769232364.6149921817654Nuitka (historic)8024954319.0000000000001366.329419970599Nuitka (master)8024954441.69230769230774366.329419970599Nuitka (develop)8024960564.3846153846155366.3293169524648Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)2828510473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)18070201319.0000000000001346.2434294621595Nuitka (master)18071050441.69230769230774346.23601209641333Nuitka (develop)18070712564.3846153846155346.2389650641662Nuitka (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
303     PyObject *tmp_assign_source_10; 303     PyObject *tmp_assign_source_10;
304     PyObject *tmp_assign_source_11; 304     PyObject *tmp_assign_source_11;
305     PyObject *tmp_assign_source_12; 305     PyObject *tmp_assign_source_12;
306     PyObject *tmp_assign_source_13; 306     PyObject *tmp_assign_source_13;
307     PyObject *tmp_called_name_1; 307     PyObject *tmp_called_name_1;
n 308     int tmp_cmp_Eq_1; n
309     int tmp_cmp_Lt_1; 308     int tmp_cmp_Lt_1;
310     PyObject *tmp_compare_left_1; 309     PyObject *tmp_compare_left_1;
n 311     PyObject *tmp_compare_left_2; n
312     PyObject *tmp_compare_right_1; 310     PyObject *tmp_compare_right_1;
n 313     PyObject *tmp_compare_right_2; n
314     PyObject *tmp_compexpr_left_1; 311     PyObject *tmp_compexpr_left_1;
315     PyObject *tmp_compexpr_right_1; 312     PyObject *tmp_compexpr_right_1;
n n 313     int tmp_cond_truth_1;
314     PyObject *tmp_cond_value_1;
316     PyObject *tmp_fromlist_name_1; 315     PyObject *tmp_fromlist_name_1;
317     PyObject *tmp_globals_name_1; 316     PyObject *tmp_globals_name_1;
318     PyObject *tmp_int_arg_1; 317     PyObject *tmp_int_arg_1;
319     PyObject *tmp_iter_arg_1; 318     PyObject *tmp_iter_arg_1;
320     PyObject *tmp_left_name_1; 319     PyObject *tmp_left_name_1;
n 321     PyObject *tmp_left_name_2; n
322     PyObject *tmp_len_arg_1; 320     PyObject *tmp_len_arg_1;
323     PyObject *tmp_level_name_1; 321     PyObject *tmp_level_name_1;
324     PyObject *tmp_locals_name_1; 322     PyObject *tmp_locals_name_1;
325     PyObject *tmp_name_name_1; 323     PyObject *tmp_name_name_1;
326     PyObject *tmp_next_source_1; 324     PyObject *tmp_next_source_1;
327     PyObject *tmp_operand_name_1; 325     PyObject *tmp_operand_name_1;
328     PyObject *tmp_right_name_1; 326     PyObject *tmp_right_name_1;
n 329     PyObject *tmp_right_name_2; n
330     PyObject *tmp_source_name_1; 327     PyObject *tmp_source_name_1;
331     PyObject *tmp_source_name_2; 328     PyObject *tmp_source_name_2;
332     PyObject *tmp_subscribed_name_1; 329     PyObject *tmp_subscribed_name_1;
333     PyObject *tmp_subscript_name_1; 330     PyObject *tmp_subscript_name_1;
334     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 331     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
634         exception_lineno = 27; 631         exception_lineno = 27;
635 632
636         goto try_except_handler_1; 633         goto try_except_handler_1;
637     } 634     }
638     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 ); 635     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 );
n 639     tmp_left_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); n 636     tmp_cond_value_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
640 637
n 641     if (unlikely( tmp_left_name_2 == NULL )) n 638     if (unlikely( tmp_cond_value_1 == NULL ))
642     { 639     {
n 643         tmp_left_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 640         tmp_cond_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
644     } 641     }
645 642
n 646     if ( tmp_left_name_2 == NULL ) n 643     if ( tmp_cond_value_1 == NULL )
647     { 644     {
648 645
649         exception_type = PyExc_NameError; 646         exception_type = PyExc_NameError;
650         Py_INCREF( exception_type ); 647         Py_INCREF( exception_type );
n 651         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); n 648         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
652         exception_tb = NULL; 649         exception_tb = NULL;
653         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 650         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
654         CHAIN_EXCEPTION( exception_value ); 651         CHAIN_EXCEPTION( exception_value );
655 652
n 656         exception_lineno = 30; n 653         exception_lineno = 32;
657 654
658         goto try_except_handler_1; 655         goto try_except_handler_1;
659     } 656     }
660 657
n 661     tmp_right_name_2 = const_int_pos_2; n 658     tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
662     tmp_compare_left_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_2, tmp_right_name_2 ); 659     if ( tmp_cond_truth_1 == -1 )
663     if ( tmp_compare_left_2 == NULL )
664     { 660     {
665         assert( ERROR_OCCURRED() ); 661         assert( ERROR_OCCURRED() );
666 662
667         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 663         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
668 664
669 665
n 670         exception_lineno = 30; n 666         exception_lineno = 32;
671 667
672         goto try_except_handler_1; 668         goto try_except_handler_1;
673     } 669     }
t 674     tmp_compare_right_2 = const_int_0; t
675     tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 );
676     if ( tmp_cmp_Eq_1 == -1 )
677     {
678         assert( ERROR_OCCURRED() );
679  
680         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
681         Py_DECREF( tmp_compare_left_2 );
682  
683         exception_lineno = 30;
684  
685         goto try_except_handler_1;
686     }
687     Py_DECREF( tmp_compare_left_2 );
688     if ( tmp_cmp_Eq_1 == 1 ) 670     if ( tmp_cond_truth_1 == 1 )
689     { 671     {
690         goto branch_yes_1; 672         goto branch_yes_1;
691     } 673     }
692     else 674     else
693     { 675     {