Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgen: fix codegen to emit callexpr one time for in expr optimization #22764

Merged
merged 3 commits into from
Nov 5, 2024

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Nov 4, 2024

@felipensp felipensp changed the title cgen: fix codegen to emit callexpr onnce on in expr optimization cgen: fix codegen to emit callexpr one time for in expr optimization Nov 4, 2024
@felipensp felipensp marked this pull request as ready for review November 5, 2024 09:39
@spytheman
Copy link
Member

The issue was also fixed in #22763 . The fix there disabled the optimization for anything but ident in [x,y,z], which works, but is slower 🤔 by ~10% for v -o vnew cmd/v .

I'll have to measure the performance impact of this PR before merging.

@spytheman
Copy link
Member

#0 14:43:20 ^ fix_in_expr_call_once /space/v/oo>v run .github/workflows/compare_pr_to_master.v 
Current git branch: fix_in_expr_call_once, commit: b79243e
    Compiling new V executables from PR branch: fix_in_expr_call_once, commit: b79243e ...
CPU: 2.40s      Real: 2.63s     Elapsed: 0:02.63        RAM: 400468KB   ./v -o vnew1 cmd/v
CPU: 2.42s      Real: 2.62s     Elapsed: 0:02.62        RAM: 400480KB   ./vnew1 -o vnew2 cmd/v
CPU: 2.38s      Real: 2.62s     Elapsed: 0:02.62        RAM: 400480KB   ./vnew2 -o vnew cmd/v
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
    Compiling old V executables from branch: master, commit: 584cedd ...
CPU: 2.39s      Real: 2.63s     Elapsed: 0:02.63        RAM: 400452KB   ./v -o vold1 cmd/v
CPU: 2.40s      Real: 2.63s     Elapsed: 0:02.63        RAM: 400464KB   ./vold1 -o vold2 cmd/v
CPU: 2.38s      Real: 2.64s     Elapsed: 0:02.64        RAM: 400456KB   ./vold2 -o vold cmd/v
Switched to branch 'fix_in_expr_call_once'
    Measuring at PR branch: fix_in_expr_call_once, commit: b79243e ...
>Size of ./vold: 10390672
>Size of ./vnew: 10393056
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.3% 1.00x faster 109.6ms ± σ:   0.4ms, 109.2ms…110.1ms `./vnew -check-syntax examples/hello_world.v`
 >  2         base         109.9ms ± σ:   0.9ms, 108.7ms…110.9ms `./vold -check-syntax examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -0.1% 1.00x ~same~ 110.0ms ± σ:   1.2ms, 108.3ms…111.0ms `./vnew -check-syntax examples/hello_world.v`
 >  2         base         110.2ms ± σ:   1.1ms, 108.7ms…111.0ms `./vold -check-syntax examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
 >  1         base         109.4ms ± σ:   0.1ms, 109.3ms…109.5ms `./vold -check-syntax examples/hello_world.v`
    2   +0.3% 1.00x slower 109.7ms ± σ:   1.0ms, 108.3ms…110.5ms `./vnew -check-syntax examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
 >  1         base         161.6ms ± σ:   0.9ms, 160.5ms…162.6ms `./vold -check        examples/hello_world.v`
    2   +0.3% 1.00x slower 162.0ms ± σ:   0.6ms, 161.2ms…162.7ms `./vnew -check        examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
 >  1         base         161.5ms ± σ:   1.0ms, 160.2ms…162.4ms `./vold -check        examples/hello_world.v`
    2   +0.5% 1.01x slower 162.4ms ± σ:   0.8ms, 161.3ms…163.2ms `./vnew -check        examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
 >  1         base         161.6ms ± σ:   1.0ms, 160.1ms…162.6ms `./vold -check        examples/hello_world.v`
    2   +0.4% 1.00x slower 162.2ms ± σ:   1.3ms, 160.4ms…163.2ms `./vnew -check        examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.5% 1.01x faster 221.5ms ± σ:   0.7ms, 220.6ms…222.1ms `./vnew -o  nhw.c     examples/hello_world.v`
 >  2         base         222.7ms ± σ:   0.3ms, 222.5ms…223.1ms `./vold -o  ohw.c     examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
 >  1         base         221.7ms ± σ:   0.2ms, 221.5ms…221.9ms `./vold -o  ohw.c     examples/hello_world.v`
    2   +0.0% 1.00x ~same~ 221.8ms ± σ:   1.4ms, 220.1ms…223.5ms `./vnew -o  nhw.c     examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.7% 1.01x faster 221.5ms ± σ:   0.7ms, 220.5ms…222.1ms `./vnew -o  nhw.c     examples/hello_world.v`
 >  2         base         223.0ms ± σ:   0.3ms, 222.6ms…223.2ms `./vold -o  ohw.c     examples/hello_world.v`
