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

v: some branch prediction adjusts #22848

Merged
merged 12 commits into from
Nov 15, 2024
Merged

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Nov 13, 2024

This PR aims improve performance by doing branch prediction adjusts.

Reduced 26.004.738 (Bcm) to 25.334.846 (Bcm) on v -o cmd.c cmd/v

Bcm = branch predictor misses

$ v -cflags -O0 -cc gcc -cg -cflags -g self
$ valgrind --tool=callgrind --branch-sim=yes --cache-sim=yes  --dump-instr=yes ./v -no-parallel -o cmd.c cmd/v
$ callgrind_annotate --show=Bc,Bcm --sort=Bcm --tree=both --inclusive=no --auto=yes --context=1 callgrind.out.17213 > tree.17213

Huly®: V_0.6-21293

vlib/v/parser/parser.v Outdated Show resolved Hide resolved
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.

@spytheman
Copy link
Member

spytheman commented Nov 14, 2024

Note that compiling with -O0 -cc gcc will turn off all optimizations, including the ones that turn switches into jump tables.

I am not convinced that doing that, and then reordering code around, just to improve that particular mode is good 🤔 , except perhaps for tcc builds (which also does not do optimizations).

@spytheman spytheman marked this pull request as ready for review November 15, 2024 20:54
@spytheman spytheman merged commit c4fd61c into vlang:master Nov 15, 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.

2 participants