Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Const-me
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
23 ms
·
301.
▲
by
Const-me
2y ago
Nice post! A small tip, broadcasting from memory is often free. For lookup tables like that I typically define a global variable like that: static const __m128i g_lookup = _mm_setr_epi8( ... ); And then in the function, before the m
302.
▲
by
Const-me
2y ago
> everyone writing their own unsafe vec implementation in C or C++ No one does that in C++, people use std::vector > I'm sure GNU's libstdc++, LLVM's libc++, and whatever Microsoft calls their C++ stdlib have had a laun
303.
▲
by
Const-me
2y ago
> That equivalent would be ndarray It seems ndarray is conceptually similar to C libraries, it doesn’t have expression templates. When you write r = a * b * c with ndarray, you allocate, store and then load a temporary array with a * b.
304.
▲
by
Const-me
2y ago
> par_iter_mut() [1] from Rayon I wonder have they fixed the performance? https://www.reddit.com/r/rust/comments/bto10h/update_a_scali... > usually if you want to do that sort of thing quickly then
305.
▲
by
Const-me
2y ago
> a nice low-level language The usability is not great, too opinionated. For example, they have decided their strings are guaranteed to contain valid UTF-8. Many external components (like Linux kernel) don’t have these guarantees, so the
306.
▲
by
Const-me
2y ago
> Maybe it was because I was often writing multi-threaded shared-memory code in C++ I’ve been writing C/C++ for living for about 25 years, also often writing multi-threaded shared-memory code in C++. However, seems I worked on very
307.
▲
by
Const-me
2y ago
> I wonder why? The whole point of Rust is memory safety and security, but I don’t care too much about either of them. I mostly work on offline desktop apps. When I do work on network exposed servers, I use C# which delivers even better
308.
▲
by
Const-me
2y ago
I mostly use C++ and C#, and I’m not a fan of Rust.
309.
▲
by
Const-me
2y ago
The reason why the single-lookup version works, the bytes being searched for have unique low 4 bits. So the lookup generates the vector with bytes equal to low_nibble_mask[ source[i] & 0x0F ]. The table contains the bytes being searched
310.
▲
by
Const-me
2y ago
> guessing AND/PSHUFB for low nibble, SHIFT/AND/PSHUFB for high nibble, OR to combine Yeah, that’s exactly what I did in my C++ code with intrinsics. About ISA extensions, I’m lucky to work on a professional CAM/CAE s
311.
▲
by
Const-me
2y ago
Exotic is the most interesting one. For example, I recently needed a fast way to flip order of bits in each byte of a long buffer. Did that in 8 AVX2 instructions / 32 bytes (which include load and store), by using 16-bytes long lookup
312.
▲
by
Const-me
2y ago
> Are they not basically identical hardware? For example Apple’s NPU can’t do FP32 precision, it can only do FP16 and less.
313.
▲
by
Const-me
2y ago
> How many register sets does a typical SMT processor have? Er, 2, sometimes 4 Way more of them. Pipelines are deep, and different in-flight instructions need different versions of the same registers. For example, my laptop has AMD Zen3
314.
▲
by
Const-me
2y ago
Great point on C++, but it’s harder for C#. The language and ecosystem are IMO pretty good. I only hate that Microsoft stopped shipping modern .NET runtime with Windows. A few annoying things though, like the recent push towards AOT compila
315.
▲
by
Const-me
2y ago
My favourite languages are C# and C++, and sometimes I interview developers to work with them. Saying these languages are lacking libraries or good tools is unreasonable.
316.
▲
by
Const-me
2y ago
True, and it’s not just games: https://github.com/Const-me/Whisper/issues/42
317.
▲
by
Const-me
2y ago
Another good option is Direct3D 11. It’s IMO even easier to use than OpenGL but still allows to implement pretty good visuals, see GTA 5 or Baldur’s Gate 3.
318.
▲
by
Const-me
2y ago
> which otherwise would not have been possible I wonder is it possible to implement logarithmic depth in the vertex shader, as opposed to pixel shader? After gl_Position is computed, adjust the vector to apply the logarithm, preserving `
319.
▲
by
Const-me
2y ago
Indeed, logarithmic depth is pretty much useless on modern hardware, but it wasn’t always the case. On Windows, the support for DXGI_FORMAT_D32_FLOAT is required on feature level 10.0 and newer, but missing (not even optional) on feature le
320.
▲
by
Const-me
2y ago
> apparently by writing to gl_FragDepth If they do that, this disables early Z rejection performance optimization implemented in most GPUs. For some scenes, the performance cost of that can be huge. When rendering opaque objects in front
321.
▲
by
Const-me
2y ago
A simple ban of internet ads going to fix that. Will remove incentive to create addictive services, because then people attention and screen time will no longer bring profits, quite the opposite they will cause costs for running all these s
322.
▲
by
Const-me
2y ago
> patents on AC-3 expired 7 years ago Does that apply to the newer version of the codec? https://en.wikipedia.org/wiki/Dolby_Digital_Plus
323.
▲
by
Const-me
2y ago
AI in education reminds me of that book https://en.wikipedia.org/wiki/The_Diamond_Age Spoiler alert: seems the author didn’t consider realistic for an AI to do a good job as a general-purpose smart assistant for a chil
324.
▲
by
Const-me
2y ago
> for some reason they tend to die out I think the reason is questionable value. Native GPU programming languages, HLSL and GLSL, have a simple and readable syntax. The complexity is not in the language, it’s in the runtime and surroundi
325.
▲
by
Const-me
2y ago
I don't think they do. These formats are based on EBML, see the RFC link in my previous comment. That VINT encoding is not LEB128, it's better. BTW I once implemented my own parser in C#, see that source file: https://g
326.
▲
by
Const-me
2y ago
When I need them I usually implement the codec used in MKV format: https://www.rfc-editor.org/rfc/rfc8794.html Similar performance characteristics, i.e. just the first byte tells the encoded length, no need to test eve
327.
▲
by
Const-me
2y ago
> there is already the option to protect DRM content I never needed to use that option. Still, based on what I read in the documentation about Windows graphics programming, I believe that option is only applicable to video, and is prohib
328.
▲
by
Const-me
2y ago
OTOH, the original Chromium is so popular that the motivation of finding these bugs is very high. I think zero-day RCE bugs can be sold for tons of money on the black market. However, the motivation to find similar bugs in Thorium is very l
329.
▲
by
Const-me
2y ago
I think Apple is still doing that: https://developer.apple.com/documentation/foundation/nstimei... Couple decades ago Microsoft did that too, VT_DATE in old OLE Automation keeping FP64 value inside. Luckily, their
330.
▲
by
Const-me
2y ago
> you could probably implement training and inference for a single model architecture, from scratch, on a single kind of GPU, with reasonable performance… with a year or so I have implemented inference of Whisper https://githu
More ›