Better HN
topnewbestaskshowjobs
Log inSign up

kortex

8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions

Submissions

comment 4y ago · link · parent

> (Btw, O(n log n) _is_ a polynomial runtime, and so is O(N) or even O(1). Though I can see that as a shorthand of notation you are excluding them.)

I mean yes, technically n^1 is a polynomial, but normally this is just called linear. You hit the nail on the head with the last sentence. Here I'm using polynomial to basically mean "n^k, k>1". From a NP vs P point of view, P is considered tractable. But from a "actually writing libraries" point of view, I think software developers consider O(n^2) "kinda bleh" if it can be at all avoided. Also developers tend to give much more weight to the actual coefficients / parallelism potential / practical runtime. Neural networks have superlinear bounds everywhere, but GPU goes brrr.

Brass tacks, sorting some tuples and diffing the rank then reducing strikes me as likely to be:

- pretty fast even in the naive implementation

- sorting is a well trodden field

- easy to write things like shaders for

- amenable to speculative execution

- amenable to divide and conquer

So that is what I mean by efficient.

comment 4y ago · link · parent

> In essence, ecosystem failure due to a non-existent overlap of the telecom industry (full of commercial and expensive solutions) and the Internet community (working in a standards committee that tracks pre-existing permissionless innovation distributing the standards at no cost, strongly affiliated with free software ideas) caused ASN.1 to fall by the roadside.

Yep. I think this is the crux of the matter.

I don't even think it is an "uncool" thing. In a word, IMHO it's too "closed". Xml is not exactly hip, but I can find high scoring python xml libraries on snyk.io. I know that is not a very scientific metric but it's a good proxy for a bunch of things that are hard to measure.

I think even if it were "cool", it would be a struggle to get a culture to nucleate. It has the same vibe as codecs: complex, kinda arcane, too closely associated with closed source, litigious, corporate culture. It doesn't help that it is guilty by association with numerous poorly written libraries. Unless that is what you mean by "uncool".

Now that there is cbor, msgpack, cap'n proto, protobuf, thrift, and a bunch others (just in the binary space), asn.1 would have to make a really compelling argument to win out. It would need a lot more than coolness.

comment 4y ago · link · parent

Ugh, there is one dude in my town with this beat up old Civic with what sounds like a literal tin can for an exhaust, and the engine is tuned so badly that it backfires every time he shifts, which he does at the bend by my house. Which of course sets the dogs barking.

All I'm saying is, I kinda commiserate with the guy in that story.

Europe in general seems to have far less of that particular kind of jackassery. Better enforcement? Or are people just more considerate?

comment 4y ago · link · parent

Why do you need an arbitrary distribution? We are talking about breaking ties, just use uniform. You can probably just use RDRAND.

comment 4y ago · link · parent

> Pearson and other correlation coefficients are linear, O(n), sorting would incur logiarithmic multiplier O(NlogN).

> Thus, it is not computationally efficient.

That is not really what I meant. First, I personally consider NlogN the bar for "efficient" as far as algorithms go. Anything polynomial is inefficient, and anything better than NlogN is like, "super efficient" in my mind. Maybe that is a weird opinion, should I update my mental model? My reasoning is a lot of well known algorithms operate in better than polynomial but worse than linear time.

Second, sorting is a solved problem. Regardless of theoretical efficiency, we have so many ways to sort things, there is almost always really fast in practice ways of sorting data.

I didn't know about sorting networks, that is fascinating!

comment 4y ago · link · parent

There are so many super cool aspects to this!

- it's always fun when a new equation or formula is discovered, doubly so when it is very practical

- actually really easy to wrap your head around it

- seems very computationally efficient. Basically boils down to sorts and distance

- not limited to strict numeric fields ( integers and reals). Anything with an ordering defined can act as your Xs/Ys: characters, words, complex/vectors (under magnitude). I think you could even apply it recursively to divide and conquer high dimensional datasets.

- looks useful in both LTI and non stationary signal analysis

- possible use cases: exoplanet search, cosmology in general, ecology, climate, cryptanalysis, medicine, neuroscience, and of course, someone will find a way to win (more likely lose) money on stonks.

comment 4y ago · link · parent