>Size of ohw.c: 449928
>Size of nhw.c: 449928
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.3% 1.00x faster 250.7ms ± σ:   0.2ms, 250.4ms…251.0ms `./vnew -o  nhw.exe   examples/hello_world.v`
 >  2         base         251.3ms ± σ:   0.3ms, 250.9ms…251.6ms `./vold -o  ohw.exe   examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -0.0% 1.00x ~same~ 250.4ms ± σ:   0.2ms, 250.2ms…250.6ms `./vnew -o  nhw.exe   examples/hello_world.v`
 >  2         base         250.6ms ± σ:   0.2ms, 250.3ms…250.7ms `./vold -o  ohw.exe   examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.0% 1.00x ~same~ 250.4ms ± σ:   0.3ms, 250.2ms…250.8ms `./vnew -o  nhw.exe   examples/hello_world.v`
 >  2         base         250.5ms ± σ:   0.4ms, 249.9ms…250.8ms `./vold -o  ohw.exe   examples/hello_world.v`
>Size of ohw.exe: 718192
>Size of nhw.exe: 718192
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.3% 1.00x faster 894.9ms ± σ:   1.0ms, 893.6ms…895.8ms `./vnew -check-syntax cmd/v`
 >  2         base         897.7ms ± σ:   0.7ms, 897.2ms…898.8ms `./vold -check-syntax cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -0.7% 1.01x faster 892.7ms ± σ:   0.5ms, 892.1ms…893.1ms `./vnew -check-syntax cmd/v`
 >  2         base         899.1ms ± σ:   1.5ms, 897.2ms…900.8ms `./vold -check-syntax cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.5% 1.00x faster 893.6ms ± σ:   0.6ms, 892.8ms…894.3ms `./vnew -check-syntax cmd/v`
 >  2         base         897.9ms ± σ:   1.3ms, 896.1ms…899.1ms `./vold -check-syntax cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.0% 1.00x ~same~ 1495.1ms ± σ:   1.1ms, 1493.8ms…1496.5ms `./vnew -check        cmd/v`
 >  2         base         1495.4ms ± σ:   0.8ms, 1494.7ms…1496.4ms `./vold -check        cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
 >  1         base         1494.4ms ± σ:   1.8ms, 1492.0ms…1495.8ms `./vold -check        cmd/v`
    2   +0.1% 1.00x ~same~ 1495.4ms ± σ:   0.7ms, 1494.8ms…1496.4ms `./vnew -check        cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.1% 1.00x ~same~ 1495.6ms ± σ:   1.3ms, 1493.8ms…1496.8ms `./vnew -check        cmd/v`
 >  2         base         1497.3ms ± σ:   0.1ms, 1497.1ms…1497.3ms `./vold -check        cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.3% 1.00x faster 2194.6ms ± σ:   1.7ms, 2192.7ms…2196.7ms `./vnew -o  nv.c      cmd/v`
 >  2         base         2201.1ms ± σ:   0.9ms, 2199.8ms…2201.9ms `./vold -o  ov.c      cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -0.3% 1.00x faster 2196.0ms ± σ:   1.0ms, 2194.8ms…2197.1ms `./vnew -o  nv.c      cmd/v`
 >  2         base         2202.8ms ± σ:   0.4ms, 2202.3ms…2203.3ms `./vold -o  ov.c      cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.3% 1.00x faster 2196.6ms ± σ:   1.2ms, 2194.9ms…2197.6ms `./vnew -o  nv.c      cmd/v`
 >  2         base         2202.1ms ± σ:   0.7ms, 2201.5ms…2203.1ms `./vold -o  ov.c      cmd/v`
