James:
I liked your article on range checking.
I'm very keen on assertions, for example here:
https://github.com/chkoreff/Fexl/blob/fresh/base/src/buf.c#L...
It's still fast as greased lightning. I buffer up 2.6 MB here:
https://github.com/chkoreff/Fexl/blob/fresh/test/src/run.c#L...
It's too fast to notice. I can bump it up to 260 MB and try that:
$ ./build && time ../bin/run
: Buffering 260000000 bytes
length = 260000000
real 0m1.751s
user 0m1.608s
sys 0m0.140s
What the heck, let's try an even 2 GB: $ ./build && time ../bin/run
Compile run
Link run
: Buffering 2000000000 bytes
length = 2000000000
real 0m13.350s
user 0m12.049s
sys 0m1.288s
Ah, but what if I remove my range check? $ ./build && time ../bin/run
Compile buf
Link run
: Buffering 2000000000 bytes
length = 2000000000
real 0m13.103s
user 0m11.781s
sys 0m1.312s
Repeated testing of both ways shows no significant difference.I think I'll leave in the range check.
Range checks also support one of my favorite programming maxims:
No Silent Failure!