3,089 karma · joined September 22, 2011
Of the $3.95B total stock expense, $2.56B was from R&D, which suggests cash cost that quarter was more like $910m (still a lot!)
First, the 3.9B figure appears to represents all RSUs vested up to this point, aka many years worth ("(2) Q2 2019 includes $3.9 billion of stock-based compensation expenses, primarily due to RSU expense recognition in connection with our initial public offering"). That's why its slightly misleading - its many years worth of stock comp for employees which is all getting recognized this quarter (Happens in pretty much all the big tech IPOs)
In general though, its very reasonable to associate that as an expense, which is why GAAP requires it. Where that gets complicated is that its not an immediate cash expense to the company, hence some fudging around with non-GAAP accounting which is seen by some companies.
This all sounds weird for me to say because I certainly want devs to get paid, but this is the reality of the situation
Because your salary is much more influenced by market supply and demand than the value you create for your employer.
But for those that can, fancy shoes make a massive difference.
That is easy to change, but again there is the opt-int vs opt-out discussion.
X thing = new ...;
if (slowpath) {
unlikely_function(thing);
}
...
Even if unlikely_function isn't inlined, it can still perform scalar replacement, and push the allocation site into the branch (reconstructing the state of the allocated object as it would've been at that point), which is a big improvement.This in turn lets the inliner be smarter about what it does and doesn't inline, vs c2 which tries to greedily inline everything, partly to assist escape analysis
Integer b = a+1;
Integer c = a+1;
b==c
Which by default returns true for a=126 but false for a=127. A bad situation for sure, but thankfully pretty much every static analysis tool will spot that. def first[A](left: A, right: A): A = left
first(12, 42) // => 12
actually allocates nothing, because both numbers are in the Integer box cache range (-128 to 127 inclusive by default, but configurable to be greater). The general argument is good though, so mabye first(128,129) is a better example :)From what I understand Apple uses java/scala fairly extensively for backend services.
Seems like their new benchmarks might limit that sort of behavior
I contributed a little bit back in 2014/2015 and it was a lot of fun. Because it is almost all hand-written x86 ASM (which is insane), it was actually not too hard to reason about, certainly far easier than what Clang/GCC will spit out.
I've been down the exact rabbithole, before, but with java. There are 2 different bytecodes for representing a switch statement: tableswitch, which is dense (has a case for every key from X to Y), and lookupswitch, which is sparse. Of course the dense one must be better, I thought: O(1) vs O(log n) ! Maybe if I added a few more cases manually to my switch statement to cover missing holes, my lookupswitch would become a tableswitch and my hot loop would be faster.
Turns out, of course, that not only is O(1) not necessarily any faster than O(log n) when n is small and the constant factor is large (see this article), but in fact its irrelevant since the hotspot uses the same function to generate the IR for both bytecodes (http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/b756e7a2ec... ), and thus the decision about whether to use a jumptable or binary search is entirely unreleated to the bytecode that represents the switch statement :)