>Size of ov.c: 6804511
>Size of nv.c: 6804511
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.3% 1.00x faster 2627.6ms ± σ:   0.1ms, 2627.5ms…2627.8ms `./vnew -o  nv.exe    cmd/v`
 >  2         base         2635.9ms ± σ:   0.3ms, 2635.5ms…2636.2ms `./vold -o  ov.exe    cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -0.2% 1.00x faster 2628.3ms ± σ:   0.8ms, 2627.2ms…2629.1ms `./vnew -o  nv.exe    cmd/v`
 >  2         base         2634.4ms ± σ:   1.2ms, 2633.3ms…2636.0ms `./vold -o  ov.exe    cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.2% 1.00x faster 2628.9ms ± σ:   1.0ms, 2627.5ms…2629.7ms `./vnew -o  nv.exe    cmd/v`
 >  2         base         2635.3ms ± σ:   0.8ms, 2634.2ms…2636.2ms `./vold -o  ov.exe    cmd/v`
>Size of ov.exe: 10393056
>Size of nv.exe: 10393056
Done. Total time: 591.745779291 s.
#0 14:53:15 ^ fix_in_expr_call_once /space/v/oo>tig
#0 14:56:58 ^ fix_in_expr_call_once /space/v/oo>
#0 14:57:10 ^ fix_in_expr_call_once /space/v/oo>
#0 14:57:10 ^ fix_in_expr_call_once /space/v/oo>
#0 14:57:14 ^ fix_in_expr_call_once /space/v/oo>
#0 14:57:14 ^ fix_in_expr_call_once /space/v/oo>v run .github/workflows/compare_pr_to_master.v -prod
Current git branch: fix_in_expr_call_once, commit: b79243e
    Compiling new V executables from PR branch: fix_in_expr_call_once, commit: b79243e ...
CPU: 2.39s      Real: 2.64s     Elapsed: 0:02.64        RAM: 400468KB   ./v -o vnew1 cmd/v
CPU: 2.39s      Real: 2.62s     Elapsed: 0:02.62        RAM: 400480KB   ./vnew1 -o vnew2 cmd/v
CPU: 2.39s      Real: 2.63s     Elapsed: 0:02.63        RAM: 400480KB   ./vnew2 -o vnew cmd/v
CPU: 97.26s     Real: 100.14s   Elapsed: 1:40.14        RAM: 429832KB   ./vnew -prod -o vnew_prod cmd/v
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
    Compiling old V executables from branch: master, commit: 584cedd ...
CPU: 2.41s      Real: 2.64s     Elapsed: 0:02.64        RAM: 400464KB   ./v -o vold1 cmd/v
CPU: 2.40s      Real: 2.63s     Elapsed: 0:02.63        RAM: 400456KB   ./vold1 -o vold2 cmd/v
CPU: 2.40s      Real: 2.63s     Elapsed: 0:02.63        RAM: 400440KB   ./vold2 -o vold cmd/v
CPU: 97.05s     Real: 99.90s    Elapsed: 1:39.90        RAM: 430016KB   ./vold -prod -o vold_prod cmd/v
Switched to branch 'fix_in_expr_call_once'
    Measuring at PR branch: fix_in_expr_call_once, commit: b79243e ...
