Skip to content

Avoid an flabs call in flonums-between - #120

Merged
pavpanchekha merged 1 commit into
masterfrom
even-faster-flonums-between
Sep 25, 2026
Merged

pavpanchekha merged 1 commit into
masterfrom
even-faster-flonums-between

Conversation

@pavpanchekha

Copy link
Copy Markdown
Collaborator

I feel dumb I didn't see this the first time! The flonums-between function is optimized to allocate less, but it still calls flabs to normalize positive and negative zero before extracting the high and low words of a flonum. And flabs allocates because Chez flonums are heap-allocated. But we don't need to call flabs! We can just not extract the sign bit!

@mflatt

mflatt commented Sep 25, 2026

Copy link
Copy Markdown
Member

FWIW, it seems wrong that the flabs result here was not unboxed. The problem is that only one argument to flbit-field is a flonum, and so it needs more special treatment (along the same lines as flvector-set!). I'll fix that at the Chez Scheme level, independent of this change.

@pavpanchekha

Copy link
Copy Markdown
Collaborator Author

Good point, but either way this seems like a good change… Worst case it’s only a (small) perf and simplicity improvement.

@pavpanchekha
pavpanchekha merged commit 8565cac into master Sep 25, 2026
1 of 2 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