HNHacker News
TopNewBestAskShowJobs

tmyklebu

134 karma · joined February 19, 2017

submissionscomments
tmyklebu··on How to Write Unmaintainable Code (2017)
> That’s why languages don’t represent dates as just as struct with ints

In C, `struct tm` is literally a struct whose fields are all `int`s. But people typically represent time in C programs as an integer of some width measuring time in some fixed unit since some fixed point in time.

> - there is a Date class that knows how to semantically add days to dates taking leap years into account, time zones, etc. That supports our point.... > > Then will your class take into account that the calendar changed in the mid 1600s(?). If you need to calculate dates and compare dates.

I can't anticipate those requirements---maybe our date class has to bomb out if you pass in, say, 1800 or -5 as a year because someone on my team insists they're invalid.

People work around these classes when they have to do date arithmetic because they're too slow, or they depend on the machine's locale and the locale isn't under control, or they take timezones into account in fundamentally broken ways, or any number of other reasons.

>> If you have a special SensorReadingId type and you change what it is, all your code breaks at once and you get a hell of a mess to untangle. > > How so? All of your other code should be treating it like an opaque type.

That's a fantasy. When you wrote your reply, you deleted all the parts of my post explaining "how so"---why not all of your other code is going to treat it like an opaque type.

> You shouldn’t have to do it in but one place. The serializer would call your .ToString() method anyway. You just override it.

I don't want to convert your boxed int to a string and then parse it as an integer just to do math on it. That creates a ton of syntactic noise, not to mention being slow.

> Versioning and deprecating APIs and interfaces is a solved problem.

Yes, and the solution is a pain in the ass! So don't create new interfaces to version and deprecate for no good reason.

> I thought we were specifically not talking about low level languages and you mentioned Java. When would that be an issue in Java?

I didn't mention Java.

> I wouldn’t be sending my Account class that probably has business logic in it across the wire. I would be mapping it to a dumb AccountModel POCO/POJO with something like Automapper.

And I'd just send an integral id over the wire, probably documenting that it's the id of an account using something like the field's name in the message. No extra tooling needed, and I don't have to make a fuss about how the id() function (that I had to add to the Account object anyway) is for the big boys and should be avoided whenever possible.

People rapidly get themselves into deep shit when they find out their overcooked codebase is too slow to be useful. The class names remain but their structure and function and any semblance of the clean abstraction they used to provide are the first things to go.

tmyklebu··on How to Write Unmaintainable Code (2017)
> It is never "just an int". Soon you will ask questions about the int, and in a sufficiently large application you will forget the answers to the quesions easily, and scatter the same question (i.e., the same boolean logic) all over the place. Consider an application where you need to filter something by year. A year, you know? As in 1974, 2018, etc. An int is bad, because an int could be -5, which does not make sense. Ok, a uint then? Still bad, because then there is a year 0 and - if your application deals with birthdays of real people, 1800 would be an invalid birthday. The semantics (or pragmatics, linguistically speaking) emerge from how you interpret the integer, and this interpretation can happily live in that one file with that one class that encapsulates "just" that integer.

Are you honestly suggesting making a Year class to represent years in a C++-like language? And you want to forbid Years from being -5 or 1800, because they "do not make sense"?

What if I want to interpret the integer in a way you didn't think of when you wrote your Year class? Maybe I want to know whether my friend John was older when his sister Sally was born than Jesus was when St. Paul was born?

> What if you start with a 32bit integer and suddenly you realize that your weird Internet-Of-Things-Sensor reading database has grown and the 32bit integer is getting too small? You could just use 64bits. With "just an int", you now get to change every single function that expects an int for the purpose of a SensorReadingId (or an account id or whatever) and change it to size_t, uint, int64 or whatever.

The work needed to push the buttons on your keyboard to make the changes is the least of your worries when you want to change the underlying data types used in a complex program. If you have a special SensorReadingId type and you change what it is, all your code breaks at once and you get a hell of a mess to untangle.

It may not be practical to enforce "ints that represent sensor reading ids are SensorReadingId type" across all of your code. You'll need to unpack your type to a primitive type whenever you talk to an external library or serialise SensorReadingId's to storage or the network. Even if you did enforce SensorReadingId everywhere:

- Arrays of SensorReadingId now double in size. Perhaps your code crashes at startup because some stack frame grew too large.

- If you serialise SensorReadingId's anywhere, changing the type broke binary compatibility with your old code. Or the network protocol you're supposed to be speaking. Or the library you're using.

