forked from scratchfoundation/scratch-vm
-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Labels
performanceIdeas for improving performanceIdeas for improving performance
Description
Disregarding adding potentially new type flags, currently only add, subtract, multiply, and divide are optimized right now. Modulo, round, and other blocks can definitely be optimized as well, probably when it's certain regressions have been minimized
From what I can currently tell (although there may be things I've missed or gotten incorrect):
- X random Y:
canBeNaN: Any input is negative infinitycanBeZero: Any input is any zero, or their signs don't matchcanBeNegZero: Either input is negative 0canBePos: Any positive inputscanBeNeg: Any negative inputscanBeInfinity: Any input is positive infinitycanBeNegInfinity: Both inputs are negative infinity
- X mod Y:
canBeNaN: Any inputs with any zero on the RHS, or infinity on the LHScanBeZero: Any positive or positive zero LHS (checked: Negative inputs, when an exact multiple, return -0, not 0)canBeNegZero: Any negative or negative 0 LHScanBePos: Any positive RHScanBeNeg: Any negative RHScanBeInfinity: falsecanBeNegInfinity: false
- round X:
canBeNaN: falsecanBeZero: Any positive or positive 0 inputcanBeNegZero: Any negative or negative 0 inputcanBePos: Any positive inputcanBeNeg: Any negative inputcanBeInfinity: Positive infinity input (checked: maximum finite float does not round up)canBeNegInfinity: Negative infinity input (checked: maximum negative finite float does not round up)
- abs X:
canBeNaN: falsecanBeZero: Any zero inputcanBeNegZero: falsecanBePos: Any nonzero inputcanBeNeg: falsecanBeInfinity: Any infinite inputcanBeNegInfinity: false
- floor X:
canBeNaN: falsecanBeZero: Any positive or 0 inputcanBeNegZero: Negative 0 inputcanBePos: Any positive inputcanBeNeg: Any negative inputcanBeInfinity: Positive infinity inputcanBeNegInfinity: Negative infinity input
- ceiling X:
canBeNaN: falsecanBeZero: Positive 0 inputcanBeNegZero: Any negative or negative 0 inputcanBePos: Any positive inputcanBeNeg: any negative inputcanBeInfinity: Positive infinity inputcanBeNegInfinity: Negative infinity input
- sqrt X:
canBeNaN: Any negative inputcanBeZero: Positive 0 inputcanBeNegZero: Negative 0 inputcanBePos: Any positive inputcanBeNeg: falsecanBeInfinity: Positive infinity inputcanBeNegInfinity: false
- sin X:
canBeNaN: Any infinite inputcanBeZero: truecanBeNegZero: truecanBePos: truecanBeNeg: truecanBeInfinity: falsecanBeNegInfinity: false
- cos X: (same as sin X)
canBeNaN: Any infinite inputcanBeZero: truecanBeNegZero: truecanBePos: truecanBeNeg: truecanBeInfinity: falsecanBeNegInfinity: false
- tan X:
canBeNaN: Any infinite inputcanBeZero: truecanBeNegZero: truecanBePos: truecanBeNeg: truecanBeInfinity: truecanBeNegInfinity: true
- asin X:
canBeNaN: truecanBeZero: Positive zero input (checked: minimum positive input does not return 0)canBeNegZero: Negative zero input (checked: minimum negative input does not return -0)canBePos: Any positive inputcanBeNeg: Any negative inputcanBeInfinity: falsecanBeNegInfinity: false
- acos X: (
NUMBER_POS_REAL | NUMBER_NAN)canBeNaN: truecanBeZero: truecanBeNegZero: falsecanBePos: truecanBeNeg: falsecanBeInfinity: falsecanBeNegInfinity: false
- atan X:
canBeNaN: falsecanBeZero: Positive zero input (checked: minimum positive input does not return 0)canBeNegZero: Negative zero input (checked: minimum negative input does not return -0)canBePos: Any positive inputcanBeNeg: Any negative inputcanBeInfinity: falsecanBeNegInfinity: false
- ln X:
canBeNaN: Any negative inputcanBeZero: truecanBeNegZero: falsecanBePos: truecanBeNeg: truecanBeInfinity: Any infinite inputcanBeNegInfinity: Any zero input
- log X: (same as ln X)
canBeNaN: Any negative inputcanBeZero: truecanBeNegZero: falsecanBePos: truecanBeNeg: truecanBeInfinity: Any infinite inputcanBeNegInfinity: Any zero input
- e ^ X:
canBeNaN: falsecanBeZero: Any negative input (checked: negatively large enough non-infinite value returns 0)canBeNegZero: falsecanBePos: truecanBeNeg: falsecanBeInfinity: Any positive input (checked: positively large enough non-infinite value returns Infinity)canBeNegInfinity: false
- 10 ^ X: (same as e ^ X)
canBeNaN: falsecanBeZero: Any negative inputcanBeNegZero: falsecanBePos: truecanBeNeg: falsecanBeInfinity: Any positive inputcanBeNegInfinity: false
Metadata
Metadata
Assignees
Labels
performanceIdeas for improving performanceIdeas for improving performance