152 karma · joined November 8, 2023
I like algorithms and abstraction
That's just the usual behavior of any market. When prices go down, demand goes up.
Jevon's paradox specifically says when prices go down by a factor of x, demand goes up by a factor greater than x, leading to total consumption (measured in money spent) goes up.
In the context of this post we can paraphrase (replacing money with programmers) like so:
Once AI makes it so developing any piece of software takes half as many programmers, the amount of software developed will go up by more than two times, leading to a net increase in the number of programmers required.
Something that always bugged me about palette generators I've used is how they end up not picking any colors intense enough for the deepest highlights/shadows, because they use colors close to the average of various sets of pixels.
The result is that the most eye-catching parts of an image end up washed out, reducing the appeal.
My hack to address this has always been making a larger image with big white/black bars around the original image to push the palette generator to include a few really bright or dark colors.
From the look of your examples, your project addresses this too, right?
Btw, I opened an issue about the graphs in your readme because, as a programmer, they don't tell me if your program is fast or not. From a user's perspective that thinks in terms of the side length of an image, the numbers presented are very useful, but they might be even more useful in table format.
I can try to find it if you want
Still sucky but at leas you can read the code
Edit: or make a non-stacked version?
My phone is not great but drawing some circles and some text should not take 100ms. On any device.
def perform_union_dnc(paths):
if len(paths) == 0:
return None
if len(paths) == 1:
return paths[0]
middle = len(paths) // 2
left = perform_union_dnc(paths[:middle])
right = perform_union_dnc(paths[middle:])
return perform_union_naive([left, right])
It's not exactly the same algorithm (top-down merging instead of bottom-up) but the performance should be very close.Also, it can be optimized to avoid temporary lists if that turns out to be a win.
5.6 * 10^15 kilograms
Say we have an array p[1], p[2], ..., p[n] with all possible rubiks cube configurations
Then this function will solve the cube:
move(1) = p[1]^(-1)
move(i) = p[i]^(-1) * p[i-1]
In laymans terms, the resulting algorithm is: assume the initial configuration is p[1], then solve it. If it wasn't, undo those moves then solve as if the initial position was p[2], etc...So, yeah. Those fixed solving sequences / hamiltonian paths are actually very common. We can make one for any permutation of the group elements.
So I posed a more interesting question: what is the simplest sequence of moves that has this property?
i = 0
while not solved
apply move(i)
Interestingly, there is no constant function `move(i) = x` that makes this algorithm correct.If there was, there would be a single element x of the rubik's cube group that generates the entire group (every element could be written as x^n)
This would imply that the group is commutative (x^n * x^m = x^(n+m) = x^(m+n) = x^m * x^n), which every cuber knows is false from experience (permuting moves does not lead to the same final configuration)
An interesting question would then be: whats the simplest piecewise-constant function that makes this algorithm work?
I.e. is it possible to use move x1 for the first n1 steps, then x2 for the second n2, then x3 for the next n3, ..., then xk for the next nk? And if so, what is the smallest k that makes it so?
node n = {
.data = NULL,
.prev = &n,
.next = &n,
};By the way r=6 is also a solution, if we treat the diagram a bit more abstractly.
This by itself should already tell you what NOT to optimize.
But really, you should be looking for operations that take a long time but shouldn't (wide blocks that should be thin). To find it you need to have an intuitive idea of how fast things should be beforehand.
If you have no idea how fast things should be, no amount of graphs will help you with this.
It's framed in the context of programming-language tokenization, but the principles are the same.
But yes, a bigger file does take longer to process.
Memory allocation? You mean making a heap allocator? In the spirit of lowering the bar for creating new languages, I lean more towards calling into libc's malloc instead of building a custom solution haha
Control flow and pointers are coming in the next part, and it's still surprisingly easy
Also I don't have time to learn x86 instruction encoding right now :(
That's fair, but in the article I also store local variables relative to %rsp, so I wouldn't want it changing at all
I could use %rbp for that instead, but then I'd have to explain it in the article :^)
I've been lurking for a while but only now made an account :^)