Hacker Newsnew | past | comments | ask | show | jobs | submit | nekopa's favoriteslogin

"This is a Golden Sunrise carrot, in burnt orange with off-green foliage. Heritage. What do you think?"

"Very nice, Bateman," Bryce replies. "When did a dork like you get so tasteful?"

It's all going well, and then Van Patten places his carrot on the table. It's fucking magnificent.

"This," he says, "Is a Pioneer Ridge carrot, in deep ochre with leaves in a color called 'hazy forest.' The seed stock is heritage, and the planting was organic."

"Amazing," says Bryce. "This is the best carrot I've seen all day."

I can't believe Bryce prefers Van Patten's carrot to mine.


I have a slight fascination with sweeteners. About five years ago I imported a kilo of "Neotame" sweetener from a chem factory in Shanghai. It was claimed to be 10,000-12,000 times sweeter than sugar. It's a white powder and came in a metal can with a crimped lid and typically plain chemical labeling. Supposedly it is FDA-approved and a distant derivative of aspartame.

US customs held it for two weeks before sending it on to Colorado with no explanation. When received, the box was covered in "inspected" tape and they had put the canister in a clear plastic bag. The crimped lid looked like a rottweiler chewed it open and white powder was all over the inside of the bag. I unwisely opened this in my kitchen with no respirator as advised by the MSDS which I read after the fact (I am not a smart man).

Despite careful handling of the bag, it is so fine in composition that a small cloud of powder erupted in front of me and a hazy layer of the stuff settled over the kitchen. Eyes burning and some mild choking from inhaling the cloud, I instantly marveled at how unbelievably sweet the air tasted, and it was delicious. For several hours I could still taste it on my lips. The poor customs inspector will have had a lasting memory of that container I'm pretty sure.

Even after a thorough wipe-down, to this day I encounter items in my kitchen with visually imperceptible amounts of residue. After touching it and getting even microscopic quantities of the stuff on a utensil or cup, bowl, plate, whatever, it adds an intense element of sweetness to the food being prepared, sometimes to our delight. I still have more than 900g even after giving away multiple baggies to friends and family (with proper safety precautions).

We have been hooked on it since that first encounter. I keep a 100mL bottle of solution in the fridge which is used to fill smaller dropper bottles. I've prepared that 100mL bottle three times over five years, and that works out to about 12g of personal (somewhat heavy) usage for two people in that time. Probably nowhere near the LD50.

I carry a tiny 30mL dropper bottle of the solution for sweetening the nasty office coffee and anything else as appropriate. Four drops to a normal cup of coffee. We sweeten home-carbonated beverages, oatmeal, baked goods (it is heat stable), use it in marinades, and countless other applications.

I don't know if it's safe. The actual quantity used is so incredibly tiny that it seems irrelevant. I'd sweeten my coffee with polonium-210 if it could be done in Neotame-like quantities. Between this, a salt shaker loaded with MSG and a Darwin fish on my car, I'm doomed anyway.


Lots of people make the mistake of thinking there's only two vectors you can go to improve performance, high or wide.

High - throw hardware at the problem, on a single machine

Wide - Add more machines

There's a third direction you can go, I call it "going deep". Today's programs run on software stacks so high and so abstract that we're just now getting around to redeveloping (again for like the 3rd or 4th time) software that performs about as well as software we had around in the 1990s and early 2000s.

Going deep means stripping away this nonsense and getting down closer to the metal, using smart algorithms, planning and working through a problem and seeing if you can size the solution to running on one machine as-is. Modern CPUs, memory and disk (especially SSDs) are unbelievably fast compared to what we had at the turn of the millenium, yet we treat them like they're spare capacity to soak up even lazier abstractions. We keep thinking that completing the task means successfully scaling out a complex network of compute nodes, but completing the task actually means processing the data and getting meaningful results in a reasonable amount of time.

This isn't really hard to do (but it can be tedious), and it doesn't mean writing system-level C or ASM code. Just seeing what you can do on a single medium-specc'd consumer machine first, then scaling up or out if you really need to. It turns out a great many problems really don't need scalable compute clusters. And in fact, the time you'd spend setting that up, and building the coordinating code (which introduces yet more layers that soak up performance) you'd probably be better off just spending the same time to do on a single machine.

Bonus, if your problem gets too big for a single machine (it happens), there might be trivial parallelism in the problem you can exploit and now going-wide means you'll probably outperform your original design anyways and the coordination code is likely to be much simpler and less performance degrading. Or you can go-high and toss more machine at it and get more gains with zero planning or effort outside of copying your code and the data to the new machine and plugging it in.

Oh yeah, many of us, especially experienced people or those with lots of school time, are taught to overgeneralize our approaches. It turns out many big compute problems are just big one-off problems and don't need a generalized approach. Survey your data, plan around it, and then write your solution as a specialized approach just for the problem you have. It'll likely run much faster this way.

Some anecdotes:

