Better HN
topnewbestaskshowjobs
Log inSign up

staticassertion

13,486 karma · joined Jun 1, 2016 (10y ago) · 4,896 submissions

@insanitybit
Submissions

comment 4y ago · link · parent

OK when you say "bike" I don't think "electric bike". If you're saying "electric scooters are not better than electric bikes" I don't really disagree.

comment 4y ago · link · parent

> but I don't see any added value that bikes don't provide already.

Really? There's a motor. So it can go faster, accelerate more quickly, and you can go longer distances.

> Penetration would need to be way higher for the business to actually scale.

Why? If you have those 3 cities you're already dealing with 10s of millions of potential customers.

comment 4y ago · link · parent

I've only lived in 3 cities long-term. SF, Boston, NYC. Scooters seem viable for all 3, and all 3 have successful bike rental options already.

comment 4y ago · link · parent

Isn't the main issue that cities banned them and people adopted an anti-tech mentality towards them? I think everything I saw was:

a) People think Uber is a disgusting company and scooters were associated with that

b) Some people were leaving scooters in bad places and it seemed like companies didn't have a solution to this, which blew (a) up when particularly bad incidents (eg scooter left on muni tracks) would occur

comment 4y ago · link · parent

I don't buy that. I know lots of people who have switched to Lyft bikes and, for some time, had switched to scooters. The alternative was Uber, which is far worse since - you get idling drivers, the trip encompasses both the distance to pick you up and to drop you off, and it's a car.

Electric replacements that are cheap and take care of those commutes would seem to be obviously much better. I don't know about any C level exec saying whatever they said, but I'd need a lot more actual information to believe that.

Further, I can't drive, I will never be able to drive, because my vision is shit. I can bike, I enjoy biking, but I can go way faster on a Lyft bike and a way longer distance, it's just radically more convenient - if I need to get across the city to see a friend it's basically the lyft bike or a car.

comment 4y ago · link · parent

Of course, that's why they're building it. They're solving a very specific, niche, hard problem. It would make no sense for other languages, which want to solve more general problems, to tackle C++ interop over C.

comment 4y ago · link · parent

Yeah, router compromise was way worse a decade ago when no one used HTTPS. These days it's obviously not great but you're not really in danger so much as you can be inconvenienced.

That said, it would be nice if router security wasn't absolute shit and those devs actually gave two shits about it, but I could say that about so many things.

comment 4y ago · link · parent

> The other safe languages have explicitly taken the view the interop with C++ is bad

I think it's more that interop with C++ is hard and ultimately a lot less valuable than interop with C, which is what the vast majority of languages use for FFI.

> It doesn’t matter how “safe” your language is if the first thing you have to do is make a pure C (even losing potential for automatic lifetime management the C++ would allow) interface.

I don't see how that leads to "it doesn't matter"

comment 4y ago · link · parent

This is just a more detailed version of my point lol you just listed the reasons they are not free.

comment 4y ago · link · parent

I think ultimately you're just demonstrating the larger point. There is no value trying to label it as imperative or declarative except in the niche situation where one is debating whether it is imperative or declarative, which at some point is just a philosophical question.

I think it was Plato who asked this question - if I take two pieces of clay and smash them together, which piece grew? You can argue all day about it, and it has some fun implications about identity, but that's philosophy.

comment 4y ago · link · parent

More nitpicking: Your computer might turn off, cosmic rays might blow fuck up your RAM/CPU, Capital G God could reach down and pause the system, there's a universal quantum pause every 5.391247 × 10^-44 so that the universe can reboot, etc etc etc

Orrrrr, GC pause just means pauses caused by the GC as part of its implementation's work to manage memory.

comment 4y ago · link · parent

> whatever the reference counting algorithm is doing can be emulated by the hand-optimised C++ code so that's just literally impossible.

shared_ptr and unique_ptr have pretty significant overhead and are common practice, even for optimized codebases, so I wouldn't say it's impossible at all.

comment 4y ago · link · parent

This is cool, thank you. Note that my comments are those of a layman, I don't consider myself an expert on these topics, but this gave me some thoughts. Happy to learn more, would love links to blogs/ papers where I can read more.