>Size of ./vold_prod: 3859664
>Size of ./vnew_prod: 3859664
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -0.1% 1.00x ~same~  40.9ms ± σ:   1.1ms,  39.4ms… 41.7ms `./vnew_prod -check-syntax examples/hello_world.v`
 >  2         base          40.9ms ± σ:   1.2ms,  39.3ms… 42.0ms `./vold_prod -check-syntax examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
 >  1         base          40.5ms ± σ:   0.8ms,  39.4ms… 41.4ms `./vold_prod -check-syntax examples/hello_world.v`
    2   +0.0% 1.00x ~same~  40.5ms ± σ:   0.7ms,  39.6ms… 41.3ms `./vnew_prod -check-syntax examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -1.8% 1.02x faster  40.7ms ± σ:   0.7ms,  39.7ms… 41.3ms `./vnew_prod -check-syntax examples/hello_world.v`
 >  2         base          41.5ms ± σ:   1.2ms,  39.8ms… 42.4ms `./vold_prod -check-syntax examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
 >  1         base          57.4ms ± σ:   0.4ms,  57.0ms… 57.9ms `./vold_prod -check        examples/hello_world.v`
    2   +1.3% 1.01x slower  58.1ms ± σ:   0.9ms,  56.8ms… 59.0ms `./vnew_prod -check        examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -0.2% 1.00x faster  57.7ms ± σ:   1.2ms,  56.1ms… 58.8ms `./vnew_prod -check        examples/hello_world.v`
 >  2         base          57.8ms ± σ:   1.2ms,  56.0ms… 58.7ms `./vold_prod -check        examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
 >  1         base          57.4ms ± σ:   0.4ms,  56.9ms… 57.8ms `./vold_prod -check        examples/hello_world.v`
    2   +0.0% 1.00x ~same~  57.5ms ± σ:   0.1ms,  57.3ms… 57.5ms `./vnew_prod -check        examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
 >  1         base          84.2ms ± σ:   0.7ms,  83.2ms… 84.8ms `./vold_prod -o  ohw.c     examples/hello_world.v`
    2   +1.3% 1.01x slower  85.3ms ± σ:   0.2ms,  85.0ms… 85.5ms `./vnew_prod -o  nhw.c     examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
    1   -1.0% 1.01x faster  84.3ms ± σ:   0.4ms,  83.8ms… 84.6ms `./vnew_prod -o  nhw.c     examples/hello_world.v`
 >  2         base          85.1ms ± σ:   1.0ms,  83.7ms… 86.1ms `./vold_prod -o  ohw.c     examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
    1   -0.4% 1.00x faster  84.8ms ± σ:   0.3ms,  84.5ms… 85.1ms `./vnew_prod -o  nhw.c     examples/hello_world.v`
 >  2         base          85.1ms ± σ:   0.8ms,  84.0ms… 85.8ms `./vold_prod -o  ohw.c     examples/hello_world.v`
>Size of ohw.c: 449928
>Size of nhw.c: 449928
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1                                                                                  
    1   -1.5% 1.02x faster 112.4ms ± σ:   0.1ms, 112.3ms…112.6ms `./vnew_prod -o  nhw.exe   examples/hello_world.v`
 >  2         base         114.1ms ± σ:   0.4ms, 113.5ms…114.4ms `./vold_prod -o  ohw.exe   examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2                                                                                  
 >  1         base         112.4ms ± σ:   1.0ms, 111.1ms…113.5ms `./vold_prod -o  ohw.exe   examples/hello_world.v`
    2   +0.6% 1.01x slower 113.1ms ± σ:   1.2ms, 111.4ms…114.2ms `./vnew_prod -o  nhw.exe   examples/hello_world.v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3                                                                                  
 >  1         base         113.3ms ± σ:   0.6ms, 112.9ms…114.1ms `./vold_prod -o  ohw.exe   examples/hello_world.v`
    2   +0.1% 1.00x ~same~ 113.4ms ± σ:   0.3ms, 113.0ms…113.7ms `./vnew_prod -o  nhw.exe   examples/hello_world.v`
