Better HN
topnewbestaskshowjobs
Log inSign up

chrfrasco

317 karma · joined Jul 21, 2017 (9y ago) · 32 submissions

frontend infra @ canva

github.com/christianscott

christianfscott.com

Submissions

comment 10mo ago · link · parent

It was Jeff Dean and Noam Shazeer: https://www.dwarkesh.com/p/jeff-dean-and-noam-shazeer

comment 3y ago · link · parent

I believe Nat is referring to a full stop rather than menstruation in the sentence about crying into tiktok.

comment 3y ago · link · parent

> This is how a new product gets across the chasm. Find a pragmatist in pain. Do whatever-it-takes to make them happy with your product. Then go back and do it again.

Good advice, I think the useful idea is: An excellent product in competition with a very good incumbent is a bad idea. A mediocre product in competition with an absent or terrible incumbent is a great idea

comment 5y ago · link · parent

mind expanding on this? you've piqued my interest but I can't quite see the connection

comment 5y ago · link · parent

The limiting factor is managed isolation. You can return if there are flights from where you are currently, but you need to secure a spot in managed isolation first (2 weeks in a hotel). https://www.miq.govt.nz/travel-to-new-zealand/secure-your-pl...

comment 5y ago · link · parent

> I wonder if we could reduce binary size with a dead-simple scheduler and GC

For many CLIs I think even a brain-dead bump allocator would work

comment 5y ago · link · parent

This is so cool. I especially loved the Makefile, it's nice to see "bootstrapping" laid out so plainly. I remember finding the concept quite hard to wrap my head around when I was introduced to it. Seeing this would have made it a lot easier to understand!

comment 6y ago · link · parent

I hope you didn't take too many of these comments to heart. You unfortunately got the standard HN comment section treatment – a delightful mix of nitpicking, assuming bad intent, and completely missing the point. I also hope you continue to share things on the internet – it's far easier to criticise than it is to create.

comment 6y ago · link · parent

Sum types and exhaustiveness checking are doable with typescript! Though it's not especially ergonomic

https://www.typescriptlang.org/play?#code/C4TwDgpgBAygrgWygX...

comment 6y ago · link · parent

One more suggestion for you – dropbox paper (https://paper.dropbox.com/) has latex support + syntax highlighting. It's quite simple but it works well as a google docs replacement. As others have mentioned Notion is also fantastic.

11.

What Color Is Your Function? (2015)(journal.stuffwithstuff.com ↗)

106 points · by chrfrasco · 6y ago · 85 comments

12.

What’s the difference between a Rust char and a Go rune?(christianfscott.com ↗)

1 points · by chrfrasco · 6y ago · discuss

comment 6y ago · link · parent

Yeah, I can definitely see how that would be a more performant approach.

I suppose I wasn't so interested in figuring out how to make this algorithm as fast as possible as much I was interested in diving into why this particular implementation was slower.

I'm not totally convinced that this difference is down to the string being parsed over and over, though

> doing the UTF-8 decoding up-front is exacerbating the performance difference in the allocator

This seems to suggest that allocation might be dominating here. WDYT? Either way, I've added a disclaimer to the post.

comment 6y ago · link · parent

Hey all, as some keen-eyed commenters have pointed out, it looks like the rust program is not actually equivalent to the go program. The go program parses the string once, while the rust program parses it repeatedly inside every loop. It's quite late in Sydney as I write this so I'm not up for a fix right now, but this post is probably Fake News. The perf gains from jemalloc are real, but it's probably not the allocators fault. I've updated the post with this message as well.

The one-two combo of 1) better performance on linux & 2) jemalloc seeming to fix the issue lured me into believing that the allocator was to blame. I’m not sure what the lesson here is – perhaps more proof of Cunningham’s law? https://en.wikipedia.org/wiki/Ward_Cunningham#Cunningham's_L...

comment 6y ago · link · parent

> The second problem is that at least the Rust code is decoding UTF-8 every iteration of the inner loop instead of decoding once and saving the result, or even better interning the characters and having versions of the inner loop for 32-bit chars and 8-bit and 16-bit interned indexes.

I tried this. Pulling the .chars() call out of the loop & collecting into a Vec made the performance even worse – the following balloons the runtime from ~2.7s to ~5s:

    let target_chars: Vec<char> = target.chars().collect();
    for (i, source_char) in source.chars().enumerate() {
        let mut next_dist = i + 1;

        for (j, target_char) in target_chars.iter().enumerate()  {
> written mindlessly > incompetence of the person

No challenge there :P I am operating under the assumption that I don't need to understand how compilers work to get good performance from rust (where good is "similar enough to an equivalent go program")

comment 6y ago · link · parent

run.js is not doing the benchmarking. If you look at the source for each of the programs being benchmarked, you'll see that the programs themselves are responsible for benchmarking

comment 6y ago · link · parent

Nice catch, thanks for pointing this out. I've updated the cache initialization to use `len(targetChars)` rather than `len(target)`:

    cache := make([]int, len(targetChars)+1)
    for i := 0; i < len(targetChars)+1; i++ {
        cache[i] = i
    }
AFAIK this makes them equivalent (fingers crossed). It seems to not have made much of a difference (-0.03s)

18.

Making Rust as Fast as Go(christianfscott.com ↗)

304 points · by chrfrasco · 6y ago · 200 comments

19.

Is Mobx Magic?(christianfscott.com ↗)

1 points · by chrfrasco · 6y ago · discuss

20.

Show HN: A utility for printing paths from stdin as a tree(github.com ↗)

3 points · by chrfrasco · 6y ago · discuss

comment 6y ago · link · parent

Looks like we need prefers-prefers-color-scheme

22.

Writing Python with (almost) no statements using the walrus operator(github.com ↗)

1 points · by chrfrasco · 6y ago · discuss

comment 7y ago · link · parent

Man, I wish I could use the eye-roll emoji here

comment 8y ago · link · parent

> This to my mind verges on civil rights infringements

You're funny!

comment 8y ago · link · parent

make sure they're rose-tinted too

comment 8y ago · link · parent

  fizzbuzz = lambda n: [print((“fizz” * m % 3 == 0) + (“buzz” * m % 5 == 0) or m) for m in range(n)]
Not sure if this is great or terrible

comment 8y ago · link · parent

Python doesn’t do any implicit coercion (apart from ints and floats etc), right?

comment 8y ago · link · parent

I use the personal blocklist extension (https://chrome.google.com/webstore/detail/personal-blocklist...) just to block w3schools.

29.

GitHub Game of Life – Play Conway's Game of Life with Your Contributions Graph(github.com ↗)

2 points · by chrfrasco · 8y ago · discuss

12