I would not be surprised to find that even a naive mark and sweep collector is faster than naive refcounting on some workloads. One obvious thing to consider is that the work is delayed, you can perform the sweeping 'as needed'. Even the marking doesn't have to run on any deterministic schedule.

The thing is that, from my naive perspective, run of the mill tracing collector algorithms are just way more advanced than your typical refcount. Most refcounting is just that - either an integer, atomic integer, or both, that gets incremented and decremented based on a number of operations applied to the underlying type. The naive approach has no delays.

Tracing GCs on the other hand, although perhaps not naive ones (could you link me info on the quickfit algorithm? I can not find anything online), might contain epochs that bump allocate in the majority of cases. That'll be particularly nice for benchmarks where allocations are likely very short lived and may actually never need to get to the mark/sweep phase. Your algorithm isn't really documented and I just really don't feel like looking at C right now.

Although naive refcounting is very common it's not the only game in town. Depending on the language you can group refcounts together - for example, imagine you have:

(assuming all fields are automatically refcounted) struct Foo { bar: Bar, baz: Baz, }

In theory, a "copy" of this type would involve 3 increments, possibly atomic increments. Each increment would also require a heap pointer dereference, and there would be no locality of those integers behind the pointers. That would be the trivial implementation.

But depending on the language you could actually flatten all of those down to 1 RC. This is language dependent, and it requires understanding how these values can be moved, referenced, etc, at compile time. You could also store all reference counts in tables associated with structures, such that you have locality when you want to read/write to multiple counters. The pointer dereference is going to be brutal so having locality there will be a nice win. I'd be curious to run your benchmarks through valgrind to see how much the refcount is just spending time on memory fetches that get invalidated in the cache immediately.

Anyway, an example of a pretty slick refcounting GC is what Pony built: https://tutorial.ponylang.io/appendices/garbage-collection.h... https://www.ponylang.io/media/papers/OGC.pdf

Pony has different types for: 1. Local, Immutable 2. Local, Mutable 3. Shared, Immutable 4. Shared, Mutable

You can read the paper where they discuss how they track local variables vs shared variables, the implementation of counter tables, etc.

So I guess to summarize:

1. The results make sense, or as much sense as anything. I'd be interested in more details on the algorithms involved and your benchmark methodology.

2. "Naive" tracing GCs are actually pretty advanced, and advanced refcount implementations are pretty scarce.

comment 4y ago · link · parent

I think it's just a weakness of the terms. Kind of like "interpreted vs compiled" at this point very little is strictly interpreted, almost everything goes through a bytecode compilation step.

In this case, you're using imperative languages to generate declarative policies. Things just aren't black and white.

Importantly, it doesn't really matter. We say "Python is interpreted" because the it gives you the UX of an interpreted language. We say "Pulumi is imperative" because it gives you the UX of an imperative language. Under the hood they do their own thing, but unless you're trying to have a really precise conversation it's usually easiest to stick to those terms.

comment 4y ago · link · parent

The GSuite + Chromebook integration is really nice.

comment 4y ago · link · parent

I'm not so convinced. Maybe in the EU, but that would be it, certainly I think in the US you'd be fucked for sure. It might be cheaper in the short term to pay out vs the worst case scenario of fighting this, but they may never even get sued, the case may get thrown out if they do, it may be in their interest to protect that precedent on TOS and fight it in court, etc.

I'm not saying Google won't pay out, but I just think there's a lot of reasons why they might not.

comment 4y ago · link · parent

> That says more about FIPS than it does this work

It would be nice to have companies collectively reject FIPS. I realize that that's a pipe dream, but we do it with patents. Lots of companies pool their patents to defend against trolls on the condition that none of those companies sue each other over patent violations.

If a bunch of companies were like "We won't require you to be FIPS, and we won't get FIPS" or something that'd be cool. Unfortunately, that can't happen with FIPS specifically as it's government mandated, but idk, maybe SOC2 or something?

I hate things so much

comment 4y ago · link · parent

Well, the smaller the number of purchases the less impactful the negative marketing effects. The larger the purchases, the higher the financial impact on Google.

Further, Google exited this market. Do they really care about marketing to these people anymore? Their main revenue is non-consensual tracking, it's not like being mad at Google is going to matter unless you really go out of your way because of it.

