Better HN
topnewbestaskshowjobs
Log inSign up

TheNumbat

410 karma · joined Jul 25, 2017 (9y ago) · 24 submissions

https://thenumb.at/
Submissions

comment 1mo ago · link · parent

I think those can be modeled without explicitly separating layouts from types (not that doing so is necessarily a bad idea).

For arrays:

  let dyn_array = fn (erased t : type) -> record { len : int @@ dynamic, data : pointer(array(len, t)) }
For "dyn trait":

  let vtable = fn (erased t : type) -> record { print : pointer(t) -> string, ... }

  let dyn_print = record { t : type @@ dynamic erased, vtable : pointer(vtable(t)), data : pointer(t) }
Both use dependent records and the dynamic modality I mentioned above. dyn_print doesn't match C++ since it doesn't inline the data, and giving that a static layout would require parameterizing on the layout of t, so I see your point. However, it might be fine to give dyn_print an "incomplete" layout that can only appear behind a pointer.

comment 1mo ago · link · parent

Yeah, I'm aware, but wanted to avoid the complexity.

comment 1mo ago · link · parent

> And there is no reason to limit oneself this way for performance, because again dynamic + erased has no overhead.

Not entirely, since Syl uses static data to describe types' runtime layout. Allowing dynamic there would require overhead (e.g. a uniform representation).

That said, there's not a good reason to prevent types from ever mentioning dynamic values. I didn't include it in the post as I haven't entirely thought it through, but with OxCaml-style modalities, you should be able to mention runtime data in types under a dynamic modality.

comment 1mo ago · link · parent

> Those language features are not examples of dependent types

They are dependent in the sense that types can depend on (compile-time) values, but indeed they're not conventionally dependent types. I mentioned them because they're popular features that can be implemented with compile-time dependent types.

> But I guess you mean that Syl implement dependent types them with no overhead, like no dictionary passing.

Yes. In 2LTT terms, the meta language is dependently typed, the object language is simply typed, and all types are erased at runtime.

comment 10mo ago · link · parent

https://thenumb.at/

comment 1y ago · link · parent

Indeed, it says that because we don't have a library of NEON intrinsics (like ocaml_simd_sse) yet, but the extension itself works.

comment 1y ago · link · parent

Yeah, this would be great! Currently only 128-bit SSE/NEON is working but AVX is coming very soon. There's also nothing blocking Windows, but it will require some work. (I added the SIMD support in OxCaml)

8.

What the interns have wrought, 2024 edition(blog.janestreet.com ↗)

47 points · by TheNumbat · 2y ago · 12 comments

9.

Show HN: Minimal Rust-inspired C++20 STL Replacement(github.com ↗)

20 points · by TheNumbat · 2y ago · discuss

10.

Oxidizing C++(thenumb.at ↗)

5 points · by TheNumbat · 2y ago · 1 comment

11.

Oxidizing OCaml: Data Race Freedom(blog.janestreet.com ↗)

16 points · by TheNumbat · 3y ago · 3 comments

comment 3y ago · link · parent

See footnote 3.

13.

Functions are vectors(thenumb.at ↗)

432 points · by TheNumbat · 3y ago · 120 comments

14.

Oxidizing OCaml: Rust-Style Ownership(blog.janestreet.com ↗)

33 points · by TheNumbat · 3y ago · discuss

comment 3y ago · link · parent

Yes - upcoming posts will cover the uniqueness and data-race-freedom designs.

16.

Oxidizing OCaml: Locality(blog.janestreet.com ↗)

5 points · by TheNumbat · 3y ago · discuss

comment 3y ago · link · parent

I was actually wondering about that - it appears a (i+i^2)/2 sequence makes insertions (and by extension erases with rehashing) 7-10% faster, which is pretty significant. Lookups and probe lengths are about the same, so I think the conclusions stand.

comment 3y ago · link · parent

Agreed - I do mention in the post that open addressing is impractical when using intrusive linked lists, which are common in low level data structures.

comment 3y ago · link · parent

I just benchmarked absl::flat_hash_map and got results comparable to Robin Hood with a load factor between 75% and 90%, which makes sense. It's also faster for looking up missing keys, so seems like a good option. I didn't benchmark the maximum probe lengths, though, so not sure on that front.

20.

Optimizing Open Addressing(thenumb.at ↗)

224 points · by TheNumbat · 3y ago · 65 comments

21.

Exploring Neural Graphics Primitives(thenumb.at ↗)

105 points · by TheNumbat · 3y ago · 9 comments

22.

Optimizing Open Addressing(thenumb.at ↗)

1 points · by TheNumbat · 3y ago · discuss

23.

Exploring Neural Graphics Primitives(thenumb.at ↗)

2 points · by TheNumbat · 4y ago · discuss

24.

Differentiable programming from scratch(thenumb.at ↗)

196 points · by TheNumbat · 4y ago · 107 comments