Skip to content

Conversation

@kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Nov 17, 2025

Fix issue #25729

I think further check, for example, left expr is an array/fixed array, should be done in checker and not in parser.

@spytheman
Copy link
Member

I think that the parser should do very little amount of checks of this kind (semantic ones). Ideally, it should be only concerned with syntax errors.

@kbkpbot
Copy link
Contributor Author

kbkpbot commented Nov 17, 2025

It become slower:

 >  1           base            116.3ms ± σ:    0.4ms,  115.7ms… 116.6ms `./vold -no-parallel -o ohw.exe examples/hello_world.v`
    2     +0.5%   1.01x slower  116.9ms ± σ:    0.2ms,  116.6ms… 117.0ms `./vnew -no-parallel -o nhw.exe examples/hello_world.v`
>>>>>> size("          nhw.exe") - size("          ohw.exe") =     240697 -     240697 =          0
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 1/3, took: 12948.595 ms
 >  1           base            532.3ms ± σ:    0.6ms,  531.6ms… 533.0ms `./vold -check-syntax           cmd/v`
    2     +1.8%   1.02x slower  541.8ms ± σ:    0.4ms,  541.4ms… 542.3ms `./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: 12996.197 ms
 >  1           base            530.4ms ± σ:    0.6ms,  529.9ms… 531.3ms `./vold -check-syntax           cmd/v`
    2     +2.4%   1.02x slower  543.1ms ± σ:    1.4ms,  541.5ms… 544.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: 12980.652 ms
 >  1           base            532.8ms ± σ:    0.3ms,  532.6ms… 533.2ms `./vold -check-syntax           cmd/v`
    2     +2.0%   1.02x slower  543.4ms ± σ:    0.1ms,  543.2ms… 543.5ms `./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: 21605.023 ms
 >  1           base            887.1ms ± σ:    1.5ms,  885.4ms… 889.0ms `./vold -check                  cmd/v`
    2     +1.4%   1.01x slower  899.3ms ± σ:    5.5ms,  891.6ms… 903.4ms `./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: 21598.238 ms
 >  1           base            886.0ms ± σ:    0.2ms,  885.8ms… 886.2ms `./vold -check                  cmd/v`
    2     +2.0%   1.02x slower  903.6ms ± σ:    1.4ms,  901.7ms… 905.0ms `./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: 21683.126 ms
 >  1           base            887.3ms ± σ:    0.2ms,  887.1ms… 887.6ms `./vold -check                  cmd/v`
    2     +2.2%   1.02x slower  907.3ms ± σ:    1.7ms,  905.2ms… 909.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: 33862.317 ms
 >  1           base           1395.7ms ± σ:    1.0ms, 1394.3ms…1396.5ms `./vold -no-parallel -o ov.c    cmd/v`
    2     +1.2%   1.01x slower 1412.2ms ± σ:    1.6ms, 1409.9ms…1413.6ms `./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: 33718.671 ms
 >  1           base           1391.4ms ± σ:    0.4ms, 1391.1ms…1392.0ms `./vold -no-parallel -o ov.c    cmd/v`
    2     +1.5%   1.01x slower 1412.3ms ± σ:    0.8ms, 1411.3ms…1413.3ms `./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: 33691.130 ms
 >  1           base           1390.6ms ± σ:    0.5ms, 1389.9ms…1391.2ms `./vold -no-parallel -o ov.c    cmd/v`
    2     +1.0%   1.01x slower 1405.1ms ± σ:    6.1ms, 1396.4ms…1409.6ms `./vnew -no-parallel -o nv.c    cmd/v`
>>>>>> size("             nv.c") - size("             ov.c") =    6806144 -    6806144 =          0
Summary after 1 series x 10 runs (%s are relative to first command, or `base`), discard maxs:  7, repeat: 1/3, took: 39559.825 ms
 >  1           base           1633.1ms ± σ:    1.1ms, 1631.9ms…1634.5ms `./vold -no-parallel -o ov.exe  cmd/v`
    2     +1.1%   1.01x slower 1651.4ms ± σ:    6.2ms, 1642.7ms…1655.8ms `./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: 39730.429 ms
 >  1           base           1633.6ms ± σ:    0.2ms, 1633.3ms…1633.8ms `./vold -no-parallel -o ov.exe  cmd/v`
    2     +1.5%   1.01x slower 1657.5ms ± σ:    3.6ms, 1653.3ms…1662.2ms `./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: 39696.561 ms
 >  1           base           1636.2ms ± σ:    2.4ms, 1634.0ms…1639.5ms `./vold -no-parallel -o ov.exe  cmd/v`
    2     +1.4%   1.01x slower 1658.9ms ± σ:    1.7ms, 1656.5ms…1660.6ms `./vnew -no-parallel -o nv.exe  cmd/v`
>>>>>> size("           nv.exe") - size("           ov.exe") =   10338988 -   10338988 =          0
Done. Total time: 368.356287911 s.

@kbkpbot kbkpbot changed the title parser: skip check sort(), sorted() args parser: allow use a b it as var name when using array builtin methods Nov 17, 2025
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.

Excellent work.

#25759 should make checking for these method names a bit faster, but its tests are still running.

@spytheman spytheman merged commit 2f2efb7 into vlang:master Nov 17, 2025
83 checks passed
spytheman added a commit to davlgd/v that referenced this pull request Nov 18, 2025
* master:
  cgen: fix dump(ptr_to_fixed_array_value) - it now returns the argument directly (thanks @tankf33der) (vlang#25764)
  type_resolver: clear option flag if present in comptime $for (fix vlang#25761) (vlang#25763)
  db.sqlite: update windows version to https://sqlite.org/2025/sqlite-amalgamation-3510000.zip (vlang#25766)
  builder,pref: add  `-file-list` support (implement feature vlang#25707) (vlang#25749)
  transformer: transform ArrayInit into a function call for C and native backends (part 1)
  doc: cleanup grammar issues in doc/docs.md
  parser: allow using `a`, `b` and `it` as var names, when using the builtin array methods (fix vlang#25729) (vlang#25755)
  v.builder: improve diagnostic information for a failed build_thirdparty_obj_file
  veb: fix gzip middleware decode/encode (fix vlang#20865) (fix vlang#25753) (vlang#25754)
  strconv: fix handling of subnormal numbers like `'1.23e-308'.f64()` (fix vlang#25751) (vlang#25752)
  crypto.blake2b,crypto.blake2s: add `@[direct_array_access]` to hot functions (vlang#25750)
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.

checker: variable from return value of array.sorted(a < b) cannot be named a or b

2 participants