HNHacker News
TopNewBestAskShowJobs

okaleniuk

1,667 karma · joined October 3, 2017

I do https://wordsandbuttons.online and wrote https://www.manning.com/books/geometry-for-programmers
submissionscomments
okaleniuk··on How to Ride like a Cop [video]
Well, it's a good video but... Hacker News?

On the related topic, you know how in Ford Mustang the engine noise is simulated so the engine would sound like a pre-emission-standards V8 even if it runs on just four? How about a similar thing for a motorcycle? You put on your noise-canceling head phones, and the phones emit a "noise-canceled" rev of an engine you choose. You can enjoy the sound of a Harley on a moped. And! Since it's your headphones only, you wouldn't even bother the public.

I think there is a startup potential on it somewhere. And the technology is here too: https://github.com/ange-yaghi/engine-sim

okaleniuk··on How (not) to apply for a software job
I lead a small R&D team in Materialise's Kyiv office. Due to very demanding requirements (we need someone who can do math, write code, and communicate with other people reasonably well, often at the same time), I usually have to read somewhere between 50 to 100 resumes per hire. And one thing is absolutely certain - there is an inverse correlation between the quality of the resume and the quality of the candidate.

People in high demand don't have, nor should they have, the skill to write resumes. That's the skill that people who can't get a job naturally develop.

The other thing, a bad resume often protects you from bad employers. Take this passage from the post: "When candidates first started (obviously) using AI for their applications, I would rule them out for “cheating”" - that's... incredibly stupid. You don't want to work for or with stupid people so I think all the ruled-out people dodged a bullet here.

One reason I joined Materialise was that the recruiter used my LinkedIn profile at the interview instead of asking for a resume. Didn't waste their own time, didn't waste mine. That's smart. I want to work with smart people. I'm in.

okaleniuk··on Introducing geometric algebra to software developers
I think, type inference is a poor man's model checking. And it makes exactly as much sense as your model does. There is no such thing as a universal model. https://wordsandbuttons.online/static_typing_isnt_free.html

Adding scalar and a vector may be a breach of model but it may also have several different meanings each of them pragmatic in its own context. It may mean concatenation, as with C++ strings or adding the same scalar to every vector's element as with APL tensors.

Geometric algebra imposes its own type relations and has all the rights to do so.

okaleniuk··on Fossil versus Git
In case you were wondering, there is a "FossilHub": http://chiselapp.com/
okaleniuk··on Compiling ML models to C for fun
I think this is brilliant! And, what's more important, practical.

I did a similar thing a few years back for small linear systems: https://wordsandbuttons.online/outperforming_everything_with... The idea is essentially the same - we both turn the computation process itself into code. I choose LLVM intermediate language instead of C because the whole point of my exercise was to show that you don't need C (or any other compiler) to generate efficient code. In fact, if you already have your computation figured out, C only gets in the way. For this very reason, I avoided calling the code generation process a "compiler".

My thing, however, doesn't have any practical usage. This one does and I think it's beautiful!

okaleniuk··on Writing HTML by hand
No, it's all vanilla JS.

Moreover, I don't even have internal dependencies, every page is written from scratch (with a pinch of copy-paste). This is a hobby project, and I like to program, so I'm just not interested in code reuse.

okaleniuk··on Writing HTML by hand
I do all the https://wordsandbuttons.online/ by hand, and this is my top 10:

    2527 p
    2047 a
    1318 span
    1078 td
    918 b
    537 tr
    531 sub
    499 br
    401 i
    393 table
okaleniuk··on Homebrew Website Club
This means that the more lexemes look alike, the more they need color difference the highlighting provides. Like 'coordinate_u' and 'coordiante_v' should be distinctively different, but 'coordinate_u' and 'GetCanvasWidth' can even share the same color.
okaleniuk··on Homebrew Website Club
Hi James. Mine is https://wordsandbuttons.online and I'm definitely zooming in <s>this</s> next Wednesday.
okaleniuk··on So You Think You Know C? (2020) [pdf]
Wow! Didn't expect to see it on Hacker News again.

Hello, hi! I'm Oleksandr Kaleniuk, and I wrote the thing back in 2020. Please don't take it all too seriously. There was COVID-19, I had nothing better to do.

