getc either hangs or becomes very slow for large inputs. This was causing my code to timeout on the server for both the sha-256 hashing and brainfuck, changing only input methods solved this problem, while on my own computer not affecting speed at all.
I suspect it is a buffering problem, where getc hangs if buffer is empty even though there is more input or something.
As a test I submitted the following code: 0 while getc
The result was that it timed out for the longer test cases (1015 bytes)
marmaladea has figured the cause. For every character it prints warning to stderr and this fills up some buffer. Using $<.gets did not have this problem
FWIW, I use getc for Brainfuck and I don't encounter any problems at all, the script executes just as you'd expect. I've not used it on SHA-256, so it is possible that the longer inputs do break something. I'll do some experiementation and get back to you. Thanks for bringing it to our attention!
I suspect it is a buffering problem, where getc hangs if buffer is empty even though there is more input or something.
As a test I submitted the following code:
0 while getc
The result was that it timed out for the longer test cases (1015 bytes)