Skip to content

Add fused SELECT_BOOL_REG to endpoints VM#1141

Open
mtdowling wants to merge 1 commit intomainfrom
add-select-endpoint-reg
Open

Add fused SELECT_BOOL_REG to endpoints VM#1141
mtdowling wants to merge 1 commit intomainfrom
add-select-endpoint-reg

Conversation

@mtdowling
Copy link
Copy Markdown
Member

@mtdowling mtdowling commented Apr 6, 2026

Add fused SELECT_BOOL_REG to endpoints VM

Optimizes a couple hot instructions for S3 endpoints, but is a generic
optimization.

For S3, these are optimized:

_s3e_fips = ite(UseFIPS, "-fips", "")
_s3e_ds = ite(UseDualStack, ".dualstack", "")

Without SELECT_BOOL_REG, each compiles to 5 opcodes:

LOAD_REGISTER    UseFIPS
JMP_IF_FALSE     5
LOAD_CONST       "-fips"
JUMP             2
LOAD_CONST       ""

With SELECT_BOOL_REG, each becomes 1 opcode:

SELECT_BOOL_REG  UseFIPS, "-fips", ""

The end result is that this speeds up S3 endpoint resolution
consistently by 1-4% depending on the test case (smaller programs like
vanilla endpoint resolution see bigger savings, larger programs see
less savings).

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mtdowling mtdowling force-pushed the add-select-endpoint-reg branch 2 times, most recently from 8a4a26c to c9cf3c3 Compare April 6, 2026 17:42
Optimizes a couple hot instructions for S3 endpoints, but is a generic
optimization.

For S3, these are optimized:

```
_s3e_fips = ite(UseFIPS, "-fips", "")
_s3e_ds = ite(UseDualStack, ".dualstack", "")
```

Without SELECT_BOOL_REG, each compiles to 5 opcodes:

```
LOAD_REGISTER    UseFIPS
JMP_IF_FALSE     5
LOAD_CONST       "-fips"
JUMP             2
LOAD_CONST       ""
```

With SELECT_BOOL_REG, each becomes 1 opcode:

```
SELECT_BOOL_REG  UseFIPS, "-fips", ""
```

The end result is that this speeds up S3 endpoint resolution
consistently by 1-4% depending on the test case (smaller programs like
vanilla endpoint resolution see bigger savings, larger programs see
less savings).
@mtdowling mtdowling force-pushed the add-select-endpoint-reg branch from c9cf3c3 to ecb1af7 Compare April 6, 2026 17:51
@mtdowling mtdowling enabled auto-merge (rebase) April 6, 2026 23:43
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.

1 participant