comment 4y ago · link · parent

lol yes, the uh "traditional" approach is just... discover market, deliver product, profit. This "new" strategy of "deliver product, lose money, shut product down" seems like it may not work well long term.

comment 4y ago · link · parent

> In this weird market you only own the game if you pirate it.

That's a really good way of putting it, I'm gonna steal that (irony unintended). It's totally true - when you purchase software or services it's conditional. You have some voucher that can be redeemed at the discretion of the provider, and there are always many ways (EULA violation, company goes away) that the voucher can be negated.

But when you steal something you aren't beholden to anyone. You actually "own" that piece of software in a way more concrete way. Yes, someone could pursue legal charges and force you to remove it, but it's a totally separate system vs the built-in contract between customer/ service.

comment 4y ago · link · parent

I doubt they'll credit anyone. Why would they? You purchased a license to play a game through their service. Their service is no longer there. I haven't gone through any terms of service for Stadia but I can't imagine that they aren't covered for this.

comment 4y ago · link · parent

Yeah, I'm always very skeptical of new Google services. I use GSuite and Chromebooks, but I know those are heavily used internally at Google and I believe that they'll continue to invest in those. But every other service, nah.

Between their inability to provide support while a service is up and their consistent lack of long term vision/ investment for the services they create, it's just not worth it.

I can't imagine I'm the only one making significant financial decisions based on this sort of thought process.

comment 4y ago · link · parent

Yeah I saw that was cited and I love it. It's insane but super cool and I could imagine the approach being used for something similar to https://crates.io/crates/sqlx although there's probably better ways to do it lol

comment 4y ago · link · parent

That content has extreme temporal properties. An image that's uploaded is increasingly less likely to be accessed over time. You can probably store it on very cheap hardware with pretty serious compression.

Not to mention that it's mostly text and images that get uploaded to these sites. Videos are the worst case. Let's say there are 1 billion facebook accounts, each one uploads 1GB of data (seems huge), and let's assume that compression just cancels out replication.

That's 1,000 petabytes. On S3 that's in the low 6 figures per year, obviously ignoring the exfil/access costs.

That's not that much. Obviously you want to keep some of it "hot" - profile pictures, recently uploaded pictures, etc. Hand waving, assuming 1% of the data needs to stay hot (seems high), that's 10PB of data. Certainly you're in "big data" land but it's not like there aren't databases that'll handle it.

Not to mention FB invests in tech like zstd.

Cold storage is definitely still getting much cheaper. Dropbox SMR drives are pretty crazy: https://dropbox.tech/infrastructure/smr-what-we-learned-in-o...

comment 4y ago · link · parent

I think it's kind of cool. It reminds me a bit of C++ templates, which are "compile time duck typed". The benefit is that you get lose typing constructs that are evaluated strictly and at type check time, which is kinda nutty. It means that you can lean really heavily on the compiler.

Sort of like using Python to generate Typescript, as random example - my Python code doesn't have to typecheck, but its output does, so I can do absurd shit in Python and still feel good about the output.

One example is something like this: https://www.typescriptlang.org/docs/handbook/2/template-lite...

These are types that are built from string templates. Since strings are loose and can be manipulated in crazy ways like appending, we can now manipulate types in the same way. We can write types that are themselves parsers.

So idk if that's good or not, the downside in C++ is that TMP errors are fucking insane, but the upside is that I can have a function that says "pass me something and I'll call "iter" on it and I don't care what that thing is".

It also feelsy kinda more "typey". Types are just values. Types are just strings or numbers or whatever. They're things, with the constraint being that they must exist concretely (or be inferrable) when the type checker runs. No distinction between types and values seems like it's the ideal.

comment 4y ago · link · parent

I'm impressed by how readable the live demo is.

I have to say, the fact that you can do something so... obscene, but in a way that's actually surprisingly readable, speaks highly of Typescript's type system and design.

comment 4y ago · link · parent

Right I'm sure we'll forget.

comment 4y ago · link · parent

Yeah how ever will they live with having to wake up slightly earlier or later for their entire lives.

comment 4y ago · link · parent

Yeah, one hour. Whoops.

comment 4y ago · link · parent

One second every thousand years.
1
333435
164