Readit News logoReadit News
exyi commented on Matrix v1.15   matrix.org/blog/2025/06/2... · Posted by u/todsacerdoti
lousken · 2 months ago
custom emojis still didn't make the cut?
exyi · 2 months ago
The protocol must support it somehow already, as some bridges can send custom emojis from other platforms
exyi commented on Magistral — the first reasoning model by Mistral AI   mistral.ai/news/magistral... · Posted by u/meetpateltech
yeahforsureman · 3 months ago
Are you sure?

The ePrivacy Directive requires a (GDPR-level) consent for just placing the cookie, unless it's strictly necessary for the provision of the “service”. The way EU regulators interpret this, even web analytics falls outside the necessity exception and therefore requires consent.

So as long as the user doesn't and/or is not able to automatically signal consent (or non-consent) eg via general browser-level settings, how can you obtain it without trying to get it from the user on a per-site basis somehow? (And no, DNT doesn't help since it's an opt-out, not an opt-in mechanism.)

exyi · 3 months ago
Everyone I know of will try to click "reject all unnecessary cookies", and you don't need the dialog for the necessary ones. You can therefore simply remove the dialog and the tracking, simplifying your code and improving your users' experience. Can tracking the fraction which misclicks even give some useful data?
exyi commented on Kotlin-Lsp: Kotlin Language Server and Plugin for Visual Studio Code   github.com/Kotlin/kotlin-... · Posted by u/todsacerdoti
jeroenhd · 3 months ago
The debugger is proprietary but still works cross-platform. I don't know how Jetbrains does C# debugging in Rider exactly, but that shows that you don't have to use VS (Code) to do C# development if you don't want to.

Thanks to Samsung of all companies, there's an open source C# debugger on GitHub (https://github.com/Samsung/netcoredbg). That seems to be the basis of the open source C# extension's debugging capabilities: https://open-vsx.org/extension/muhammad-sammy/csharp

The VSCodium C# community wants Microsoft to open source their debugger instead of having to maintain an open source version themselves, but that doesn't mean you need to use Microsoft's open source version. If anything, this forceful separation makes it so that there never will be only one implementation (like there is for languages like Rust which have always been open and therefore only have one way of doing things).

exyi · 3 months ago
I know about netcoredbg, but I did not have much success using it. If we count this as the C# debugger, then the tooling quality is not comparable to other mainstream languages like Scala, D or Julia.

JetBrains have their own closed debugger, which doesn't really help.

Since Rust is native code, you can use pretty much any debugger for it, there is definitely not a single implementation. Yes, Rust has a single compiler, but does C# have any other compiler than Microsoft's Roslyn? (I don't think this is a problem, though)

exyi commented on Kotlin-Lsp: Kotlin Language Server and Plugin for Visual Studio Code   github.com/Kotlin/kotlin-... · Posted by u/todsacerdoti
jeroenhd · 3 months ago
Kotlin may have been relatively IDE-locked without a proper LSP being available, but C# is cross-platform in terms of both editors and runtimes (assuming you're not targeting Windows' .NET stack).

At this point I wouldn't consider it any more or less proprietary than any other Microsoft language, like TypeScript for instance.

exyi · 3 months ago
Kotlin did not have open LSP, C# still does not have an open debugger.

The C# VSCode extension works in Microsoft's build of VSCode, not when someone else forks it and builds it themselves.

exyi commented on Is Python Code Sensitive to CPU Caching? (2024)   lukasatkinson.de/2024/pyt... · Posted by u/leonry
bgwalter · 5 months ago
That seems very likely. The benchmark should probably use a range that is guaranteed to be outside of the cached smallint range.
exyi · 5 months ago
Then you are back to what the article discusses. Each integer is in a separate box, those boxes are allocated in one order, sorting the array by value will shuffle it by address and it will be much slower. I tested this as well, see the other comment.
exyi commented on Is Python Code Sensitive to CPU Caching? (2024)   lukasatkinson.de/2024/pyt... · Posted by u/leonry
mardifoufs · 5 months ago
Is there any public documentation on modern branch prediction algorithms? I know branch prediction is very important to modern CPU so SOTA techniques are probably not public... But it's really amazing what it can do especially considering the "limited" cache sizes that branch predictors have .
exyi · 5 months ago
I guess it depends on how deep you want to go, I think the real predictors are based on publicly known algorithms such as TAGE. This seems to be nice overview: https://comparch.net/2013/06/30/why-tage-is-the-best/ (it's 2013, so definitely not SOTA, but advanced enough for my taste :) )
exyi commented on Is Python Code Sensitive to CPU Caching? (2024)   lukasatkinson.de/2024/pyt... · Posted by u/leonry
cma · 5 months ago
How big is the pointed to small integer? With alignment etc. I'm seeing some stuff saying 256 of them would fill an 8KB L1. Plus other stuff for the interpreter might overfill it. Sorted that would be less of an issue.

