Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney) header
Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney) profile picture

JIT happens.

Joined April 2011
Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)Photo by Mykhailo Kulak πŸ‡ΊπŸ‡¦ (@kleshney)
Martin Odersky: "I believe right now Rust is actually overused. Zig I believe is much better"
Martin Odersky (@odersky) is the creator of Scala and I interviewed him to compare different languages designs (Rust vs Zig vs Python vs Scala) and how AI will impact programming languages. In this episode: β€’ Comparing Rust, Zig, Python, and Scala designs β€’ Why its hard to write a compiler β€’ Predictions about how AI will impact software β€’ Why functional programming matters Where to watch: β€’ YouTube - youtu.be/LdN4sPWM-WY β€’ Spotify - open.spotify.com/episode/0EH… β€’ Apple Podcasts - podcasts.apple.com/us/podcas… β€’ Transcript - developing.dev/p/creator-of-… Thank you to the sponsors of this episode for supporting my work: β€’ WorkOS: makes your app Enterprise Ready with easy to use APIs to add SSO, SCIM, RBAC, and more in just a few lines of code, check them out at workos.com/ β€’ Jira by Atlassian: Get more work done with your favorite agents and models all in one place, check them out at jira.dev/ Chapters: 00:00 Intro 00:44 Why care about functional programming 06:35 Why should people learn Scala 09:26 Rust vs Scala 12:42 Rust vs Zig 15:45 Scala vs Python 18:31 The programming languages that influenced him 22:16 How running on the JVM works 26:33 Why writing a compiler is hard 29:19 Why Twitter adopted Scala early on 31:00 How he believes AI will impact programming languages 43:40 Will there be less engineers in ten years 44:34 Top programming languages to learn to grow 46:18 Top technical book recommendation 46:51 Why he chose academia instead of industry 48:28 Reflecting on Scala 55:42 Advice for his younger self 56:33 Outro
173
"This allowed the database to do less work at once, allowing it to do more work in total." Great article with nice visuals to build intuition around latency and throughput
1
122
First part of the report explains TigerBeetle's data model. Pure gold
3
11
1,705
Slides from my talk "(Un)usual use cases for Kotlin/Wasm" at Kotlin User Group Berlin: tinyurl.com/48t6fwzh
197
"And since your compiler and hardware conspire to turn your code into things you didn’t write, running in orders you never asked for, how do multithreaded programs work at all?" From assets.bitbashing.io/papers/…
2
158
Days since I debugged a problem that was caused by .yml vs .yaml: 0
2
122
Depends on your definition of elegance. Here is no-deps Kotlin for comparison:
Someone explain why Python isn't the most elegant language again?
1
5
432
Spent several hours debugging weird timing-related bugs on staging. We recently migrated one of our services to dedicated k8s namespace. Turns out somebody from another team didn't get the memo and manually applied old k8s manifests via kubectl. As a result we
1
220
got second deployment (in default namespace). All http traffic was correctly routed to the deployment in dedicated namespace. But both deployments were listening to the same RMQ queues, effectively stealing each other messages. This was exacerbated by the fact that this service
1
207
has postgres + in-memory writethrough cache and is represented as stateful set. It was a nightmare to debug - subtle inconsistencies like "item is present in db but sometimes is missing from in-memory state". #k8s #distributedsystems
164
Chat, is it real? 😻
πŸŽ‰ Congrats to the winners of our Kotlin T-shirt contest! Your creative combo β€œMore Null - More Fun” has won you tickets to the next KotlinConf. πŸ™Œ Thanks for participating and sharing the Kotlin fun! @kleshney: Email us at [email protected]. nitter.cf/kleshney/status/179404…
3
262
> [...] our software is slower than it should be. We have layers of abstractions to fight against. Sometimes you win, sometimes you lose
The fast JavaScript runtime Bun is much faster than Node.js 22 at decoding Base64 inputs. By much faster, I mean *several times* faster. But they both rely on the same underlying library (simdutf) for the actual decoding. So what gives? The problem is that Node.js needs to interact with v8, the underlying JavaScript engine (from Google)... and doing so is not trivial. Before we can start decoding the string, we need to grab the string... so, in this instance, we call String::Value... In turns, this allocates an array inside Node.js and asks v8 to copy the content to it... In an ideal world, we would avoid the trouble entirely and just ask v8 to give us direct access to how it stores the string... and we try to do that if we can... but let me come back to it... How bad can this be, right? Just a copy. Well. Let us do some profiling... So you see, the base64 decoding itself is about about 1/5 of the running time, but the copy takes half of it. What is up with this CopyChars function? Well, it is mostly just a wrapper around the standard high level C++ function std::copy_n as far as I can tell. (see v8/src/utils/memcopy.h) But we are copying for an 8-bit input to a 16-bit output... why is that? Base64 is pure ASCII... and v8 can store ASCII using 8-bit per character. We get there before both IsExternalOneByte() and IsOneByte() are false (see node/src/node_buffer.cc)... We have fast paths for these cases. If IsExternalOneByte() is true, we just get the bytes and everything is great. Unfortunately, it does not always work. So we have a v8 string that is really pure ASCII, but, seemingly, we can't tell that it is the case from Node.js, and so we have to convert it to UTF-16 needlessly, using a function that is maybe not very well optimized... and then we do the base64 decoding of an ASCII string from the UTF-16 input. It is not great. To be fair, this is just one string, created as 'Buffer.alloc(size, "latin1").toString("base64")', basically the base64 encoded version of the string "latin1latin1latin1...". In actual applications, we might have better luck. Yet. Yet. I am telling this complicated story for a reason. The story illustrates why our software is slower than it should be. We have layers of abstractions to fight against. Sometimes you win, sometimes you lose. These layers are there for a reason, but they are not free. To make matters worse... these abstraction layers often thicken over time... and the friction goes up. To be clear, I do not claim that the Node.js code is optimal. In fact, I know it can be better. But it is not trivial to make it go fast. I sometimes hear people say... "well, it is C++ and C++ is hard". No. The C++ part is easy relatively speaking. The difficulty is at a higher level. It is not a matter of syntax. It is a matter of architecture.
3
276