- I wrote an NLP tool that, on a single spare desktop with no exotic hardware, was 30x faster than a 6-high-end-system-distributed-compute-node that was doing a comparable task. That group eventually used my solution with a go-high approach and runs it on a big multi-core system with as fast of memory and SSD as they could procure and it's about 5 times faster than my original code. My code was in Perl, the distributed system it competed against was C++. The difference was the algorithm I was using, and not overgeneralizing the problem. Because my code could complete their task in 12 hours instead of 2 weeks, it meant they could iterate every day. A 14:1 iteration opportunity made a huge difference in their workflow and within weeks they were further ahead than they had been after 2 years of sustained work. Later they ported my code to C++ and realized even further gains. They've never had to even think about distributed systems. As hardware gets faster, they simply copy the code and data over and realize the gains and it performs faster than they can analyze the results.

Every vendor that's come in after that has been forced to demonstrate that their distributed solution is faster than the one they already have running in house. Nobody's been able to demonstrate a faster system to-date. It has saved them literally tens of millions of dollars in hardware, facility and staffing costs over the last half-decade.

- Another group had a large graph they needed to conduct a specific kind of analysis on. They had a massive distributed system that handled the graph, it was about 4 petabytes in size. The analysis they wanted to do was an O(N^2) analysis, each node needed to be compared potentially against each other node. So they naively set up some code to do the task and had all kinds of exotic data stores and specialized indexes they were using against the code. Huge amounts of data was flying around their network trying to run this task but it was slower than expected.

An analysis of the problem showed that if you segmented the data in some fairly simple ways, you could skip all the drama and do each slice of the task without much fuss on a single desktop. O(n^2) isn't terrible if your data is small. O(k+n^2) isn't much worse if you can find parallelism in your task and spread it out easily.

I had a 4 year old Dell consumer level desktop to use so I wrote the code and ran the task. Using not much more than Perl and SQLite I was able to compute a large-ish slice of a few GB in a couple hours. Some analysis of my code showed I could actually perform the analysis on insert in the DB and that the size was small enough to fit into memory so I set SQLite to :memory: and finished it in 30 minutes or so. That problem solved, the rest was pretty embarrassingly parallel and in short order we had a dozen of these spare desktops occupied running the same code on different data slices and finishing the task 2 orders of magnitude than what their previous approach had been. Some more coordinating code and the system was fully automated. A single budget machine was theoretically now capable of doing the entire task in 2 months of sustained compute time. A dozen budget machines finished it all in a week and a half. Their original estimate on their old distributed approach was 6-8 months with a warehouse full of machines, most of which would have been computing things that resulted in a bunch of nothing.

To my knowledge they still use a version of the original Perl code with SQlite running in memory without complaint. They could speed things up more with a better in-memory system and a quick code port, but why bother? It's completing the task faster than they can feed it data as the data set is only growing a few GB a day. Easily enough for a single machine to handle.

- Another group was struggling with handling a large semantic graph and performing a specific kind of query on the graph while walking it. It was ~100 million entities, but they needed interactive-speed query returns. They had built some kind of distributed Titan cluster (obviously a premature optimization).

Solution, convert the graph to an adjacency matrix and stuff it in a PostgreSQL table, build some indexes and rework the problem as a clever dynamically generated SQL query (again, Perl) and now they were realizing .01second returns, fast enough for interactivity. Bonus, the dataset at 100m rows was tiny, only about 5GB, with a maximum table-size of 32TB and diskspace cheap they were set for the conceivable future. Now administration was easy, performance could be trivially improved with an SSD and some RAM and they could trivially scale to a point where dealing with Titan was far into their future.

Plus, there's a chance for PostgreSQL to start supporting proper scalability soon putting that day even further off.

- Finally, a e-commerce company I worked with was building a dashboard reporting system that ran every night and took all of their sales data and generated various kinds of reports, by SKU, by certain number of days in the past, etc. It was taking 10 hours to run on a 4 machine cluster.

A dive in the code showed that they were storing the data in a deeply nested data structure for computation and building and destroying that structure as the computation progressed was taking all the time. Furthermore, some metrics on the reports showed that the most expensive to compute reports were simply not being used, or were being viewed only once a quarter or once a year around the fiscal year. And cheap to compute reports, where there were millions of reports being pre-computed, only had a small percentage actually being viewed.

