Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
robalni
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
16 ms
·
151.
▲
by
robalni
4y ago
No player runs code on the developer's server. They just send packets to it, just like my web browser sends packets to web servers. Nobody is trying to put anti-cheat software in my web browser.
152.
▲
by
robalni
4y ago
This is a pattern I see very often and that I think all of us can see all the time. The developers of software try to control how the users use the software. This is not just a regular customer or user relationship between the user and the
153.
▲
by
robalni
4y ago
> when your compiler called foo(int) instead of food(bar *) just because you passed NULL That's what I meant that we don't have to worry about in C since you can't even have two different functions with the same name (assu
154.
▲
by
robalni
4y ago
Where can I read more about what these changes mean? If we assume that nullptr and auto mean the same as in C++ then what problem does nullptr fix in C? In C++ i can understand the need to use nullptr to distinguish between overloaded funct
155.
▲
by
robalni
4y ago
> Personally, I'm all for open source, but to me this seems inevitable when you expect people to solve your requests and issues with (quite possibly) no compensation. Let's remember that half the point of open source/free
156.
▲
by
robalni
4y ago
Interestingly I get more cache misses with the gray code solution but still fewer switches between cache lines. This has to be because the cache line prefetcher can predict the memory usage in the simple version but it's harder to pred
157.
▲
by
robalni
4y ago
Here is the implementation of get_gray_xy that I used: static uint64_t deinterleave(uint64_t x) { x = x & 0x5555555555555555; x = (x | (x >> 1)) & 0x3333333333333333; x = (x | (x >> 2)) &a
158.
▲
by
robalni
4y ago
I was experimenting a while ago with something that I think is related to this. If you have a quadratic algorithm where you need to compare each pair of objects in a large array of objects, you might use a loop in a loop like this: fo
159.
▲
by
robalni
4y ago
Here is an implementation of a binary HAMT that allows you to add and find nodes: https://gist.github.com/robalni/311afd0756f25c4f234b2ae332cd...
160.
▲
by
robalni
4y ago
What I like about HAMTs is that they can be super simple to implement if you make them one bit per level. They are like a combination of a binary search tree and hash table but without any of their annoyances. * In binary search trees, you
161.
▲
by
robalni
4y ago
The weirdest thing just happened. I was on https://beej.us/guide/ and I removed the last part of the URL to make it only https://beej.us and I pressed enter. This took me to cnet.com. I have never been on c
162.
▲
Ask HN: How have you optimized software?
2 points
by
robalni
4y ago
|
2 comments
163.
▲
by
robalni
4y ago
Summary: A common way to store a binary heap is so that the children of n are located at {2n, 2n+1}. This has the effect that parent and child are usually located in different memory pages if the tree is big. Traversing the tree is faster i
164.
▲
Ask HN: What helped you get good at programming?
76 points
by
robalni
4y ago
|
82 comments
165.
▲
by
robalni
4y ago
One issue: It updates every 0.9 seconds so it looks like it counts too fast and then it stops at a second for too long. As a solution you could either do as righttoolforjob said and read the time more often so that the inaccuracy is unnotic
166.
▲
by
robalni
4y ago
Speaking of the while head, after posting this I realized that there is an optimization you can do by moving the bitshift into the while head, like this: while (x >>= 1) This makes gcc compile the code to one instruction less per iter
167.
▲
Counting set bits in an interesting way
(robalni.org)
63 points
by
robalni
4y ago
|
33 comments
168.
▲
by
robalni
4y ago
Here is some more information, including a map with the camera positions: https://kontakt.svt.se/guide/den-stora-algvandringen
169.
▲
by
robalni
5y ago
> I don't have a problem with websites measuring what I view, click, add to cart or buy. I want them to be able to see what doesn't work in terms of user experience. The problem is not that they measure things. The problem is t
170.
▲
by
robalni
5y ago
I made a macro because it was more complicated than just S.Y. It was more like `Something.get_stuff().unwrap().things`
171.
▲
by
robalni
5y ago
> The complexity of Rust's ownership model is not added to an otherwise simple program, it is merely the compiler being extremely pedantic about your code obeying rules it had to obey anyway. Not exactly. I remember when I learned R
172.
▲
by
robalni
5y ago
> The question here shouldn’t be why not to use a subset of HTTP and HTML, but rather, why not build on top of HTTP with a different markup layer other than HTML. We have APIs using HTTP with JSON instead of HTML, for example. As you can
173.
▲
by
robalni
5y ago
To add some more explanation; there are layers of safety. The arrays in Rust or any other language are a layer on top of the memory pages that you get from the operating system. Just like that, you actually have bounds checks in C because t
174.
▲
by
robalni
5y ago
I totally agree; it's useful to have a language feature that enforces some rules that the programmer knows about. It's just useless to call it "safe". My point is just about the words people use when talking about these
175.
▲
by
robalni
5y ago
That wiki article seems to define memory-safe code as not containing an arbitrary list of bugs. This doesn't really make sense because even if you have code that doesn't contain those bugs, and even if you have a compiler that hel
176.
▲
by
robalni
5y ago
If we say that "safe" code is "memory-safe" code, now the question is: what is memory-safe code? If memory-safe code is code that doesn't access the memory in unintended ways, then who knows what is unintended? Only
177.
▲
by
robalni
5y ago
I don't know what people mean when they talk about "safe" or "unsafe" code. Doing something like `int a[5]; a[2] = 100;` in C is perfectly safe because there is no bug in that code. The only thing that might be unsa
178.
▲
by
robalni
5y ago
I was assuming that the "fair" part was about the gender of people because that seems to be what most of the article is about. The rest of the reasons for doing this make sense so my question was mostly, what does this have to do
179.
▲
by
robalni
5y ago
> So the order was reversed. Municipalities faced no additional cost for clearing pedestrian paths first. And it reduced injuries, in addition to being objectively fairer. How can it be fairer? If you clear surface A before surface B, th
180.
▲
by
robalni
5y ago
The link doesn't work. I think this is the one it's supposed to be: https://github.com/michelpereira/awesome-games
More ›