-
Notifications
You must be signed in to change notification settings - Fork 589
Open
Description
Perl has an integer pragma, which directs the compiler to use integer operations from the point of use to the end of the enclosing BLOCK. Besides the user-visible behaviour, described at https://perldoc.perl.org/integer.html, perl will then use integer-specific versions of various operators. (e.g. pp_i_add
, rather than the general purpose pp_add
.)
A useful feature might be a corresponding float pragma, to force the compiler to use floating point operations.
This would entail the likes of:
- Modifying the parser/lexer (?) to recognise the pragma
- Adding new floating point ops
- Adding new tests
- All the fixups and regens that go with the above.
Benefits to users who want this:
- Improved operator performance (no attempts to first convert operands to IV/UV values before falling back to floating point operations)
- Fewer unnecessary upgrades of the underlying SV (see IV / NV upgrades often seem unnecessary and costly #17777 for some discussion)