HN user

krut-patel

100 karma

I love all things systems/compilers/databases.

Site: https://iamkroot.github.io Github: https://github.com/iamkroot LinkedIn: krutpatel99

Currently at Microsoft Research India.

Posts1
Comments15
View on HN

TigerBeetle writes to disk for long-term storage

But how does it determine when it should write to disk? Does every write to a potentially OOM operation get preceeded by a check? Take the case of a HashAggregate. The DB clearly cannot know at compile time how many unique keys will be present in the hashtable; it needs to resize at runtime. So does that mean all the hashtables are still using some form of Bump/Arena allocators backed by the pre-allocated memory?

Maybe I should just read the source code :)

Thanks for the pointers!

use a GeneralPurposeAllocator and setting "enable_memory_limit" and "requested_memory_limit"

Interesting! I hadn't looked at GeneralPurposeAllocator too closely, but yes these seem like the right way to do things instead of abusing FixedBufferAllocator as I did.

If the purpose is to "only use the stack"...

Not really, I just had to decide on some arbitrary upper bound on the mem usage, and the default stack size (8MiB) seemed like a decent choice. In retrospect, this challenge only took shape because my solution to Day1 used a FixedBufferAllocator backed by a buffer on the stack, and I realized how easy Zig made it to track allocs. I didn't fiddle too much with the general structure of the solution after that, and made it a "challenge" to see how far I could take it.

Another potential challenge is to pre-allocate instead

Ah, that sounds much more difficult. This is also what TigerBeetle is doing [1]. But one thing I didn't understand even from that post, how would one deal with data structures that really depend on the input data, like the hashsets in TFA? Simplest way I can think of is to have an arbitrary upperbound on the allocated memory and then keep checking before every operation on any dynamic structure. That sounds tedious. Is there a better way?

[1] https://tigerbeetle.com/blog/a-database-without-dynamic-memo...

Github Dark is now a site native

Personally, I still prefer the user style over Github's solution. I find the official black theme has too much contrast (it was probably made for amoled), and the bluish-black variant looks ugly to me. The user style has very good greys, and as a bonus, I've fallen in love with the cross-hatch pattern background it provides.

(I work at Microsoft).

Just in case you didn't know, since the SolarWinds debacle from last year, Microsoft has completely blocked authorisation for corpnet and other tools on anything other than enrolled devices. And since they only support managed devices on Windows/MacOS, using Linux for day job is a no go. Last I checked, circa Jan, I couldn't use Teams/Office on a web browser in Linux (of course, this might have changed in the meantime).

the problem I have is that sometimes the devices lose sync with each other if they've been off for any length of time. Opening the KDE Connect settings typically fixes this, but it's not ideal!

A slightly better solution I have found helpful is to pull down Yakuake (or krunner) and run `kdeconnect-cli --refresh`. Beats having to open a QT window, only to be closed off immediately.

They have come up with a workaround for this. Instead of actively monitoring your clipboard in the background, there now exists a "Send Clipboard" button/intent that shares the current clipboard value with the other device(s). Works well enough for me on Android 11.

I'm someone who always tries to use the "right tool for the job", CLion for C/C++ (large projects), VSC for Rust (the inline type hints from Rust Analyzer are to die for), and ST for Python. I tried out the python experience in VSC but have found it to be _inferior_ to the speed of ST when coupled with the Anaconda (not the venv stack) plugin [0]. It supports venvs, build systems (even remote jobs, but I haven't messed around with those), and all the basic things like go to definition (instant! Even works inside libraries) and find usages work quite well. When paired with the SublimeREPL plugin, I get the venv repl inside ST _with_ autocomplete. That is just a step below full blown (slower) Jupyter notebook experience. The Python exception tracebacks in the output panel have their file paths clickable, so I can immediately jump to the source line. This is adequate for me in terms of debugging experience, but ST obviously doesn't bundle a full-fledged debugger like VSC. The quality of autocomplete is pretty much the same as VSC since both Anaconda and the LSP server use Jedi internally for all the core stuff. There are definitely some rough edges, like having to set the python interpreter path for a new project using venvs, instead of the auto-setup we see in VSC. Another thing is the development of Anaconda has mostly gone into maintenance mode, and is much slower with bug fixes than VSC in that regard, but this hasn't affected me by a lot since most of the core functionality is pretty stable. I really recommend giving Anaconda+ST a try for your Python dev needs.

[0] http://damnwidget.github.io/anaconda/

"Open image in a new tab" to the rescue! The extension I use (Dark Reader) didn't force dark mode for images, which means I can see the labels just fine in these cases.

I can envision tools that allow a sign in a store front to change from "Coke" to "Pepsi" automatically.

This was literally the project I worked on this summer, as an application of GANs for "image translation". We basically trained some of the latest GAN models on our dataset of Pepsi and Coke bottles. Thankfully, all the research papers are accompanied by complete tensorflow/pytorch implementations so we only had to do minor modifications to train/test them on our dataset. The results were mixed, it worked pretty well for bottles on white backgrounds, and one network properly learnt the importance of orientation of the logo (horizontally flipped images generated corresponding flipped target logos). The field is pretty nascent, and from the papers I've read, NVIDIA Research seems to be making good progress on this. I believe in two or three years, we can definitely see this tech in production.