Earlier quoted context omitted.
This is certainly true. Also, by replacing the allocator and changing compiler flags, you're possibly immunizing yourself from attacks that rely on some specific memory layout.
That is, if you are a believer in security via obscurity
Make Ubuntu packages 90% faster by rebuilding them
61–70 of 375 posts
Re: Make Ubuntu packages 90% faster by rebuilding them
#62Misleading title, it's 90% of the faster time. It's about 45% faster. It's actually a little bit interesting, if you are interested in how we use language. You could argue that now you now get 90% more work done in the same amount of time, and that would align with other 'speed' units that we commonly use (miles per hour, words per minute, bits per second). However, the convention in computer performance is to measur…
I feel like using units of rate (90% faster) and not units of time makes more sense here. Plus, if you were using units of time, you wouldn’t use the word “faster.” “Takes 45% less time” and “45% faster” are very different assertions, but they both have meaning, both in programming and outside it.
I think, generally, we fix on the earlier when talking about the change over time of a characteristic. "This stock went up 100%, this stock went down 50%". In both cases it's the earlier measurement that is taken as the unit. That makes this a 45% reduction in time to do the work, and that's actually what they measured.
When talking about comparisons between two things that aren't time dependent it depends on if we talk in multiples or percents I think. A twin bed is half as big as a king bed. A king bed is twice as big as a twin bed. Both are idiomatic. A king bed is 100% bigger than a twin bed. Yes, you could talk like this. A twin bed is 100% smaller than a king bed. Right away you say wait, a twin bed isn't 0 size! Because we don't talk in terms of the smaller thing when talking about decreasing percents, only increasing. A twin bed is 50% smaller than a king bed (iffy). A twin bed is 50% as big as a king bed. There, that's idiomatic again.
Re: Make Ubuntu packages 90% faster by rebuilding them
#63Sometimes comes to mind: Can’t one recompile the same exact Ubuntu packages you already have on your system with optimal flags for your specific hardware? Plus, the configuration could be automated - just push a button to (lazy, in background) recompile. Priority for the ones profiled to be performance critical.
Well, in principle yes. But you'd also need to figure out what you mean by 'optimal' flags? The flags might differ between different packages, and not all packages will be compatible with all the flags.
Even worse, in the example in the article they got most of their speedup out of moving to a different allocator, and that's not necessarily compatible with all packages (nor an improvement for all packages).
However, if you still want to do all these things, then Gentoo Linux is the distribution for you. It supports this tinkering directly and you'll have a much happier time than trying to bend Ubuntu to your will.
Re: Make Ubuntu packages 90% faster by rebuilding them
#64Gentoo linux is essentially made specifically for people like this, to be able to optimize one’s own linux rig for one’s specific usecase. After initial setup, it’s pretty simple and easy to use, I remember making a ton of friends at matrix’s Gentoo Linux channel, was fun times. https://www.gentoo.org/ Fun fact, initial ChromeOS was basically just custom Gentoo Linux install, I’m not sure if they still use Gentoo Lin…
Afaik the Gentoo based ChromeOS is being replaced by Android.
Re: Make Ubuntu packages 90% faster by rebuilding them
#65-march=native + mimalloc (or jemalloc) should be sufficient without causing significant undefined behavior like -O3 or most extra optimization related compiler arguments.
Re: Make Ubuntu packages 90% faster by rebuilding them
#66Re: Make Ubuntu packages 90% faster by rebuilding them
#67O3 is a bad idea if the package is important. While that’s a dated opinion based on older experiences (Gentoo, various server software, etc), I suspect it’s still the easiest way to get exposed to compiler bugs.
First and foremost, an easy way to grab a bunch of undefined behavior.
The undefined behaviour is already in the C standard.
But you are right that enabling -O3 is generally going to make your compiler more aggressive about exploiting the undefined behaviour in the pursuit of speed.
In general, if you want to avoid being the guy to run into new and exciting bugs, you want to run with options that are as close as possible to what everyone else is using.
Re: Make Ubuntu packages 90% faster by rebuilding them
#68Earlier quoted context omitted.
Load bearing assertions. Even Design by Contract in Eiffel turns off assertions in production.
Just because it's turned off by default doesn't mean it isn't load bearing. If you didn't ever encounter an ASSERT with side effects that were crucial to proper functioning, you just haven't seen enough ASSERT statements. Rule #1 of programming: If it can go wrong, it will.
Re: Make Ubuntu packages 90% faster by rebuilding them
#69Earlier quoted context omitted.
Are you arguing that ASLR is “security via obscurity”?
I would, and there is no shame in it, as far as I'm concerned. I don't need to outrun the bear. I just need to outrun you.
Re: Make Ubuntu packages 90% faster by rebuilding them
#70Earlier quoted context omitted.
This is certainly true. Also, by replacing the allocator and changing compiler flags, you're possibly immunizing yourself from attacks that rely on some specific memory layout.
There are also many flags that should be enabled by default for non-debug builds like ubsan, stack protection, see https://news.ycombinator.com/item?id=35758898