- You probably had to make a toInt() or unpack() or similar function anyway so that people who want to get at information inside the value of the SensorReadingId can do so. You still have to look at all the call sites of these functions.

In reality, you're going to do this sort of change incrementally. You push the 64-bit integers through more and more code, taking care that the high bits of the integers make it through everywhere you've made the change.

> As for returning an AccountID: I'd like to point out that the Account is a strong and independent object, who can make his own decisions and does not need to return anything. Returning its id like that is actually breaking encapsulation. Still if you do it, it probably shouldn't be an integer.

Why is an Account making its own decisions? This sounds like the "circle that knows how to draw itself" antipattern. My friend and I want to talk about a certain Account; how do I arrange things so that the Account makes the decision to put an identifier for itself into a certain field in a certain protobuf message before I send the message to my friend?

tmyklebu··on Clojure Numerics: Orthogonalization and Least Squares
> I do not understand what the form of that matrix has to do with java or native heap. This seems to me as a completely orthogonal issue. As for the triangular form, this is supported in Neanderthal, as well as the rest of special structural sparse shapes.

You support triangular matrices. However, you can solve a linear system of the form I gave in linear time, while it takes quadratic space and time to form the corresponding triangular matrix and do a triangular solve.

Not all special matrices are supported by BLAS/LAPACK. Other common examples might be block Toeplitz/Hankel matrices for which fast multiplication and fast solvers are available. In order to support special (not in BLAS/LAPACK) matrix operations naturally, you'd want natural, no-extra-copying access to the vectors within Java or Clojure so that you can write the good algorithm manually, as you'd do in C or Fortran.

