Timeline for Mean and Variance for Math Library
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 6, 2021 at 18:05 | comment | added | Ben Voigt |
@Elliott: Nearly all modern C++ environments have zero-overhead exception fast path... the cost is only incurred when throw is reached. In which case the cost of calling assert in a catch block compared to a direct call to assert simply does not matter -- the exception handling cost is miniscule compared to the work of logging and process termination. Only when exceptions are repeatedly thrown and caught may the performance become an issue, and calling assert removes the option entirely.
|
|
Aug 6, 2021 at 15:42 | comment | added | Elliott | @JDługosz, wouldn't that be overly generalising? That's a lot of slow-down for the off-chance this is gonna take-off as the go-to library on basic stats? | |
Aug 6, 2021 at 15:18 | comment | added | JDługosz |
@Elliott in library code, you use throw so the caller can decide whether to crash, back out of that operation, etc. and how to log the error message.
|
|
Aug 6, 2021 at 14:38 | answer | added | Serge Ballesta | timeline score: 1 | |
Aug 6, 2021 at 14:31 | answer | added | JDługosz | timeline score: 3 | |
Aug 6, 2021 at 12:00 | history | tweeted | twitter.com/StackCodeReview/status/1423614857312718850 | ||
Aug 6, 2021 at 11:29 | answer | added | G. Sliepen | timeline score: 3 | |
Aug 6, 2021 at 11:08 | history | became hot network question | |||
Aug 6, 2021 at 8:14 | answer | added | Toby Speight | timeline score: 5 | |
Aug 6, 2021 at 7:30 | comment | added | Elliott |
Question: do you really want to throw for this code? I associate throw with code that isn't allowed to crash (gaming/nuclear power plant, that sort of thing). In the case of gaming, the program would likely abandon an image or even a whole frame - this way the player can keep going and put up with a single bad frame. For a nuclear power plant you'd make sure that the controls remain operational and sensible (but perhaps not optimal). Personally I'm a massive fan of hard/early crashes. An assert would do the job here. throw has hidden efficiency costs too.
|
|
Aug 6, 2021 at 7:26 | comment | added | Toby Speight | You might want to look at my implementation of incremental mean and variance, including the reviews I received. | |
Aug 6, 2021 at 7:21 | history | edited | Toby Speight | CC BY-SA 4.0 |
Copy-edit and add tag
|
Aug 6, 2021 at 7:16 | answer | added | JimmyHu | timeline score: 4 | |
Aug 6, 2021 at 3:04 | history | asked | Suryasis Paul | CC BY-SA 4.0 |