I did write a new book since then, and my publisher would bite my head off for missing this opportunity. It's called Geometry for Programmers and it was published by Manning just this year. https://www.manning.com/books/geometry-for-programmers It's about curves, surfaces, transformations, homogeneous coordinates, rational splines, distance fields, and voxels. You don't have to know any advanced math to enjoy the book, but you might want to know a bit of Python. It's for programmers, so the didactic tools there are mostly code, not theorems.

okaleniuk··on Books for Game Developers
We used quaternions in our engine back in 2005-2008. Compared to matrix multiplications, multiplying quaternions was cheaper so we could save a few instructions here and there. But I never used them since.

One reason being, I suppose, processors are now much more superscalar-friendly so a matrix multiplication doesn't take much more time than a quaternion multiplication does. And with matrices, you get the whole package: not only rotations, but translations, scalings, and even projections, - all in one go. So you have simpler code, simpler data structures, and you don't lose performance so... why bother?

I didn't even include quaternions in my book. Well, not that I didn't want to. We had a whole discussion with the publisher about whether we should keep the whole chapter (complex numbers, conformal transformations, non-commutative 3D rotations, and quaternions) and I lost.

okaleniuk··on Books for Game Developers
What do you think about Geometry for Programmers? https://www.manning.com/books/geometry-for-programmers

It has been recently published (April 2023) and not yet in any lists.

okaleniuk··on Linear code is more readable
Have you tried reading code instead of smelling it?
okaleniuk··on Linear code is more readable
This "level of abstraction" euphemism actually means "the level at which I'm not reading code anymore even and especially if I should". Of course, linear code is more readable! Linear everything is more readable. Have you ever seen a novel with "levels of abstraction" in it?

But nobody reads the code anymore. Why bother? You're not going to stay on a single project for long enough for the attention investment to pay off. So the common best practice at the moment is to pretend that you read the code without actually reading it. For this purpose, the green code is much much better.

okaleniuk··on The Power of Prolog
Thank you!
okaleniuk··on The Power of Prolog
In a way, every static typed compiler has a bit of Prolog in it: https://wordsandbuttons.online/logic_programming_in_cpp.html
okaleniuk··on Rule of Three
Cloning things makes maintenance harder linearly. Generalizing things makes maintenance harder exponentially. Counterintuitively, generalization only makes sense on small numbers or reiterations, not the vice-versa.

I started https://wordsandbuttons.online as an experiment in zero-dependencies architecture. No third-party, no self-reference. Every page is completely independent. I was told, that as it grew, it would inevitably become impossible to maintain.

Five years passed, including a two-year pause for writing a book. I did more than half a hundred interactive tutorials and quizzes, and continue to add them when I have time. The thing simply refuses to go "too complex to maintain". All the maintenance problems I ever faced with this design were handled within minutes. If there is too much typing, I write a Python script. If not, I do the change manually, replicate it in a few pages, and go on.

As a free bonus, since all my pages are essentially hand-written, no dependencies = no uncontrolled growth, they are all fewer than 64 KB each. Ultra-fast to load, and I never get a "Reddit effect" since even 1000 requests a second is only 64 MB of data. It's green then tea too. I usually have a few hundred thousand visitors a year, and they barely consume enough electricity to boil a kettle of water.

I think this rule of three, like many others is just an attempt to escape well-known complexity issues by putting them under a carpet of less known complexity issues. I'm very happy to have ignored it when considering design for my site.

okaleniuk··on Ask HN: Why did Python win?
Ten years ago, Python used to be excellent as a second choice for everything. So if you dabbled in machine learning, web, statistical analysis, text processing, system scripting, computer algebra, etc, it made sense to learn some Python even if your main job was in something else.

So it grew a critical mass of people who know Python but not for the sake of Python itself, but for something else. And suddenly these people are invested. They want more, better, and faster. And then the demand pulls the proposition, and a decade later, Python is a big thing.

I work in applied geometry. Numpy is good. Pandas is of little relevance for what I do. But what became a gamechanger is Numba. It's a run-time compiler that brings Python into native code for the target architecture, Inter, ARM, or even NVidia GPGPU.

We used to do research in Python, invent algorithms there, and then rewrite them in C++ "for performance". The last time we did that, C++ version became 3 times as slow as the Python one when translated literally. We hid the fact by rewriting the algorithm itself, but that was the last straw. We now run Python in the cloud directly, and it rebuilds the native code for every piece of hardware we procure for the task automatically and I think this is beautiful.

okaleniuk··on Visualization of Common Algorithms (2011)
Since we're sharing links, here's my collection of interactive pages too:

Interactive visual explanations of math and algorithms, with motivating examples from computer games. https://www.redblobgames.com/

The world's first linear algebra book with fully interactive figures. http://immersivemath.com/ila/index.html

The Textbook of the Future. Interactive. Personalised. Free. https://mathigon.org/

Structure and Interpretation of Computer Programs. Interactive Version https://xuanji.appspot.com/isicp/

An Interactive Introduction to Fourier Transforms http://www.jezzamon.com/fourier/index.html

Clear, intuitive lessons about imaginary numbers, exponents, and more. https://betterexplained.com/

An Interactive Introduction To Quantum Computing http://davidbkemp.github.io/QuantumComputingArticle/

The website of Martin O'Leary artist, designer, teacher, researcher. http://mewo2.com/

A Visual and Interactive Guide to the Basics of Neural Networks https://jalammar.github.io/visual-interactive-guide-basics-n...

Interactive demos on network theory, game theory, trust etc. https://ncase.me/

An interactive explanation of curves and surfaces https://ciechanow.ski/curves-and-surfaces/

Introduction to geometric algebra — an invertible vector product and the implication of having one. https://mattferraro.dev/posts/geometric-algebra

Interactive visualizations for different topics from physics and mathematics. Includes trigonometry, polynomial regression, and Bézier splines https://visualize-it.github.io/

Assorted tutorials on computer graphics, size coding, and maths. Includes a mini-library of signed distance functions. https://www.iquilezles.org/www/index.htm

A free, online book for when you really need to know how to do Bézier things. https://pomax.github.io/bezierinfo/#explanation

A visual overview of commonly used creative coding related techniques and algorithms. https://www.notion.so/Creative-coding-algorithms-techniques-...

A Visual and Interactive Introduction to Complex Analysis. https://complex-analysis.com/

A collection of visualisation on linear algebra and geometry. https://intuitive-math.club/

Sublucid Geometry — a place for uncommon knowledge. https://zalo.github.io/

And a shameless plug — a collection of interactive tutorials, demos, and quizzes about mathematics, algorithms and programming. https://wordsandbuttons.online/

okaleniuk··on A forum engine written in Assembly
You have to measure. It's a contextual optimization, no compiler in existence measures contextual optimization for you. Even the profile-based optimization is a spray and pray thing.

CPUs are not getting better at division per se, but they are getting better at all the ALU operations compared to the memory latency. You can add more transistors on a chip, but you can't cheat the light speed and make signal travel 30 cm in less than a nanosecond. So you need to bring your data closer, you need caches. Code, unsurprisingly, is also data, and it also goes through the instruction cache.

This optimization is instruction latency vs. cache intake. It may or may not be beneficial depending on the rest of the program. I've already seen both Clang and GCC produce faster code with -Os rather than with -O3.

okaleniuk··on A forum engine written in Assembly
Have you tried measuring the actual impact of this?

This optimization is so old, I'm not even sure if it's still worth the effort. It definitely worked in the 90s.

What you do here is you save on division, and lose on instruction cache. This might look good on a benchmark when all your code fits the cache nicely, but bite back in-vivo. You should try it out in an actual problem and see how it goes.

okaleniuk··on A forum engine written in Assembly
If you're inclined to write fast code in assembly, you will. If not - not.

The thing is, optimizing compilers don't actually do any optimization in the classical sense. They don't do run-measure-modify loop as programmers do so all they can apply to the code is the heuristics some other programmers taught them. Some things are trivial like loop unrolling or function inlining. Some are not, like trigonometric approximations.

In the long run, when a compiler stops, a person goes further. That's why empirically, hand-made code is still faster than the compiled one. Of course you can write slow code in Assembly, but if you already decided to go low, you'll optimize your thing until satisfied with the result.

