Remix.run Logo
LightMachine 5 hours ago

Note that using linked lists for strings is actually more "parallel friendly" because you can take the head/tail and spread it around 16k GPU cores in O(1), unlike in Haskell, unlike arrays, which require a linear copy, becoming quadratic. So, the right "default type" isn't that clear on Bend, because GPUs behave very differently from CPUs.

That said, yes, we definitely should have a compact Text type. I'll add it over the weekend.

bunderbunder 2 hours ago | parent [-]

Though also, parallel processing strings and other non-numeric data on that level of granularity is, IME, typically less performant. The parallelism rarely manages to offset the performance penalties incurred by decomposing the problem in a parallel-friendly way. Even on a single machine you’ve got to think about whether organizing the data in a parallel-friendly way also makes it less cache-friendly. For example, a linked list of Unicode code points is 12 bytes per character, and each character might be on a completely different cache line. Depending on language a UTF8 buffer might be 1/10 the size and have a much more compact layout in memory.

ModernMech an hour ago | parent [-]

Related:

https://www.usenix.org/system/files/conference/hotos15/hotos...

  We survey measurements of data-parallel systems recently reported in SOSP and OSDI, and find that many systems have either a surprisingly large COST, often hundreds of cores, or simply underperform one thread for all of their reported configurations.
bunderbunder 41 minutes ago | parent [-]

Yes, love that paper.

Anecdotally I have a bit of a track record of 10xing slow systems’ throughout by converting them from distributed to single-node or from multithreaded to single threaded.

Heck I once even sped up a number crunching operation by getting it off of the GPU and onto the vector coprocessor. Because GPUs also have a bunch of extra overhead to have to amortize away.