Shakespeare may have coined a lot of English words, but only Wallace can claim deez nuts.
- 0 Posts
- 5 Comments
Am programmer. Hate it.
zerofk@lemmy.zipto Programming@programming.dev•comment style that tells text editors to fold sections of text3·1 month agoI actually think the argument for mixing tabs and spaces makes a lot of sense. Use tabs for indentation, coupled with spaces for alignment (e.g. of function arguments). It eliminates the downsides of using tabs resp. spaces exclusively. But since nobody uses it, I never have either. Following the style of the project at hand is the way.
zerofk@lemmy.zipto Programming@programming.dev•Revisiting Knuth's 'Premature Optimization' Paper23·2 months agoA nice post, and certainly worth a read. One thing I want to add is that some programmers - good and experienced programmers - often put too much stock in the output of profiling tools. These tools can give a lot of details, but lack a bird’s eye view.
As an example, I’ve seen programmers attempt to optimise memory allocations again and again (custom allocators etc.), or optimise a hashing function, when a broader view of the program showed that many of those allocations or hashes could be avoided entirely.
In the context of the blog: do you really need a multi set, or would a simpler collection do? Why are you even keeping the data in that set - would a different algorithm work without it?
When you see that some internal loop is taking a lot of your program’s time, first ask yourself: why is this loop running so many times? Only after that should you start to think about how to make a single loop faster.
You know how some languages write left-to-right, and some rught-to-left? Endianness is that, for numbers.
Or another analogy is dates: 2025/12/31 is big endian, 31/12/2025 is little endian. And 12/31/2025 is middle endian. Which makes no sense at all because the middle is, by definition, not an end.