-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Attempt to remove the special JpegStream.getBytes
method and utilize the regular DecodeStream
one instead
#9260
Attempt to remove the special JpegStream.getBytes
method and utilize the regular DecodeStream
one instead
#9260
Conversation
…e the regular `DecodeStream` one instead Note that no other image stream implements a special `getBytes` method, which makes `JpegStream` look somewhat odd. I'm actually not sure what purpose this methods serves, since I successfully ran all tests locally with it commented out. Furhermore, I also ran tests with an added `if (length && length !== this.bufferLength) { throw new Error('length mismatch'); }` check, and didn't get a single test failure in that case either. Looking at the history, it seems that this code originated back in PR 4528, but as far as I can tell there's no mention in either commit messages nor PR comments of why it was necessary to add a "special" `getBytes` function for the `JpegStream`. My assumption is that there's a good reason why this method was added, e.g. to address a *specific* regression in one of the reference tests. However, I did check out commit 58f697f locally and ran tests with this method commented out, and there didn't seem to be any image-related failures in that case either!? Hence I'm suggesting that we attempt to simplify this code slightly be removing this special `getBytes` method. However, please note that there's perhaps a *small* risk of regressions in an edge-case where we currently have insufficient test-coverage.
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/86ba77e7ed37752/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.215.176.217:8877/5713a0a90a42415/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/86ba77e7ed37752/output.txt Total script time: 17.01 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/5713a0a90a42415/output.txt Total script time: 23.39 mins
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your reasoning. Having code that does not make sense is in my opinion worse than finding a (very unlikely) regression later on, because then we at least have a test case for it. Thank you for the patch!
…ytes Attempt to remove the special `JpegStream.getBytes` method and utilize the regular `DecodeStream` one instead
Note that no other image stream implements a special
getBytes
method, which makesJpegStream
look somewhat odd.I'm actually not sure what purpose this methods serves, since I successfully ran all tests locally with it commented out. Furthermore, I also ran tests with an added
if (length && length !== this.bufferLength) { throw new Error('length mismatch'); }
check, and didn't get a single test failure in that case either.Looking at the history, it seems that this code originated back in PR #4528, but as far as I can tell there's no mention in either commit messages nor PR comments of why it was necessary to add a "special"
getBytes
function for theJpegStream
.My assumption is that there's a good reason why this method was added, e.g. to address a specific regression in one of the reference tests. However, I did check out commit 58f697f locally and ran tests with this method commented out, and there didn't seem to be any image-related failures in that case either!?
Hence I'm suggesting that we attempt to simplify this code slightly be removing this special
getBytes
method. However, please note that there's perhaps a small risk of regressions in an edge-case where we currently have insufficient test-coverage.