One particular thing comes to mind, C is ridiculously bad with automatic superscalarization (try VTune's HPC characterization on any code you like and see). Sure, you can use intrinsics and implement things manually, but that would be essentially the same as writing in assembly.

There is another contender though. Spiral (https://spiral.net/) that actually do solve the optimization problem can in fact be as effective as a human programmer and at a fraction of the cost. Spiral is overly specialized, so it's not a threat to all the HPC, but a more generic thing may indeed become a gamechanger.

okaleniuk··on A forum engine written in Assembly
You are right. The site is not fast because of Assembly, it is simply well designed.

Assembly, however, pushes towards healthier design choices. You have to keep things simple since you are the one who pays for the complexity, not a third-party library providers who use several third-party libraries themselves.

okaleniuk··on Programmers should not call themselves engineers (2015)
There is a notion that programming is an extreme kind of poetry. Like with haiku, where there are rules, and the rules are formal, you can ratify an ISO standard on haiku rules; but they only support the structure and not the sense.
okaleniuk··on Programmers should not call themselves engineers (2015)
I've been wondering myself whether "software engineering" is a misnomer. We have so many of them in software engineering.

What if creating software is closer to investigative journalism than to building bridges? Consider this, a small subset of professions falls under the umbrella of engineering. There are chemical engineers, mechanical engineers, electrical engineers etc. There are no sports engineers, law engineers, or literature engineers. Some people activities are just not engineerable. This doesn't make them any less important, so I deeply disagree with "programming cheapens engineering" statement.

And it's not that software is a novel concept. In fact, the very argument that software is new and is not yet properly regulated is becoming old. Software is older than spaceflight, computer tomography, and mobile telecommunications, - all heavily if not excessively regulated.

Somehow, creating software dodges most of the attempts to make it into an engineering discipline. Somehow, most of the norms and rules we invent don't pass the test of time. There is the SWEBoK, there are also ISO standards for computer languages, and their use, but the art of programming still remains orthogonal to the standardization effort. Most of the software outside safety-critical systems is still created by artisans and not engineers. And... it's ok. Maybe you don't need a license to write a yet another dating app.

So maybe software engineering is indeed a misnomer. Like a racoon dog, a guinea pig, or MTV.

okaleniuk··on Amiga runs Michigan schools' heating and air conditioning systems (2015)
This just shows that we need a sustainable widely supported hardware platform for long-time operation. 30 years is not that long. I wonder if RISC-V could take this niche.
okaleniuk··on Replace peer review with “peer replication” (2021)
Back when I was active in academia, our publishers were reluctant to print source code or even repository links (that was largely before GitHub) but they could still share a paper source on demand. If you reference someone else's paper and want to quote some formula, it is easier and less error prone to copy rather than retype.

At that point I thought about making a TeX interpreter so one could easily "run a paper" on their own data to see if the papers claims hold. As it turned out, people often write the same formula in multiple ways and to make a TeX interpreter you'd have to specify a "runnable" subset and convince anyone to use that subset instead of what they got used to. So the idea stalled.

In a few years, publishing a GitHub link along the paper became the norm, and the problem disappeared. At least in applied geometry, people do replicate each other results all the time.

okaleniuk··on {n} times faster than C
Yes, but this will backfire on ARM, where jumps are as roughly fast as conditional arithmetic.

The whole point of using C is not to think about the underlying architecture. As soon as you start taking "jumps are a lot slower than conditional arithmetic on x86" into account, you're not writing in C, you're writing in assembly with extra steps :-)

okaleniuk··on {n} times faster than C
I think, it's a particular quirk of x86 architecture. Branching is expensive in comparison because not doing branching is super cheap. https://wordsandbuttons.online/challenge_your_performance_in...

However, on other processors, this might not be the case. https://wordsandbuttons.online/using_logical_operators_for_l...

The good question is what do we need C for in general? Of course, we can hand-tailor our code to run best on one particular piece of hardware. And we don't need C for that, it would be the wrong tool. We need assembly (and a decent macro system for some sugar)

But the original goal of C was to make translating system-level code from one platform to another easier. And we're expected to lose efficiency on this operation. It's like instead of writing a poem in Hindi and translating it in Urdu, we write one in Esperanto and then translate to whatever language we want automatically. You don't get two brilliant poems, you only get two poor translations, but you get them fast. That's what C is for.

okaleniuk··on Ask HN: Is it time to resurrect a Usenet clone?
I think we should dig a little bit deeper to find a thing worth resurrecting. What worked in FidoNet and earlier networks was the social organization, not protocols. A usual way to enter a net was to get a point level address from someone with a node. You had to know the person in the real world, and the person had to vouch for you. Your actions could have jeopardized the whole node, so there was a certain level of accountability.

I don't know to which level this element is resurrectable though. Why would one want accountability if there is internet where there is none?

The technological side is secondary. You can make an hierarchical network on mail protocols alone with a simple echo script.

← PreviousPage 4 of 11Next →