tmyklebu··on Clojure Numerics: Orthogonalization and Least Squares
Aha, makes sense. (Now I see that at http://neanderthal.uncomplicate.org/articles/tutorial_native...) Doesn't this make it very painful to do unusual operations on matrices? For example, solving linear systems Ax=b where A is of the form

  [ 1                                             ]
  [ a_2 b_1  1                                    ]
  [ a_3 b_1  a_3 b_2  1                           ]
  [ ...      ...      ...      ...                ]
  [ a_n b_1  a_n b_2  a_n b_3  ...  a_n b_{n-1} 1 ].
tmyklebu··on Clojure Numerics: Orthogonalization and Least Squares
How do you use MKL and friends on objects in the Java heap? It seems like you'd have to copy to the native heap, do your linear algebra operation, and then copy the result back from the native heap.
tmyklebu··on In defence of swap: common misconceptions
It doesn't go lower than 0. Swapping can still hose your machine when swappiness is set to 0.
tmyklebu··on In defence of swap: common misconceptions
> If you sometimes run out of memory (or even get close), then you should have some swap. This seems fairly obvious to me. Relying on the OOM killer to "clean things up" is pretty dubious. But was there every any serious argument to do this? I've literally never heard of that before.

Why does that seem obvious to you? With swap, running low on memory is game over. Without swap, the OOM killer runs. You can call the OOM killer dubious, graceless, or any number of other things, but it gets the system responsive again without doing as much damage as the human intervention that's otherwise required.

tmyklebu··on In defence of swap: common misconceptions
> One problem with relying on the OOM killer in general is that the OOM killer is only invoked in moments of extreme starvation of memory. We really have no ability currently in Linux (or basically any operating system using overcommit) to determine when we're truly "out of memory", so the main metric used is our success or failure to reclaim enough pages to meet new demands.

The problem with relying on swap instead of the OOM killer is that, instead of the OOM killer, the user gets invoked in moments of extreme starvation of memory and the whole machine gets rebooted. The OOM killer is far gentler; it only kills processes until the extreme starvation is resolved.

tmyklebu··on In defence of swap: common misconceptions
> You're in for quite a surprise, particularly on desktop. I have a number of processes with some pages swapped out, and I see no impact on interacting with the said processes. Firefox, gDesklets, a volume changer, and several instances of rxvt are among them.

Is an appreciable amount of RAM freed up here? I was under the impression that Firefox churned through whatever it allocated (garbage-collected Javascript VM) and rxvt had a very small footprint, most of which is code shared among all of your rxvt instances.

>> I also disagree with (2). The consequences of getting these predictions wrong seem to be very bad. > > Only in the case of repeated mispredictions, which only happens if you really have low RAM and are on a good way to invoke OOM killer anyway.

Even if things were as rosy as you suggest, isn't that my point? Better that the OOM killer cleans something up than I bounce the machine and clean everything up. That said, the OOM killer won't necessarily run anytime soon:

I just spun up a VM with 1GB of memory and 1GB of swap. 'time ssh guest echo hello' from the host usually takes anywhere from 140ms to 1.2s. I wrote a C program that allocates a gigabyte (in two 512MB pieces) and churns it through swap by writing to random bytes. 'time ssh guest echo hello' now takes 4-8 seconds. The oom killer didn't run once in the five minutes I ran the swap-churning process. Setting /proc/sys/vm/swappiness to 0 didn't change the symptoms; 'time ssh guest echo hello' still takes 4-8 seconds. This is on Linux 4.9.65.

If I crank the number of churning threads up from 1 to 8, the one 'time ssh guest echo hello' I tried took 33 seconds. I am not patient enough to see what happens with 64 churning threads, which is entirely reasonable, but I would expect the latency involved in rescuing the machine to cause any reasonable administrator to simply bounce it.

In this workload, the kernel is consistently failing to predict which pages are unimportant; the mispredictions are expensive; the RAM saved by swapping out bash, sshd, and killall (or whatever) is negligible; and the important work of allowing remote login to diagnose and clean up the mess is held up unconscionably long to make room for what, in practical instances, is a user error.

I did a 'swapoff -a' and ran the same C program and it gets killed almost immediately.

tmyklebu··on In defence of swap: common misconceptions
Either way, I learned something. I can picture an array of 20 disks sustaining 2GB/s, but you aren't going to fit 20 disks into a laptop. I didn't realise a high-end SSD could get there, or even how much better regular SSDs are for throughput. (That cost per TB, though!)
tmyklebu··on In defence of swap: common misconceptions
> Very few people on this thread read and understood the article.

Hmm. I read the article and I think I understood it. However, in my experience, you run out of RAM if and only if your working set is too big. In my experience, all involved find it desirable to reduce the size of the working set as quickly as possible. Your experience seems to differ.

> The point isn't working with data sets larger than RAM. The point is making better use of the RAM you do have by taking pages you'll almost never touch and spilling them to disk so that there's more room in RAM for pages you will touch.

Your reasoning is too sloppy. It supports neither your blanket statements nor your pained analogy.

You appear to presuppose that:

(1) The kernel can predict which pages the user will "almost never touch."

(2) Mispredicting which pages will be "almost never touched" is of relatively low cost.

(3) Swapping pages that the user will "almost never touch" to disk frees up an appreciable amount of RAM.

(4) When pulling those pages back from disk, the work held up is, on average, less important than whatever we got to do with the RAM in the meantime.

I disagree with (1). Like I said elsewhere in the comments on this article, the kernel cannot reliably predict whether a process will "almost never touch" a given page. The kernel does not have sufficiently detailed knowledge of the process's purpose or access patterns.

I also disagree with (2). The consequences of getting these predictions wrong seem to be very bad. When lots of mispredictions happen in a tight cluster, the kernel and all running processes will be stopped when the user forcibly bounces the machine. If you let the OOM killer run instead of swapping, the kernel stays up and only a few running processes die. Having a working set whose size is larger than RAM but smaller than RAM + swap seems to be a recipe for a very long cluster of such mispredictions and a human intervention.

I am curious to hear about workloads where (3) occurs. (Non-latency-sensitive Java code that doesn't churn objects too fast? You've allocated a heap of a certain size, and the half or so that's free doesn't get disturbed too much.)

Regarding (4), even if the kernel could reliably predict cold pages, "page will almost never be touched" isn't necessarily the right criterion for swapping a page to disk. What if reading from the page will be on the critical path for something users do care about, such as logging in and killing a misbehaving process?

tmyklebu··on In defence of swap: common misconceptions
> They could, but that's a lot like just making swap be manual.

Sure. Isn't that a good thing? Rarely-used data can be swapped out to storage allocated for the purpose, as you desire, and too-large working sets don't have to hose the machine.

> I don't mean the code itself, I mean all the data it builds up for something that isn't needed.

I guess I don't often run programs that waste large amounts of memory for no reason. Either my working set fits or it's too large, and swap only matters if it's too large.

Is Java the typical beneficiary here?

tmyklebu··on In defence of swap: common misconceptions
If I may ask, which disks are you using?
tmyklebu··on In defence of swap: common misconceptions
> The purpose of swap is not running things out of it. The purpose is shoveling unused data out of memory. And for that it doesn't need to be particularly fast.

You can't detect a priori whether data is "unused." If you guess wrong a few times in a row, you get the familiar pattern where your Linux box is unresponsive to everything and needs to be bounced.

If you could detect whether data is rarely used, swap still isn't necessary. Applications can mmap() a file and use that region for "rarely used data" if such is known in advance.

Extraneous functions should be backed by the executable in the common case. In the JIT case, they probably won't be JITted anyway.

I still think the OOM killer is less intrusive than swapping to disk. It kills some, but not all, of the processes on the machine get killed. The system pretty reliably comes back to life in less time than it takes a human to diagnose the problem and bounce the system. As a bonus, no human needs to get involved.

tmyklebu··on “Deep Learning has outlived its usefulness as a buzz-phrase”
> I meant, in general settings (ie, no special problem structure), that you need full Hessians for Newton’s method. And, regarding conjugate gradient, in (non-DL) settings that I’m used to, that for good results you need preconditioners which are also second order.

Yep, but often sparsity is present or the objective function is reasonably well-behaved. The former can save straight Newton; the latter will make nonlinear CG or quasi-Newton methods converge rapidly. (Quasi-Newton methods build a simple model of the Hessian from gradient and step information, usually using repeated low-rank modifications of a diagonal matrix. There are variants, like L-BFGS, that have an explicit, tunable limit on the number of additional vectors to be stored. This work really well for some reason---usually far better than gradient descent, and almost never more than a small constant factor slower)

> Could you provide a reference to a 10^7 size problem that is being optimized with Newton’s method? I’d be indebted.

Interior-point methods for linear programming form the Hessian of a barrier function at each iteration, then (sparse) Cholesky factorise it, then do a few backsolves to find a search direction. (Special hacks generally go into these "few backsolves" to speed convergence.) This is a damped Newton method. Commercial implementations include CPLEX, Gurobi, and MOSEK; there are a great many less-commercial implementations as well.

Chih-Jen Lin's LIBLINEAR uses a truncated Newton method (solve Hessian*direction=gradient by linear conjugate gradient, stopping early when sufficient accuracy has been obtained to take a step) to create linear classifiers for data.

tmyklebu··on “Deep Learning has outlived its usefulness as a buzz-phrase”
> You mention Newton’s method, but of course that requires second order information which, as I mentioned, is not generally workable in high dimensions.

Why would you say that second-order information is "not generally workable in high dimensions"? We regularly run Newton's method on problems with tens of millions of variables today.

And Newton's method isn't the only way to use second-order information. It is easy to access, for example, Hessian-times-vector information using the same reverse-mode differentiation that's so popular today, using only a constant factor more time.

> You have to be careful with quasi-Newton methods like conjugate gradient for the same reason.

What reason, exactly, is that?

tmyklebu··on “Deep Learning has outlived its usefulness as a buzz-phrase”
> You can make an argument that, in high-dimensional parameter spaces, it’s hard to do better (because, gradient descent is linear in the number of dimensions).

Nitpick: If you're interested in solving optimisation problems, it's very easy to do better than gradient descent. Gradient descent performs very poorly when the directional curvature of the objective function varies too much with the direction. Newton's method, quasi-Newton methods, and nonlinear conjugate gradient are some of the more ingenious, beautiful, and clean ways; there are also some dirty, hacky ways to go.

It is a little bit interesting that fancier optimisation algorithms than gradient descent are unnecessary or unhelpful in some large-scale applications.

tmyklebu··on Algorithm efficiency comes from problem information
Yep. (Largely) irrelevant in practice. But the gap between what we can do and what lower bounds we can prove is very large indeed for many matrix operations.
tmyklebu··on Algorithm efficiency comes from problem information
It looks like you also turned the rest of your post into a link.

The best currently known exponent for square matrix multiplication is around 2.3728; Wikipedia's page on matrix multiplication has a reference.

tmyklebu··on Algorithm efficiency comes from problem information
The details people are talking about in that MathOverflow thread concern the precision needed to represent the numbers that crop up during Gaussian elimination. (They get huge, and if you are counting bit or word operations, then Gaussian elimination is indeed terribly slow.) The post author is using a less detailed model in which he counts arithmetic operations. In this model, matrix multiplication and matrix inversion have the same asymptotic complexity.
tmyklebu··on Algorithm efficiency comes from problem information
You can compute the inverse of a matrix A in asymptotically the same amount of time as you can multiply two matrices. You can also Cholesky factorise in that amount of time, and compute T^(-1) A where T is (upper or lower) triangular in that amount of time. You invert by A^(-1) = (A^T A)^(-1) A^T, the latter computed by Cholesky and two triangular solves. You Cholesky and do triangular solves by divide-and-conquer.

So no, the article is wrong.

tmyklebu··on Show HN: OSQP: a new first-order solver for large-scale quadratic programs
> We compared our OSQP solver to other general-purpose solvers. That's why we chose GUROBI and Mosek.

Your computational results don't support calling OSQP general-purpose. OSQP does okay on the easy problems you randomly generate, but this doesn't seem to generalise---OSQP gives results on a bunch of the Maros-Meszaros problems that markedly disagree with previously published work.

> However our point is not to compare our solver to specific methods for certain classes (like libsvm).

You may not want to compare against libsvm's solver (though I imagine you look pretty good on the problems you're generating) but there is also a lot of data available at the libsvm webpage. This data might serve as a more representative SVM testbed than the random easy instances you're creating.