Seems easy enough to play around with, and need not be strictly numbers either, as long as rank is defined on your fields (they are sortable...total ordering? I'm rusty on my terminology). Basically sort X, take the variance of the rank of Y, Z, etc. Much in the same way you would compute multi variable correlation.

comment 4y ago · link · parent

Apollo also cost $280B inflation adjusted, so like 25x. And Apollo was a mad dash, with many risks taken. JWST is slow and steady. Like I'm a space buff and even I was pretty surprised when I learned how cowboy the moon decent in particular was. They had one shot, and had to fly the lander by hand, without any actual experience (they had to rely on a super cool craft which offset the weight to act like 1/6g).

Like... Apollo was utterly bonkers, bordering on full-Kerbal, in so many ways. It cost lives (5 training flight accidents, 3 in Apollo 1 fire), almost lost another 3 in Apollo 13.

JWST is proving out tons of new science and technology, but at a much more pedestrian peace.

comment 4y ago · link · parent

Comprehensive is not the same thing as accuracy.

I am just remarking that it has a lot of entries that you would not necessarily see elsewhere.

comment 4y ago · link · parent

I don't believe in an Abrahamic creator-God but I think the reading of Genesis on Apollo 8 is extremely moving. I don't interpret it as being particularly religious or Abrahamic. "Let there be light" is, IMHO, a universal notion of our strange existence in the cosmos. Maybe it means creation to some, the big bang to others. It's 3-4000 year old poetry (likely long predating the old testament in oral tradition).

comment 4y ago · link · parent

> NDTM

Non deterministic Turing machine?

comment 4y ago · link · parent

I like how comprehensive this is. Some of these are super obscure, including some systems that seem to only be referenced in a scholastic paper.

I don't like how disorganized/mis-characterized this is. As others have pointed out, there is little mention of open source (have to go into the language page for that), and these aren't all programming languages. Seems like it started as such and then scope crept to include...formal languages? What is CSV even?

Don't get me wrong, I think it's awesome that there is some abstraction in which Arezzo notation, matplotlib, CSV, and a bunch of esolangs are in the same category. But saying it could benefit from focus is an understatement.

The website, for being as sparse and web 1.0 as it is, takes a long time to first interactive scroll on mobile.

I think both problems could be solved, or mitigated, by breaking it into separate lists. Programming languages, libraries, markup languages, encoding formats, and "misc".

comment 4y ago · link · parent

Wait...are you suggesting that whole comment is actually just an ad?

comment 4y ago · link · parent

Seems like it's getting more features, slowly but surely.

comment 4y ago · link · parent

Here's our setup, which is the result of several iterations and ergonomics refinements. Note: our stack is 90% python, with TS for frontend. Also 95% devs use mac (there's one data scientist on windows, he uses WSL).

We install enough utilities with `brew` to get pyenv working, use that to build all python versions. Then iirc `brew install pipx`, maybe it's `pip3 install --user pipx`. Anyway, that's the only python library binary installed outside a venv.

Pipx installs isort, black, dvc, and pre-commit.

Every repo has a Makefile. This drives all the common operations. Pyproject.toml (/eslint.json?) set the config for isort and black (or eslint). `make format` runs isort and black on python, eslint on js. `make lint` just verifies.

Pre-commit only runs the lint, it doesn't format. It also runs some scripts to ensure you aren't accidentally committing large files. Pre-commit also runs several DVC actions (the default dvc hooks) on commit, push, and checkout. These run in a venv managed by pre-commit. We just pin the version.

Github actions has a dedicated lint.yaml which runs a python linter action. We use the black version here to define which black pipx installs. We use `act` if we wanna see how an action runs without sending a commit just to trigger jobs.

As an aside, I'm still fiddling with the dvc `pre-commit` post-checkout hooks. They don't always pull the files when they ought to.

Most of the actual unit/integration tests run in containers, but they can run in a venv with the same logic, thanks to makefile. We use a dvc action to sync files in CI.

