Skip to content

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Dec 29, 2025

This is a feature needed by PR #25857, which can make sure always generate auto str function like this:

pub fn (it main.Example) str() string 

instead of something like this :

pub fn (it &main.Example) str() string 
pub fn (it &&main.Example) str() string 

This should has no impact on current auto str mechanism.

@spytheman
Copy link
Member

Is there a performance impact?

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Dec 29, 2025

Is there a performance impact?

I think it is acceptable.

 >  1           base            122.4ms ± σ:    0.6ms,  121.8ms… 123.2ms `./vold -no-parallel -o ohw.exe examples/hello_world.v`
    2     +0.6%   1.01x slower  123.1ms ± σ:    0.3ms,  122.7ms… 123.4ms `./vnew -no-parallel -o nhw.exe examples/hello_world.v`
>>>>>> size("          nhw.exe") - size("          ohw.exe") =     241912 -     241912 =          0
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 1/3, took: 13601.472 ms
 >  1           base            557.7ms ± σ:    3.0ms,  553.6ms… 560.8ms `./vold -check-syntax           cmd/v`
    2     +1.6%   1.02x slower  566.4ms ± σ:    1.9ms,  564.2ms… 568.8ms `./vnew -check-syntax           cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 2/3, took: 13585.045 ms
 >  1           base            560.0ms ± σ:    1.3ms,  558.3ms… 561.5ms `./vold -check-syntax           cmd/v`
    2     +1.1%   1.01x slower  566.3ms ± σ:    0.5ms,  565.7ms… 566.9ms `./vnew -check-syntax           cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 3/3, took: 13633.698 ms
 >  1           base            562.8ms ± σ:    1.3ms,  561.7ms… 564.6ms `./vold -check-syntax           cmd/v`
    2     +0.7%   1.01x slower  567.0ms ± σ:    0.8ms,  565.9ms… 567.6ms `./vnew -check-syntax           cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 1/3, took: 23452.253 ms
 >  1           base            963.1ms ± σ:    7.8ms,  952.0ms… 968.6ms `./vold -check                  cmd/v`
    2     +1.5%   1.02x slower  977.9ms ± σ:    1.9ms,  975.3ms… 979.7ms `./vnew -check                  cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 2/3, took: 23560.747 ms
 >  1           base            969.3ms ± σ:    2.4ms,  966.0ms… 971.2ms `./vold -check                  cmd/v`
    2     +0.9%   1.01x slower  977.8ms ± σ:    1.3ms,  976.7ms… 979.6ms `./vnew -check                  cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 3/3, took: 23474.061 ms
 >  1           base            971.4ms ± σ:    1.5ms,  969.3ms… 972.7ms `./vold -check                  cmd/v`
    2     +0.2%   1.00x slower  973.9ms ± σ:    0.3ms,  973.5ms… 974.2ms `./vnew -check                  cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 1/3, took: 36199.770 ms
 >  1           base           1492.8ms ± σ:    2.3ms, 1491.0ms…1496.0ms `./vold -no-parallel -o ov.c    cmd/v`
    2     +0.8%   1.01x slower 1504.3ms ± σ:    2.3ms, 1501.2ms…1507.0ms `./vnew -no-parallel -o nv.c    cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 2/3, took: 36229.166 ms
 >  1           base           1497.4ms ± σ:    1.9ms, 1495.3ms…1499.9ms `./vold -no-parallel -o ov.c    cmd/v`
    2     +0.1%   1.00x ~same~ 1498.9ms ± σ:    6.1ms, 1492.4ms…1507.1ms `./vnew -no-parallel -o nv.c    cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 3/3, took: 36156.163 ms
 >  1           base           1497.1ms ± σ:    4.7ms, 1491.5ms…1502.9ms `./vold -no-parallel -o ov.c    cmd/v`
    2     +0.0%   1.00x ~same~ 1497.3ms ± σ:    3.4ms, 1493.4ms…1501.8ms `./vnew -no-parallel -o nv.c    cmd/v`
>>>>>> size("             nv.c") - size("             ov.c") =    6941779 -    6941779 =          0
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 1/3, took: 42145.603 ms
 >  1           base           1739.0ms ± σ:    6.8ms, 1729.5ms…1744.6ms `./vold -no-parallel -o ov.exe  cmd/v`
    2     +0.8%   1.01x slower 1752.2ms ± σ:    1.9ms, 1749.8ms…1754.5ms `./vnew -no-parallel -o nv.exe  cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 2/3, took: 42145.245 ms
 >  1           base           1741.1ms ± σ:    3.1ms, 1736.9ms…1744.5ms `./vold -no-parallel -o ov.exe  cmd/v`
    2     +0.3%   1.00x slower 1747.0ms ± σ:    3.4ms, 1742.2ms…1749.7ms `./vnew -no-parallel -o nv.exe  cmd/v`
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 3/3, took: 41990.621 ms
 >  1           base           1739.6ms ± σ:    0.7ms, 1739.1ms…1740.6ms `./vold -no-parallel -o ov.exe  cmd/v`
    2     +0.1%   1.00x ~same~ 1741.9ms ± σ:    7.4ms, 1733.5ms…1751.6ms `./vnew -no-parallel -o nv.exe  cmd/v`
>>>>>> size("           nv.exe") - size("           ov.exe") =   10484376 -   10484376 =          0
Done. Total time: 393.897432377 s.
==================================================================================================
Final summary for file diff sizes on their own branches:
>>>>>> size("    nhw_current.c") - size("     ohw_master.c") =      28170 -      28170 =          0
>>>>>> size("nhw_current_gcc.c") - size(" ohw_master_gcc.c") =      41256 -      41256 =          0
>>>>>> size("     nv_current.c") - size("      ov_master.c") =    6941779 -    6941612 =        167
>>>>>> size("             vnew") - size("             vold") =   10484374 -   10484095 =        279
==================================================================================================
Final summary for file diff sizes for generated files on the *current* branch:
>>>>>> size("            nhw.c") - size("            ohw.c") =      28170 -      28170 =          0
>>>>>> size("             nv.c") - size("             ov.c") =    6941779 -    6941779 =          0
>>>>>> size("          nhw.exe") - size("          ohw.exe") =     241912 -     241912 =          0
>>>>>> size("           nv.exe") - size("           ov.exe") =   10484376 -   10484376 =          0

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.

Thank you @kbkpbot 🙇🏻 .

@spytheman spytheman merged commit ba97785 into vlang:master Dec 29, 2025
84 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.

2 participants