HNHacker News
TopNewBestAskShowJobs

pjscott

9,802 karma · joined May 23, 2010

submissionscomments
pjscott··on Banker pays $2M for coal mine, discovers $37B rare Earth elements
I’ll give the straightforward, zero-irony reply: hooray! We have a huge amount of exploitable natural resources that we didn’t know about until recently. This is good.
pjscott··on Understanding Objective-C by transpiling it to C++
ObjC can be plenty fast, if you know what you're doing. And there really isn't that much to learn; it's just that most people don't learn and so they keep running into landmines. I'll cover the main points right now, in no particular order.

1. Allocation and deallocation involve calls to calloc/free, which are rather costly. It's easy to accidentally create and destroy an NSObject on each iteration of a hot loop. Be aware that this comes with a performance hit, and can easily come to dominate the time taken by that loop.

2. Retains and releases are pretty fast, especially on Apple's processors (which are optimized for non-contended atomic operations). However, they are atomic operations – some fancy compare-and-swap thing usually – and so you should try to avoid doing them on every iteration of a hot loop.

3. ObjC method calls are slower than C++ vtable dispatch, which in turn is slower than static function calls. Also, there's no inlining opportunity. There is caching to make method calls faster if you call the same method a lot, and the code for cache lookups is impressively fast, but if you need some code to be Fast, consider using C-style functions in critical parts.

4. When in doubt, use the Instruments profiler to find bottlenecks. It's really good.

And now a small grab-bag of more minor ones:

5. +[NSString stringWithFormat:] is surprisingly slow, or it was when last I checked. Its CoreFoundation counterpart is similarly slow. (It's the same underlying code.)

6. When you load a plist, most of which will be deallocated almost immediately, surrounding this with an @autoreleasepool block often does wonders to reduce heap fragmentation. Same goes for other operations which will tend to produce large memory spikes of objects that will stay allocated pending an autorelease pop.

7. The Accelerate framework defines a number of SIMD data types; e.g. simd_float8 is a vector of 8 single-precision floats. You can do arithmetic on them like a normal numeric data type, and the compiler will automatically emit cross-platform SIMD code. If your needs are fairly basic, this is a remarkably easy way to do SIMD programming. I've managed to get ~8x speedups with it before. (A pity that the docs are so lacking.)

pjscott··on Charlie Munger has died
There are other dormitories on campus. One size doesn't fit all, but you've got to work on the margin.
pjscott··on Charlie Munger has died
According to Munger that was, indeed, the whole point. His dorm design focused on making the common areas nice places where people would enjoy spending time, while optimizing the dorm rooms for bed-related activities. It seems like a reasonable strategy.
pjscott··on Antirez' tiny JSON selector library
It's the normal use of goto in C: you run into some exceptional circumstance, you don't know how to deal with it, so you goto some code that cleans up any unfinished business you might have, like memory allocations – and then you return some error code as soon as you can, once everything is in a good state.
pjscott··on Bacteria store memories and pass them on for generations
Epigenetics is real, of course, but approximately nothing is passed between generations in humans. Here’s a good rundown from a geneticist:

https://www.razibkhan.com/p/you-cant-take-it-with-you-straig...

The actual biological reality is fascinating, and so much more interesting than the distorted version you get from unscientific fabulists.

pjscott··on Underage workers are training AI
> I’m judging the companies providing the “distasteful” options.

To restate my actual argument, since you haven't really responded to it: what work would you have very poor people do instead? There are other options, but are those options actually better? And how would you or I know?

It seems a little insulting to presume that you know their lives and their employment options better than they do, and should choose in their stead. But that's exactly what people are doing when they put public pressure on these companies to withdraw unseemly-looking options.

pjscott··on Underage workers are training AI
Putting aside your devaluation of the phrase "slave labor" by applying it to things that aren't slave labor, I'll just ask: what would you have these people do?

Should they take a 60% pay cut to do back-breaking labor at a construction site? Take a bigger pay cut to wash dishes at a restaurant? Or perhaps they could work long hours subsistence farming; that's a pretty common option in Pakistan, if the numbers I'm seeing are at all accurate. I know people who used to do this, and from what I hear it kind of sucks.

Taking distasteful options away from poor people because they might choose those options is one of my least-favorite forms of moral grandstanding, because it hurts people who already have it rough.

pjscott··on Underage workers are training AI
India spent decades under a very restrictive economic regime. That changed a lot after the big liberalization of 1991, but the official economic policies are still moderately stifling. The comment you're responding to was not made in bad faith.

https://en.wikipedia.org/wiki/Economic_liberalisation_in_Ind...

pjscott··on Underage workers are training AI
They trade away time and effort in exchange for money. Presumably they value the money more than the time and effort, because if they didn't, they wouldn't make that trade.
pjscott··on Underage workers are training AI
Employers are, indeed, making use of and benefiting from their employees. And vice versa. But so what? If they didn't benefit, they wouldn't bother.
pjscott··on Underage workers are training AI
I'll agree with all of 1–5, and elaborate on #2:

> Second, the companies paying these children are extracting value from their labor greater than what they are paying the child laborers.

This is always the case with employment, assuming that the employer isn't getting ripped off: when two parties make a voluntary trade, they're both getting something they value more than what they're trading away.

--

> In other words, this article, in my analysis, is an opportunity to study and question the system that creates the conditions such that there is a labor market comprising children who are available for exploitation for cheap labor by very rich Western companies.

I don't see anything that needs explaining here. Poverty is the default. For almost all of human history we were dirt poor. For almost all of agricultural history we were in a hungry, unpleasant Malthusian equilibrium.

The real miracle is that things are getting better. And a big part of why things are getting better is because it's possible for richer countries to 'exploit' cheap labor in poorer countries – and help them escape poverty by doing it. It's amusing how companies keep looking for cheap labor in different countries every few years, because the places that used to have the cheapest labor got wealthier because of those opportunities. I realize that not everybody shares my aesthetics, but personally I see this as beautiful, even if the ground-level details are a bit grungy.

pjscott··on Underage workers are training AI
This is a weird article. It starts with an anecdote about someone extremely poor who really needs some money, and how that person found a job with flexible hours and comfortable working conditions which paid relatively well. And then the article acts like this is obviously a horrible scandal that must be stopped.

Even if the allegations of "traumatizing content" are true and not exaggerated cherry-picking, shouldn't the decisions here be made by the people actually involved? When well-meaning, well-fed people take away their choices (and income), this isn't exactly doing them a favor.

pjscott··on Peter Thiel is taking a Break from Democracy
If they want to, then yes. Why wouldn't I?
pjscott··on Peter Thiel is taking a Break from Democracy
That's an odd thing to say. There are plenty of people who I dislike, but that doesn't mean I want them to die.
pjscott··on 11% of the world’s billionaires have held or sought political office
Interestingly, there's huge variance by country. Billionaires are much more likely to seek office in countries where this is either a source of valuable behind-the-scenes connections (e.g. China) or a way of preventing the regime from plundering their wealth (e.g. Russia).
pjscott··on Takkyu-bin: Luggage forwarding in Japan
That would fix the consonant germination problem, but it would also shift the vowel. There really are no good answers here.
pjscott··on Life After “Calvin and Hobbes”
In the scene above, it’s just one character who talks like that: the one who was born a very long time ago, and still speaks with archaic diction. It may break your personal immersion, but real people actually did talk like that in Early Modern English, and it makes in-universe sense for a Ringwraith to hold on to old speech patterns.
pjscott··on Takkyu-bin: Luggage forwarding in Japan
> pronounced: tah-cue-bean

I always wince slightly when I see one of these pronunciation guides for words that I actually know how to pronounce, because for some reason they're never quite right. (I don't know how I'd do better, mind you, and this pronunciation would get the job done.)

pjscott··on Appending to an std:string character-by-character: how does the capacity grow?
LLVM's libc++ doesn't use a generic growable vector thing for std::string; they rolled their own, specifically for strings. (I checked the source. Alas, no explanatory comments and nothing in the "initial libc++ import" git commit message.)
pjscott··on Life After “Calvin and Hobbes”
Huh. That’s exactly the opposite of the impression I got. The books seemed properly solemn when it counted, more so than the movies, and I found that the poems really added to the atmosphere. (I’m particularly fond of the ones sung by Gimli and Galadriel; as sad and wistful as they were, they managed to convey a lot of mood and emotion in just a few carefully-chosen words.)
pjscott··on Visualizing American inflation across eight categories
This probably varies from place to place. A high-quality double cheeseburger in my area can be had for $6.19, and adding tomato is only a little extra. (I checked prices a minute ago, so these numbers are fresh.)
pjscott··on Canada ends official time signal
A lot of the thinking in there is intellectually downstream of ideas invented by Cold War nuclear geostrategists, so that’s not too surprising. The desire to not get blown up drove some people to think deeply about how to deal with foreign civilizations that think differently from you, have conflicting interests, but also don’t want to get blown up.
pjscott··on Anything longer ago than yesterday should just say the actual date
Yes. As God intended when He created the heavens and the earth on January 1, 1970.
pjscott··on The MP3mobile (1998)
You're not alone. I have a cheapo mp3 player from a Chinese no-name brand -- I'm pretty sure I've seen the exact same thing sold under multiple brands, for some reason -- and it's tiny, light, and good at playing music. Way better experience than having a smartphone clunking around in my pocket.
pjscott··on Automakers invented the crime of jaywalking (2015)
To clarify: under the laws linked above, jaywalking is categorized not as a crime or misdemeanor but as a traffic infraction, just like breaking the speed limit or failing to signal a turn.
pjscott··on Palantir has courted N.H.S. England with pandemic help and assertive lobbying
Pretty much all libertarians favor some mechanism for the enforcement of property rights. They may differ as to how, but they agree that you shouldn’t be allowed to steal other people’s stuff.

(Please, I beg you, argue with the opinions that people actually have instead of something you just made up.)

pjscott··on Palantir has courted N.H.S. England with pandemic help and assertive lobbying
Impulsive? He seems much more the calculating sort, which makes me skeptical about your judgement that he’s unethical.
pjscott··on Kafka as an Antipattern
Yes. For perspective, that's about one message every ten seconds.
pjscott··on Croatia demolished houses of libertarian project “Liberland”, seized property
It's a little under 0.2%, using the revenue and GDP numbers from last year. (You might have misplaced the decimal point?)
← PreviousPage 3 of 34Next →