Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
boris-smidt
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
by
boris-smidt
2y ago
I just tried the switch statement ``` func BenchmarkSwitch(b *testing.B) { for i := 0; i < b.N; i++ { for i := 0; i < len(randomBytes); i++ { loop: for i, x := range randomBytes[i:] { switch x { case '0', &#x
2.
▲
by
boris-smidt
2y ago
Yes i agree with that one most people don't need, they should first use a profiler. Then they can easily improve the performance by 10x. For example I optimized a calculation with python dataframes by monkeypatching the 'unique&#x
3.
▲
by
boris-smidt
2y ago
Also add cryptographical people to that list. A friend of mine told me that they create 'constant' time algorithms. These have to written in assembly otherwise the compiler will try to speed up the algorithm. But then you can the
4.
▲
by
boris-smidt
2y ago
I'll have another try in Zig later on and indeed the XMM/MMX and MMY really is confusing, couldn't they just cal it V128, V256 and V512 ...
5.
▲
by
boris-smidt
2y ago
I suspect it depends, when you would write a yaml/json parser you can only change the algorithm up to a point. After that you will have to start doing some bit fiddling and then being able to see the assembly can be really valuable.
6.
▲
by
boris-smidt
2y ago
Reading is indeed the main thing i would like to learn, For my master thesis i had dome some GPU programming (8 years ago) and then it was super useful to read the assembly to reduce the amount of steps and to understand the 'execution
7.
▲
by
boris-smidt
2y ago
Interesting i never thought of ASCII to be a table of tables I'll have another look into the ASCII table number sequences to better understand it. This thread is really full of gold nuggets.
8.
▲
by
boris-smidt
2y ago
I'll try it in the follow up post and probably include some graphics to make it clear what it does. Its indeed the real simd way of comparing multiple characters in 1 iteration instead of 1 character per iteration.
9.
▲
by
boris-smidt
2y ago
Hey i just discovered that my blog post was posted here i indeed have little experience with assembly and the idea was just could i use a 'larger register' like you would use a 64bit register to keep the table hot in the CPU. But