Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1439234988.95192307692307257.0CPython 2.78000437242.31730769230768366.7485749065488Nuitka (master)7999993395.6826923076923366.7561983480571Nuitka (develop)8000017549.0480769230769366.7557862701378Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2828556688.95192307692307257.0CPython 3.518148131242.31730769230768345.56517663597265Nuitka (master)18146134395.6826923076923345.5826233232009Nuitka (develop)18146154549.0480769230769345.5824485942352Nuitka (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
321     PyObject *tmp_assign_source_16; 321     PyObject *tmp_assign_source_16;
322     PyObject *tmp_assign_source_17; 322     PyObject *tmp_assign_source_17;
323     PyObject *tmp_assign_source_18; 323     PyObject *tmp_assign_source_18;
324     PyObject *tmp_called_name_1; 324     PyObject *tmp_called_name_1;
325     PyObject *tmp_called_name_2; 325     PyObject *tmp_called_name_2;
n 326     int tmp_cmp_Eq_1; n
327     int tmp_cmp_Lt_1; 326     int tmp_cmp_Lt_1;
328     PyObject *tmp_compare_left_1; 327     PyObject *tmp_compare_left_1;
n 329     PyObject *tmp_compare_left_2; n
330     PyObject *tmp_compare_right_1; 328     PyObject *tmp_compare_right_1;
n 331     PyObject *tmp_compare_right_2; n
332     PyObject *tmp_compexpr_left_1; 329     PyObject *tmp_compexpr_left_1;
333     PyObject *tmp_compexpr_right_1; 330     PyObject *tmp_compexpr_right_1;
n n 331     int tmp_cond_truth_1;
332     PyObject *tmp_cond_value_1;
334     PyObject *tmp_fromlist_name_1; 333     PyObject *tmp_fromlist_name_1;
335     PyObject *tmp_fromlist_name_2; 334     PyObject *tmp_fromlist_name_2;
336     PyObject *tmp_globals_name_1; 335     PyObject *tmp_globals_name_1;
337     PyObject *tmp_globals_name_2; 336     PyObject *tmp_globals_name_2;
338     PyObject *tmp_int_arg_1; 337     PyObject *tmp_int_arg_1;
339     PyObject *tmp_iter_arg_1; 338     PyObject *tmp_iter_arg_1;
340     PyObject *tmp_left_name_1; 339     PyObject *tmp_left_name_1;
341     PyObject *tmp_left_name_2; 340     PyObject *tmp_left_name_2;
n 342     PyObject *tmp_left_name_3; n
343     PyObject *tmp_len_arg_1; 341     PyObject *tmp_len_arg_1;
344     PyObject *tmp_level_name_1; 342     PyObject *tmp_level_name_1;
345     PyObject *tmp_level_name_2; 343     PyObject *tmp_level_name_2;
346     PyObject *tmp_locals_name_1; 344     PyObject *tmp_locals_name_1;
347     PyObject *tmp_locals_name_2; 345     PyObject *tmp_locals_name_2;
349     PyObject *tmp_name_name_2; 347     PyObject *tmp_name_name_2;
350     PyObject *tmp_next_source_1; 348     PyObject *tmp_next_source_1;
351     PyObject *tmp_operand_name_1; 349     PyObject *tmp_operand_name_1;
352     PyObject *tmp_right_name_1; 350     PyObject *tmp_right_name_1;
353     PyObject *tmp_right_name_2; 351     PyObject *tmp_right_name_2;
n 354     PyObject *tmp_right_name_3; n
355     PyObject *tmp_source_name_1; 352     PyObject *tmp_source_name_1;
356     PyObject *tmp_source_name_2; 353     PyObject *tmp_source_name_2;
357     PyObject *tmp_source_name_3; 354     PyObject *tmp_source_name_3;
358     PyObject *tmp_subscribed_name_1; 355     PyObject *tmp_subscribed_name_1;
359     PyObject *tmp_subscript_name_1; 356     PyObject *tmp_subscript_name_1;
751         exception_lineno = 30; 748         exception_lineno = 30;
752 749
753         goto try_except_handler_1; 750         goto try_except_handler_1;
754     } 751     }
755     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_17 ); 752     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_17 );
n 756     tmp_left_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); n 753     tmp_cond_value_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
757 754
n 758     if (unlikely( tmp_left_name_3 == NULL )) n 755     if (unlikely( tmp_cond_value_1 == NULL ))
759     { 756     {
n 760         tmp_left_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 757         tmp_cond_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
761     } 758     }
762 759
n 763     if ( tmp_left_name_3 == NULL ) n 760     if ( tmp_cond_value_1 == NULL )
764     { 761     {
765 762
766         exception_type = PyExc_NameError; 763         exception_type = PyExc_NameError;
767         Py_INCREF( exception_type ); 764         Py_INCREF( exception_type );
n 768         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); n 765         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
769         exception_tb = NULL; 766         exception_tb = NULL;
770         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 767         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
771         CHAIN_EXCEPTION( exception_value ); 768         CHAIN_EXCEPTION( exception_value );
772 769
n 773         exception_lineno = 33; n 770         exception_lineno = 35;
774 771
775         goto try_except_handler_1; 772         goto try_except_handler_1;
776     } 773     }
777 774
n 778     tmp_right_name_3 = const_int_pos_2; n 775     tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 );
779     tmp_compare_left_2 = BINARY_OPERATION_REMAINDER( tmp_left_name_3, tmp_right_name_3 ); 776     if ( tmp_cond_truth_1 == -1 )
780     if ( tmp_compare_left_2 == NULL )
781     { 777     {
782         assert( ERROR_OCCURRED() ); 778         assert( ERROR_OCCURRED() );
783 779
784         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 780         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
785 781
786 782
n 787         exception_lineno = 33; n 783         exception_lineno = 35;
788 784
789         goto try_except_handler_1; 785         goto try_except_handler_1;
790     } 786     }
t 791     tmp_compare_right_2 = const_int_0; t
792     tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 );
793     if ( tmp_cmp_Eq_1 == -1 )
794     {
795         assert( ERROR_OCCURRED() );
796  
797         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
798         Py_DECREF( tmp_compare_left_2 );
799  
800         exception_lineno = 33;
801  
802         goto try_except_handler_1;
803     }
804     Py_DECREF( tmp_compare_left_2 );
805     if ( tmp_cmp_Eq_1 == 1 ) 787     if ( tmp_cond_truth_1 == 1 )
806     { 788     {
807         goto branch_yes_1; 789         goto branch_yes_1;
808     } 790     }
809     else 791     else
810     { 792     {