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)8025049441.69230769230774366.3277888501413Nuitka (develop)8024322564.3846153846155366.3402712140647Nuitka (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)18219815441.69230769230774344.936313138534Nuitka (develop)18220452564.3846153846155344.93074793007656Nuitka (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;
630         exception_lineno = 27; 627         exception_lineno = 27;
631 628
632         goto try_except_handler_1; 629         goto try_except_handler_1;
633     } 630     }
634     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 ); 631     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_12 );
n 635     tmp_left_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); n 632     tmp_cond_value_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
636 633
n 637     if (unlikely( tmp_left_name_2 == NULL )) n 634     if (unlikely( tmp_cond_value_1 == NULL ))
638     { 635     {
n 639         tmp_left_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 636         tmp_cond_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
640     } 637     }
641 638
n 642     if ( tmp_left_name_2 == NULL ) n 639     if ( tmp_cond_value_1 == NULL )
643     { 640     {
644 641
645         exception_type = PyExc_NameError; 642         exception_type = PyExc_NameError;
646         Py_INCREF( exception_type ); 643         Py_INCREF( exception_type );
n 647         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); n 644         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
648         exception_tb = NULL; 645         exception_tb = NULL;
649         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 646         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
650         CHAIN_EXCEPTION( exception_value ); 647         CHAIN_EXCEPTION( exception_value );
651 648
n 652         exception_lineno = 30; n 649         exception_lineno = 32;
653 650
654         goto try_except_handler_1; 651         goto try_except_handler_1;
655     } 652     }
656 653
n 657     tmp_right_name_2 = const_int_pos_2; n 654     tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
658     tmp_compare_left_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_2, tmp_right_name_2 ); 655     if ( tmp_cond_truth_1 == -1 )
659     if ( tmp_compare_left_2 == NULL )
660     { 656     {
661         assert( ERROR_OCCURRED() ); 657         assert( ERROR_OCCURRED() );
662 658
663         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 659         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
664 660
665 661
n 666         exception_lineno = 30; n 662         exception_lineno = 32;
667 663
668         goto try_except_handler_1; 664         goto try_except_handler_1;
669     } 665     }
t 670     tmp_compare_right_2 = const_int_0; t
671     tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 );
672     if ( tmp_cmp_Eq_1 == -1 )
673     {
674         assert( ERROR_OCCURRED() );
675  
676         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
677         Py_DECREF( tmp_compare_left_2 );
678  
679         exception_lineno = 30;
680  
681         goto try_except_handler_1;
682     }
683     Py_DECREF( tmp_compare_left_2 );
684     if ( tmp_cmp_Eq_1 == 1 ) 666     if ( tmp_cond_truth_1 == 1 )
685     { 667     {
686         goto branch_yes_1; 668         goto branch_yes_1;
687     } 669     }
688     else 670     else
689     { 671     {