The data structure was built on dictionaries pointing to other dictionaries and so-on. A quick swap to arrays pointing to arrays (and some dictionary<->index conversion functions so we didn't blow up the internal logic) transformed the entire thing. Instead of 10 hours, it ran in about 30 minutes, on a single machine. Where memory was running out and crashing the system, memory now never went above 20% utilization. It turns out allocating and deallocating RAM actually takes time and switching a smaller, simpler data structure makes things faster.

We changed some of the cheap to compute reports from being pre-computed to being compute-on-demand, which further removed stuff that needed to run at night. And then the infrequent reports were put on a quarterly and yearly schedule so they only ran right before they were needed instead of every night. This improved performance even further and as far as I know, 10 years later, even with huge increases in data volume, they never even had to touch the code or change the ancient hardware it was running on.

It seems ridiculous sometimes, seeing these problems in retrospect, that the idea was that to make these problems solvable racks in a data center, or entire data centeres were ever seriously considered seems insane. A single machine's worth of hardware we have today is almost embarrassingly powerful. Here's a machine that for $1k can break 11 TFLOPS [1]. That's insane.

It also turns out that most of our problems are not compute speed, throwing more CPUs at a problem don't really improve things, but disk and memory are a problem. Why anybody would think shuttling data over a network to other nodes, where we then exacerbate every I/O problem would improve things is beyond me. Getting data across a network and into a CPU that's sitting idle 99% of the time is not going to improve your performance.

Analyze your problem, walk through it, figure out where the bottlenecks are and fix those. It's likely you won't have to scale to many machines for most problems.

I'm almost thinking of coming up with a statement: Bane's rule, you don't understand a distributed computing problem until you can get it to fit on a single machine first.

1 - http://www.freezepage.com/1420850340WGSMHXRBLE


There was an almost identical post about 3 weeks ago here.

Let me state flat out that I don't think there are any good books about algorithmic trading all all.

Most will talk at surface level about what they are doing but non will give you a start to finish example that can be deployed with a brokerage like interactive brokers. Trading & Exchanges I see was recommended. I'd skip it, most(All?) trading strategies that the average person will come up with won't be market micro structure related, and if it is then I'm going to flat out state that you've lost before you started.

If you really want to get into it, then please don't start with machine learning.

I've said this many times but ask your self:

- "what machine learning techniques could I apply that 100 fresh PHD's haven't done on their first week at a hedge fund?"

- "What data source do you have that the average hedge fund doesn't have access to"?

- "What market insight do you have that someone whose done this for years doesn't have?"

If after all that you still want to get started then honestly your best bet is to start with quantopian. Don't look at market data changes at a granularity of less than 1 day until you can create a strategy on your own that makes money.

Quantopian can give you access to a backtesting platform and clean market data, which is the step most people get stuck on, and usually quit at.

Once you've found a strategy that makes money, put your money into an account with Interactive brokers, If after 3 months you still want to continue then start looking at market data slices of less than one day.

Tl/DR

- first step is don't

- second step is to focus on time slices of 1 day or more

- third, put your own money into action on you strategy for 3 months

- fourth step, there is a very small chance you'll make it this far, look at time slices of less than a day. At this point you can start to apply machine learning and build your own software. Even at this stage you are more likely to be an ATM for a hedge fund than you are to make money.

Good luck

Feel free to reach out to me, personal email in profile if you'd like to chat.


This actually has a lot of good information. It's just that you have to get to it to know that. The sections talking about methods like OOP are pretty good summary of pro's and con's. The PDF Reader p93 "Good programming practices..." has good ones common in safety-critical embedded & some OS development but that I see almost no other C programmers doing. There's some common advice mixed in. That whole section is worth finding the document as low-level programmers will find at least 5 things they didn't think about. At least.

Section 6.4 (p109) is a nice overview of requirements analysis benefits and types. 6.4.1.2 is high-assurance requirements which most projects don't have. Appendix H checklist is decent. 6.6.3 (p126) covers many useful analysis often done at compiler or type system level in CompSci. Follows with basic, but inadequate, explanation of formal specs.

Section 7.4.2 (p141) goes into all sorts of techniques for fault-tolerance. 7.4.4 (p145) talks language considerations for reducing defects. Following sections are limiting complexity & designing for easy maintenance. If only enterprises and their management read that stuff... 7.5.2 onward talks Design Analysis with examples nicely rating benefit vs effort required. First and interface failure lists plus especially design constraints are good as people overlook some subset of them usually.

Section 8.4 (p169) is where coding & testing practices begin. Quite thorough with cost benefit analysis I mostly agree with on coding side. Remember that requirements & design already knocked out most issues with code basically just implementing a precise spec. That's why some get "Low" rating when, in tossed-together coding, they might otherwise have high impact.

Ch 9 (p179) is main section on testing. It could be subsetted but pp 182-183 is nice, exhaustive list of what to look at. 9.4 (184) nice list of testing types. Nevermind, the latter sections are even better. Section 11.1.4 (p210) on languages, compilers, etc is pretty thorough with a sound, uncommon recommendation on language used. :) CASE tools (pp236) has nice list of capabilities for general, SW tooling worth imitating.

pp264 has list of common, human errors. p273 has list of questions to ask about dependencies, esp 3rd party software.

So, contrary to mysterypie et al, I find the document to have about everything you need to know to write software that either doesn't fail or handles failure well. It's meant to get you started on every aspect so you can follow up on it with specialist texts. It also drops literally hundreds of useful heuristics and list items that help you achieve your goal. Many of them are non-obvious. Quite a few would've prevented failures I see regularly on HN from otherwise competent developers. I'm for trimming the fat out of this thing to make it the reference text on high-assurance system development that it deserves to be. Plus, collecting together with it key information it references (esp specialist guides) so people can selectively look up and master pieces at a time.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: