HNHacker News
TopNewBestAskShowJobs

abhi9u

1,070 karma · joined July 12, 2019

I am a software engineer (unemployed at the moment). I am building https://drpawd.com and trying to build a writing career at https://codeconfessions.substack.com/
submissionscomments
abhi9u··on [dead]
Author here: i encourage you to check the 60+ other articles there before coming to this conclusion.

Maybe everyone should start writing half sentences mixed with ... to not sound like an AI!

abhi9u··on I ditched the algorithm for RSS
RSS seems to be making a come back. Just a couple of days back saw this post going viral on X about RSS https://x.com/0xglitchbyte/status/1878495012800897229
abhi9u··on 1BRC Coding Challenge: Nerd Sniping the Java Community
I think most of the optimizations were pretty low level and had nothing to do with Java itself. You could implement the same techniques in any other (compiled) language and get similar performance results. Things like cache locality, ILP, work stealing, multithreading, SWAR etc. In fact, the top solutions mostly used unsafe to use off-heap memory to avoid GC and copying of data.
abhi9u··on Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code
Yes, the default function argument values is another surprising behavior.

In this case, the default arguments get compiled as part of the function code and are part of the function's environment. As a result every time that function is called it is always having the same environment, i.e. the default argument values are not reinterpreted on every invocation. So the mutations to the environment are visible across function calls.

abhi9u··on Why Do Python Lists Multiply Oddly? Exploring the CPython Source Code
Thank you (author here).

I have not looked into list comprehensions. I think that and how generators work internally might be interesting to write about. I will try to cover them.

abhi9u··on Ask HN: Share your favorite software blog posts of 2023
Thanks for sharing Bosky.

I think you gave the wrong URL :)

This one talks about how CPython executes a + b: https://codeconfessions.substack.com/p/cpython-dynamic-dispa...

abhi9u··on Ask HN: Share your favorite software blog posts of 2023
Sorry about that. Most of my posts are open, but I usually put one of these behind the paywall in a month. I opened this one.
abhi9u··on Ask HN: Learn Graphics Programming, Recommendations?
Ray Tracing in One Weekend: https://raytracing.github.io/
abhi9u··on CPython Internals: What Happens Behind the Scenes When You Do a and B?
Not sure why, but the title is slightly incorrect.

Actual title is "CPython Internals: What Happens Behind the Scenes When You do a + b?"

abhi9u··on Show HN: YouTube banned adblockers so I built an extension to skip their ads
Not really, you have an option to exclude your content from being indexed by Google (robots.txt).

I don't care as much about Google losing money because of ad-blockers, they have plenty of money going around. The real people losing here are the ones who are creating the content. As it is they need to amass a large number of views to earn few dollars from a video. Depending on the type of content, a lot of time, money and effort goes into creating each of those videos.

abhi9u··on Generating Random Factored Numbers, Easily (2002) [pdf]
It is supposedly an inside joke and not an actual test.

Source: https://twitter.com/michael_nielsen/status/17249896200296205...

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Thank you (author here).

I don't read TAOCP. I have read first few chapters of volume-1 so I am familiar with the notation and some MIX syntax.

But while writing this article, I just opened up specific topics, such as computing Fibonacci numbers in volume-1, or evaluating powers in volume-2 and I managed to understand it. Sometimes you may find back references, such as when discussing Fibonacci numbers, he references Euclid's algorithm and you may have to go back and check it out, or ignore it (depends on the context). So I believe you don't necessarily need to read from cover to the end; you can browse it based on your interest.

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
My bad. I should have looked into the docs. Thanks for pointing out!
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Thank you. I will do it.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Nice! Thank you for sharing.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Yes, that book (thirty three miniatures) has great content, but a hard read. Basically someone like me needs to go back, read other sources, and spend time on paper to get it.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Very cool. Thanks for sharing.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Knuth shows that technique in TAOCP, vol-1. It was on the longer side and I didn't want to reproduce it in the interest of space and time. I was more focused on the matrix form.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
That's a work of art. Amazing
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Python has arbitrary precision integers, so you could do it without running into overflows. Although if implementing floating point based technique, you may want to use np.float128 to handle values upto 10^4932.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Thank you so much, both for providing more background on exponentiation, and for the reference. :-)
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Yes, indeed. If you see the thirty three miniatures book, it gives the matrix exponentiation formula for computing Fibonacci numbers, without any explanation behind it. To write the article, I tried to figure out ways it can be explained. And this pattern you suggested shows up nicely even when you express successive Fibonacci numbers in terms of the base cases F0 and F1. Which ultimately lead me to realize, the coefficients are the elements of the matrix.
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Author here:

At the time of writing, I was not aware that the matrix form and the closed form are same, because you can derive the golden ratio based formula from the matrix formula. Full disclaimer: I am not a math major, and I can make such mistakes :)

Although, I am curious to learn about exponentiation of real numbers. While writing this article, I was investigating how different libraries/languages implement exponentiation. While for matrix exponentiation, numpy used the algorithm I showed in the article. I also looked at the pow() function in libm of FreeBSD and it used the form you provided. I've been trying to look at an explanation behind this. Please share a pointer if you have any references.

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
I just read the exercise. That's very clever.

Makes me want to sit and go through the book.

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
But that seems to be computationally same amount of work as the matrix form, so we get similar performance?
abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Interesting, TIL.

Thanks for sharing. :)

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
That's quite true. And so many books to teach it.

I am a software engineer and don't have a major in math beyond studying discrete math in college. So I really have to work hard to understand these proofs. And I certainly value proofs explained in simple terms. :)

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
(Author of the article here) Thanks for writing this up, it's much much more intuitive than what I've read everywhere else. I primarily looked up Knuth (TAOCP Vol 1) for this part, and he showed a longish proof using generating functions which looked too long to show in the article, and I would not have done a better job than him.

The thirty three miniatures book showed a more abstract proof, which would have been accessible to people deeply familiar with the concept of basis vectors.

abhi9u··on A linear algebra trick for computing Fibonacci numbers fast
Yes, that's a good point.
abhi9u··on What every developer should know about GPU computing
Sorry, I was not aware of this rule. Although it was submitted by someone I don't know.

But I won't do it again now that I know.

Page 1 of 3Next →