>Size of ohw.exe: 718192
>Size of nhw.exe: 718192
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1
    1   -0.3% 1.00x faster 313.2ms ± σ:   0.9ms, 311.9ms…313.9ms `./vnew_prod -check-syntax cmd/v`
 >  2         base         314.1ms ± σ:   0.1ms, 314.0ms…314.3ms `./vold_prod -check-syntax cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2
    1   -0.4% 1.00x faster 313.4ms ± σ:   0.3ms, 312.9ms…313.7ms `./vnew_prod -check-syntax cmd/v`
 >  2         base         314.7ms ± σ:   0.5ms, 314.0ms…315.1ms `./vold_prod -check-syntax cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3
    1   -0.1% 1.00x ~same~ 314.4ms ± σ:   1.0ms, 313.1ms…315.3ms `./vnew_prod -check-syntax cmd/v`
 >  2         base         314.7ms ± σ:   0.7ms, 313.7ms…315.4ms `./vold_prod -check-syntax cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1
    1   -0.0% 1.00x ~same~ 522.3ms ± σ:   0.4ms, 521.8ms…522.8ms `./vnew_prod -check        cmd/v`
 >  2         base         522.5ms ± σ:   0.8ms, 521.5ms…523.5ms `./vold_prod -check        cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2
 >  1         base         522.3ms ± σ:   0.3ms, 521.8ms…522.6ms `./vold_prod -check        cmd/v`
    2   +0.3% 1.00x slower 523.9ms ± σ:   1.0ms, 522.6ms…524.7ms `./vnew_prod -check        cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3
 >  1         base         521.3ms ± σ:   0.7ms, 520.3ms…521.9ms `./vold_prod -check        cmd/v`
    2   +0.3% 1.00x slower 523.1ms ± σ:   0.5ms, 522.5ms…523.6ms `./vnew_prod -check        cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1
    1   -0.2% 1.00x faster 840.4ms ± σ:   0.6ms, 839.7ms…841.1ms `./vnew_prod -o  nv.c      cmd/v`
 >  2         base         842.3ms ± σ:   0.6ms, 841.9ms…843.0ms `./vold_prod -o  ov.c      cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2
    1   -0.4% 1.00x faster 839.8ms ± σ:   1.2ms, 838.1ms…841.0ms `./vnew_prod -o  nv.c      cmd/v`
 >  2         base         843.4ms ± σ:   1.4ms, 842.1ms…845.3ms `./vold_prod -o  ov.c      cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3
 >  1         base         841.5ms ± σ:   1.5ms, 839.8ms…843.5ms `./vold_prod -o  ov.c      cmd/v`
    2   +0.1% 1.00x ~same~ 842.1ms ± σ:   0.1ms, 842.0ms…842.2ms `./vnew_prod -o  nv.c      cmd/v`
>Size of ov.c: 6804511
>Size of nv.c: 6804511
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  1
    1   -0.0% 1.00x ~same~ 1274.2ms ± σ:   1.3ms, 1272.6ms…1275.8ms `./vnew_prod -o  nv.exe    cmd/v`
 >  2         base         1274.6ms ± σ:   1.9ms, 1273.0ms…1277.2ms `./vold_prod -o  ov.exe    cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  2
    1   -0.2% 1.00x faster 1273.0ms ± σ:   1.6ms, 1270.8ms…1274.1ms `./vnew_prod -o  nv.exe    cmd/v`
 >  2         base         1275.6ms ± σ:   1.3ms, 1273.9ms…1276.9ms `./vold_prod -o  ov.exe    cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat:  3
    1   -0.3% 1.00x faster 1271.5ms ± σ:   1.8ms, 1269.5ms…1273.8ms `./vnew_prod -o  nv.exe    cmd/v`
 >  2         base         1275.3ms ± σ:   0.8ms, 1274.2ms…1276.1ms `./vold_prod -o  ov.exe    cmd/v`
>Size of ov.exe: 10393056
>Size of nv.exe: 10393056
Done. Total time: 451.392544557 s.
#0 15:04:48 ^ fix_in_expr_call_once /space/v/oo>

^ that is compared to latest master, after rebasing over it.

I could not find a significant difference between the functionality (the tests here, also now pass on master, because of #22763, which also covered the assert (test() in [false, true]) == true case, which is not by this PR alone).

The performance is comparable with -prod, but the version on the PR, is slightly faster without -prod .

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@spytheman spytheman merged commit 0279392 into vlang:master Nov 5, 2024
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cgen: x() in [...] calls x() for every element of array
2 participants