> In the benchmarks we are comparing examples with randomly generated data because we were interested in ~1400 problems in a range from 100 to 10 million nonzeros. The examples are not just random QPs, but data are generated in a reasonable manner and they have the same structure as problems people would actually solve in practice.

The "random QPs" and "random equality QPs" do seem to be "just random QPs."

I get cond(A^T A) ranging between 1.3 to 1.7 with your Lasso problem generator. These instances are going to be incredibly easy to solve, even with very naive algorithms. (Separately, why not eliminate the 'y' variable from your formulation? You get a formulation that's about 100 times smaller, and you should see a corresponding speedup.)

> In the arXiv paper we described in detail how we generated and checked optimality for the examples.

Yes, you check for a bunch of residuals' infinity-norms being smaller than 1e-3. But you get results that differ markedly from the other solvers' results. To me, that raises the question of whether the 1e-3 test is appropriate.

> As mentioned in the README of the repository that you checked out (https://github.com/oxfordcontrol/osqp_benchmarks) we used the conversion scripts from here: https://github.com/YimingYAN/QP-Test-Problems > > If you know better ways to convert the Maros problems (or other QP/LP benchmarks) to mat files or other formats compatible with Python, please let me know. I would be happy to try them.

Well, QPS is a punch-card style input format like MPS. Like MPS, I imagine you can write a parser for it in a couple of highly unfulfilling hours.

tmyklebu··on Show HN: OSQP: a new first-order solver for large-scale quadratic programs
You could compare number of nodes explored rather than absolute timings to see how inaccuracy solving the relaxations affects branch-and-bound.
tmyklebu··on Show HN: OSQP: a new first-order solver for large-scale quadratic programs
> Which version of OSQP did you try for? 0.2 has improved a lot compared to previous versions (much better convergence behavior with adaptive rho).

I did a 'git clone' of your repository this morning; I have 0edd758. (I learned about your project this morning.)

> Even though OSQP can solve also LPs, it is optimized to solve QPs.

I understand that, but (apart from dfl001) these aren't especially difficult LPs.

> - Randomly generated QPs from several classes such as control, portfolio, lasso, svm, Huber fitting

OK, but you wouldn't normally use a general-purpose IPM like Gurobi or Mosek for lasso or SVM problems, would you?

Separately, why randomly-generated QPs? Randomly-generated LPs tend to be very easy to solve, and I'd imagine a convex quadratic term in the objective only makes it easier. For SVMs, there's a bunch of available, fairly standard data associated with Chih-Jen Lin's libsvm.

> - The hard QP problems from the Maros-Meszaros test class (the reference benchmark testset for convex QPs)

How did you convert the Maros-Meszaros problems? The results output by your solver don't line up with the numbers in "00README.QP" on Maros's site. For example, Maros has:

  aug3d       1000    3873    6546    2673        0    5.5406773e+02
  aug3dc      1000    3873    6546    3873        0    7.7126244e+02
  aug3dcqp    1000    3873    6546    3873        0    9.9336215e+02
  aug3dqp     1000    3873    6546    2673        0    6.7523767e+02
while you get:

  13092,25,4873,3873,AUG3D,-782.432274207,0.012742196,OSQP_polish,optimal,1
  14292,25,4873,3873,AUG3DC,-1165.23756131,0.012990161,OSQP_polish,optimal,1
  14292,75,4873,3873,AUG3DCQP,-943.137853475,0.023050472,OSQP_polish,optimal,1
  13092,75,4873,3873,AUG3DQP,-661.262328725,0.023125477,OSQP_polish,optimal,1
When polishing succeeds, you get a different objective value from Maros (in this case by about 1e4, so a relative 1e-2):

  aug2d      10000   20200   40000   19800        0    1.6874118e+06
  aug2dc     10000   20200   40000   20200        0    1.8183681e+06
  aug2dcqp   10000   20200   40000   20200        0    6.4981348e+06
  aug2dqp    10000   20200   40000   19800        0    6.2370121e+06

  80000,25,30200,20200,AUG2D,1677511.7529,0.074053448,OSQP_polish,optimal,1
  80400,25,30200,20200,AUG2DC,1808268.06557,0.073366168,OSQP_polish,optimal,1
  80400,775,30200,20200,AUG2DCQP,6488034.73924,0.866898539,OSQP_polish,optimal,1
  80000,775,30200,20200,AUG2DQP,6227112.02536,0.8685775,OSQP_polish,optimal,1
tmyklebu··on Show HN: OSQP: a new first-order solver for large-scale quadratic programs
Did you test miosqp against standard MIQPs? For example, in QPLIB, there is a handful of convex mixed-integer QPs.
tmyklebu··on Show HN: OSQP: a new first-order solver for large-scale quadratic programs
What sort of QP problems are you hoping to solve using OSQP? When I tried OSQP on stock LP problems (i.e. the P = 0 special case; instances were afiro, adlittle, fit1p, dfl001, maros-r7, wood1p), I didn't get encouraging results. Apart from afiro, I got a lot of pretty wrong answers after relatively long periods of computation.
tmyklebu··on Why physicists still use Fortran (2015)
You're making a pretty big deal about trivial syntactic issues.

> Into something that looks like > > auto *my_matrix = new MathArray<double, 10, 10>();

The dimensions here are a template parameter. They must be known at compile time. Also, if you go this route and you want to write a function that, say, adds two matrices, you get one copy of that function in your binary for every matrix size that occurs in your program. You also can't naturally interoperate with someone else's matrix code unless that someone else specifically wrote against your MathArray template class.

> And if you'd really like you can hide the sizeof via a macro... > > #define MATRIX_MAKE(r, c, type) matrix_make(r, c, sizeof(type)) > > For me "real, dimension(:,:), allocatable :: " is much more complicated than "matrix_make"

It looks uglier, but it's language syntax rather than custom code. Whoever is reading your code doesn't have to unpack a macro and then look into a function to figure out what you're doing. (And as a bonus, the Fortran user can index the matrix without mentioning that it's a 'double' matrix when he's indexing.)

> Many of the issues people see in the speed difference between Fortran and C code will likely be based on their misunderstanding of how Fortran actually does their data layout and a misunderstanding of how the computer hardware (and what you're describing to C) to do. This "Double array" that was defined would never be allowed in production code. The amount you'd be hitting the OS for even small allocations is crazy.

Which many issues are you thinking about? Idiomatic Fortran has an inherent advantage over idiomatic C in that better aliasing information is available to the compiler.

tmyklebu··on Ask HN: How do you conduct coding interviews?
> 1) Most modern programming languages have ready-made implementations (by way of libraries) for almost every imaginable algorithm,

I really don't think this is true of any programming language, modern or not.

> written in the most efficient way,

Elementary but nontrivial problems like string matching and integer sorting often have poor standard library solutions, not to mention that "the most efficient way" is context-dependent.

> and probably all open source, so you can modify it if you feel otherwise.

Intel's MKL, which has a ready-made matrix multiplication that probably is about as fast as possible on their hardware, isn't AFAIK open-source. (Regardless, if you modify the standard library in your own environment, you risk creating serious interoperability headaches for yourself later on.)

tmyklebu··on Google removes SIMD.js support from Chromium
> Major compilers (LLVM, GCC, Intel) are able to vectorize real world code to a useful extent.

Try compiling this with recent gcc:

    uint8_t dumb_checksum(uint8_t *ar) {
      uint8_t ans = 0;
      for (int i = 0; i < 320; i++) ans += ar[i];
      return ans;
    }
You don't get satisfactory results. I, at least, don't have a clear mental model of when gcc will do something reasonable and when it will generate a large amount of bad code.
tmyklebu··on Paradoxes of probability and other statistical strangeness
Not sure I understand. Why should the number of home runs per year, the number of goals per year, and the number of touchdowns per year have equal variance?
← PreviousPage 2 of 3Next →