3 ms·
A bit tangential, but the folks behind the GNU Multiple Precision Library (GMPLib) have the problem of choosing algorithms more or less fleshed out. They've got
by wormslayer666 3mo ago
A bit tangential, but the folks behind the GNU Multiple Precision Library (GMPLib) have the problem of choosing algorithms more or less fleshed out. They've got some fairly approachable manual pages[1] for the various algorithms they use as operand sizes scale up, where Karatsuba is only the second of six options in terms of operational complexity.
[1] https://gmplib.org/manual/Multiplication-Algorithms https://gmplib.org/manual/Multiplication-Algorithms
- inigyou 3mo agoThis really demonstrates the utility of pulling in a library written by experts in the field the library handles.
- Bratmon 3mo agoThis is a problem I have a lot in modern programming ecosystems: How do I tell the difference between a library written by a team of experts who have spent decades optimizing everything to do with the task and a library written by one guy that's an unnecessary straightforward wrapper over the obvious implementation?
- deleted 3mo ago[deleted]
- dspillett 3mo agoOr increasingly, a library written by an LLM referencing a pile of such “one guy” projects of varying levels of suck (from actually good to good-got-it-is-full-of-suck).
- spullara 3mo agoWhat I have been seeing recently is having a great LLM rewrite the library leads to fewer bugs and also optimized for your use case. More expensive for sure than pulling something like epub.js but when the library has infinite open issues it can be a lot better.
- layer8 3mo agoYou defer to the advice of experts you trust. Which somehow have become harder to come by in terms of signal to noise than 20-30 years ago.
- xtajv 2mo ago1. Read the code 2. Don't. Encapsulate and put yourself in a position to swap out the implementation at will. (Maybe you'll swap out an unnecessary dependency for a simple helper function of your own).
- Bratmon 2mo agoBut if I followed that advice here, I would say "Obviously I don't need a library to multiply numbers" and miss the decades of research and optimization.