Larger range one being slower unsorted yes makes sense because of allocation order no longer matching the iteration order.

exyi · 5 months ago
I don't know how large are those boxes, but normal CPU L1 cache has 32 or 48KB which should be plenty for this. Python opcodes for this program are going to be tiny, and the interpreter itself uses the instruction-L1 cache (which is another 32-48KB). I hope the sequential scan of the big array won't flush the L1 cache (there should be 12-way associativity with LRU, so I don't see how it could).

Anyway, there is no need to have 256 integers, just 2 is enough. When I try that, the results are similar: 17.5 ms (unsorted) / 12.5 ms (sorted)

exyi commented on Is Python Code Sensitive to CPU Caching? (2024)   lukasatkinson.de/2024/pyt... · Posted by u/leonry
almostgotcaught · 5 months ago
you do realize that the Python

  if x > 128: 
     r = not r
doesn't necessarily correspond to one branch at the ASM instruction level right? in fact, a priori, it doesn't even correspond to absolutely any branches at the ASM instruction level.

exyi · 5 months ago
It corresponds to a way more than one branch at instruction level. The branch prediction AFAIK does not care based on what are you branching, it just assumes branches will go in similar sequences as they did last time. If the Python 'if' is never taken, the instruction-level predictor will learn that after the comparison operation, there is an 'if' operation and then another array access operation. If the Python 'if' is unpredictable unpredictable, CPU predictor can't be sure which opcode are we processing after 'if', so there will be penalty.
exyi commented on Is Python Code Sensitive to CPU Caching? (2024)   lukasatkinson.de/2024/pyt... · Posted by u/leonry
cma · 5 months ago
Python speed up is probably from small integer caching, a sorted array will have runs of pointers to the same integers adjacent. The compiled language one is probably branch prediction right?
exyi · 5 months ago
I intentionally stayed in the small integer range to avoid benchmarking the cache. 256 distinct values should fit into L1 just fine in both cases.

I'm now thinking that the difference might be even larger if we instead avoid small integers and let the CPU get stuck chasing pointers. The idea is that it gets stuck on a memory access, which forces it to speculate much further, which in turn makes it backtrack a longer path if a branch was mispredicted. I'm obviously no expert on this, feel free to correct me

The results for 1B range instead of 255 are 17.6 ms for unsorted / 68.2 ms for sorted! We are back to what the original article observed and it's a way stronger effect than what branch prediction can offer. So don't sort your arrays, keep them in the order the boxed values were allocated ;)

exyi commented on Is Python Code Sensitive to CPU Caching? (2024)   lukasatkinson.de/2024/pyt... · Posted by u/leonry
PhilipRoman · 5 months ago
IME CPU caches can be observed in almost all languages, regardless of how detached they are from the machine. What I'm really wondering is, if branch prediction can be observed from interpreted code.
exyi · 5 months ago
It is! Although my test case is probably an unrealistically bad scenario:

It's the classic, why is processing sorted array faster than unsorted one

    def f(arr):
        r = True
        for x in arr:
           if x > 128: r = not r
        return r

    arr = [ random.randint(0, 255) for i in range(0, 1000_000) ]
    arr_sorted = list(sorted(arr))

    %timeit f(arr)
    %timeit f(arr_sorted)

Results are (on my machine): 17.5 ms for unsorted, and 13.5 ms for sorted. For comparison, in a compiled language, the difference is 4x

u/exyi

KarmaCake day908August 27, 2015View Original