So yeah there's technically 2 copies of black and dvc, but we just use pinning. In practice, we've only had one issue with discrepancies in behavior locally vs CI, which was local black not catching a rule to avoid ''' for docstrings; using """ fixed it. On the whole, pre-commit saves against a lot of annoying goofs, but CI system is law, so we largely harmonize against that.

IMHO, this is the least egregious "double accounting" we have in local vs staging ci vs production ci (I lost that battle, manager would rather keep staing.yaml and production.yaml, rather than parameterize. Shrug.gif).

Other knowledge nuggets:

- pre-commit manages its own dependencies. This leads to surprising behavior if you aren't expecting it. Eg you need a special line to specify dvc[s3].

- black has yet to release a non-beta semver, which messes with solvers. This is super annoying. They might as well use 0ver if they don't want to commit to stability. Don't expect any kind of stability of formatting between versions. Hope they settle down soon.

- git-lfs is a nightmare. Two projects at $lastco used it. It's more trouble than it's worth. Just use DVC for yucky files. I have no affiliation with dvc, other than a few bug reports.

- makefiles are great and IMHO underrated. But they have their limits. More complex logic should be broken out into scripts.

- python dependency management is still a kafkaesque nightmare. I say this with over a decade of python experience and it's my favorite language despite this.

- Suggestions welcome!

Technologies referenced:

https://dvc.org/

https://github.com/iterative/setup-dvc

https://github.com/marketplace/actions/python-linter

https://github.com/nektos/act

comment 4y ago · link · parent

You can use `act` to run actions locally. Most functionality is supported. Works a treat better than sending it repeatedly just to test how things behave in CI.

https://github.com/nektos/act

comment 4y ago · link · parent

This feels very FUDy. It gives a bunch of examples of ways in which microservices can go wrong, without empirically examining those claims. It also excludes the middle: you can have "milliservices" (really, just service-oriented architecture) which do more than route a single endpoint, but still give flexibility and scaling.

We are a young startup in the ML-service space, with about a dozen engineers + data scientists. Our stack is based on all docker containerized python. We have 6 "micro"-services (not sure at which point they become micro) but each plays their own role, with ~4-30 REST endpoints each. It's been fantastic, and none of us are particularly experienced with microservices. We run on AWS east but you can spin most of the stack up locally with docker-compose. I don't even need k8s, if we wanted, we could probably deploy a local cluster with docker swarm.

- Fault isolation

I can't talk in depth but we were able to handle the recent east-1 outage with only parts of the stack degraded, others stayed functional.

Also, rollout is most likely when something will fail. Rolling back a services is way easier than disrupting the whole stack.

- Eliminating the technology lock

The ML container is a massive beast with all the usual heavy ML dependencies. None of the other containers need any of that.

- Easier understanding

Yep, definitely true in my experience. The API surface area is much smaller than the code under the hood, so it's easier to reason about the data flow in/out.

- Faster deployment

We can easily patch one service and roll it out, rolling out hotfixes to prod with no disruption in the time to run through the CI pipeline, or roll back a task spec, which is near-instant.

- Scalability

Emphatically so. The difference in scale between our least and most used service is over 100x.

We could probably get away with making the user-facing backend a monolith (and in fact it's the most monolithic, has the most endpoints) but for data pipelining, micro/"milliservices" has been a dream. I don't even know how it would work as a monolith.

As with everything in this field, it all depends on use-case and tradeoffs. If your services each handle roughly the same load, the independent scaling argument weakens. If your business logic is complex, tightly coupled, and fits on a single box, you'll waste a ton of cycles just communicating.

comment 4y ago · link · parent

CMaaS sounds amazing for resiliency engineering. There's so much I want to be doing to perturb our stack, but I don't know all the ways stuff can go wrong. Sure I can ddos it, kick services and servers offline, etc, but that's what, a few dozen failure modes? Expertise in chaos would be valuable by itself. Not to mention being able to shake parts of the system I normally can't touch.

Side note: terraform is pretty good for causing various kinds of chaos, deliberately or otherwise.

comment 4y ago · link · parent

> We used flask/gunicorn and I’m considering moving to fastapi.

Do it, do it nao! And by that, I mean at your earliest convenience. It's such a step up from Flask. All the serde is handled for you via Pydantic. No more manually vetting data. Just write constraints.

comment 4y ago · link · parent

Function composition becomes a lot easier with Result/Option, because you can write functions in terms of assuming a "good" value (not nil/err or otherwise "bad") and then map over it. Or if we really wanna be fancy, flatmap/bind over it.

Foo, err requires either that all receiving functions accept (foo, err), or manually nil-checking at every stage.

Try/catch is the least composable, because deeper error types can "jump out" from any layer. Which means you have to keep wrapping catches, until you hit some base layer you can recover from. You get stack traces, but you lose type information along the way.

Sum (result) and product (foo, nil) types preserve type information. Meaning you can operate more generically over it. Meaning less code duplication.

comment 4y ago · link · parent

Right but that just means it's LLVM being clever, not rustc.

The main compiler is the self-hosting gc go compiler. Iirc ~~it's the reference implementation~~ erm I guess it's determined by spec, not reference implemenation. Gc is definitely "the default" though.

Then There's the gofrontend, which is a compiler frontend to other compilers, which can work with gcc and llvm. I am not aware of the state of the art for these, but I wonder if there are performance differences.

comment 4y ago · link · parent

Perfect example of a caveat to "without sacrifice". For context, go really cares about having "zero values" - every initialized variable of some type must have a zero value.

The zero of Error is nil, so logically this would be Result(0, nil). But what do you set the internal state? It's not Ok, cause that int isn't used, and it's not Err either.

Option would work fine though and it would be amazing to map over options instead of nil checks.

I think you'd need to build Result on top of Option, it's naturally kind of ternary - "I have value" "I have error" "idk", either internally or externally.

What might be awesome would be if the Error were a slice type, nil would be "uninitialized" and empty slice means "initialized". still not...pleasant.

comment 4y ago · link · parent

I've wanted a Result type I could map over in Go as soon as I saw the idea. But someone recently pointed out, without pattern matching and early return, it's kind of nerfed. Not sure I totally agree (I think it'd still be awesome to have Result, if only for .map()), but I see their point.

I disagree that it would be without sacrifice. That's kind of the whole point.

Unless I'm missing something, go has iterators with for loops.

comment 4y ago · link · parent

Eh, not really in the data wrangling and machine learning space, at least not quite yet. It's not really amenable to writing libraries for numerical processing - it ends up being super tedious to write something like numpy (you have to implement for every data type, there's at least a dozen+) and nigh-impossible to write an API like pandas, because dataframes are just too dynamic. You could do these things, but it's just super unpleasant.

I'm hoping generics makes it easier to write things like numpy, without doing `meao_u8`, `mean_u16` etc.

+ there's bool, int/uint8,16,32,64, float32/64, complex64/128, that's 13 right there, plus object, a bunch of extended sizes on some architectures, and c-alias types.

comment 4y ago · link · parent

Actually I think while the compiler is a bit naive, the compiler writers are not. They are striving for simplicity, maintainability, speed, etc., vs trying to optimize high-level FP-esque idioms into fast machine code.

The compiler has definitely gotten more optimal over the years, but it's a different beastie than the rust one. Because go is not rust.

comment 4y ago · link · parent

They never resisted generics as a concept. But they refused to implement generics in a way which compromised other Go values. Compilation speed was a big one. It's easier to implement generics if you sacrifice compilation speed (see: c++, rust, and iirc java). To their credit, it took the community a looong time to figure out how pull that off, because it's a hard problem. But I think they've done it.

comment 4y ago · link · parent

String is a pointer/slice type under the hood, even if you don't see the asterisk. So when you are passing v, you are passing a reference to a slice which gets updated by the loop. Since the goroutines can run in parallel, you print whatever v is pointing to at the time.

C++ lambdas do the same thing if you pass a pointer.

Python would do the same thing if you had a mutable non-threadsafe objects passed to threads. Eg if you iterate over a list of dicts, and modify the dicts, you'll get the same effect.

So then the question becomes, why does v get re-used, instead of assigning a new pointer each time? Dunno, probably performance. I could see the latter generating a lot of garbage, which can be totally avoided if you don't pass mutable references to goroutines.

What go really lacks IMHO is some kind of const modifier for these kind of references. Maybe it does, all I remember are const scalars.

comment 4y ago · link · parent

I love python, and I don't blame you. I can't stand the Django way of doing things. Everything is so opinionated, dynamic, and magical in the bad way. Pytest has a similar vibe and it drives me nuts. Not a fan of OOP, either, I much prefer immutable objects that are either pure data, or convenience methods that return a copy. No more setters, state mutation methods, setattr, unless it's deeply abstracted away.

Nowadays I use Fastapi, pydantic, Result, and static typing everywhere. Protocol interfaces are great.

comment 4y ago · link · parent

> Python does

And it's awful. I use EAFP locally (to avoid TOCTOU and the like) at low level interfaces but I don't let it bubble up out of a function scope, because it is a goto in all but name.

I've also been increasingly using the `result` library/data structure. It's incredibly liberating to return an error as an object you can compose into other functions, vs try/catch, which does not compose.

Yes I write python almost like rust, and it's great. Strong types, interfaces, immutable types. It looks nothing like "old school python" but also behaves nothing like it. Gone are the day of "oh it crashed again, fix one line and rerun".

Exceptions should be for exceptional circumstances, not errors.

Edit: I see this is controversial. What do you take objection to? Making your python look less dynamic and more like rust? Try it before you knock it. Python's my favorite language, but I do not agree that many of the common "pythonic" patterns are good at scale.

https://returns.readthedocs.io/en/latest/pages/result.html

comment 4y ago · link · parent

> "Provenance" is tricky. For example, much of the knowledge of the Apple iWork formats were derived by reverse-engineering the source programs and extracting protobuf definitions. Many open source projects have freely copied from each other, making detailed analysis tricky

I wonder if the Google LLC v. Oracle America, Inc. ruling helps this in any way. Defining a specification (either with public docs, RE or empirically) of closed format for the sake of reading the data or long-term archival strikes me as emphatically free-use. But I could also easily seeing it ending up patent-troll bait.

1
404142
85