HackerTrans
TopNewTrendsCommentsPastAskShowJobs

chrka

112 karmajoined tahun lalu
[email protected]

Submissions

Your code is fast – if you're lucky

tiki.li
2 points·by chrka·2 jam yang lalu·0 comments

Your code is fast – if you're lucky

tiki.li
2 points·by chrka·18 hari yang lalu·0 comments

Show HN: Faster than std:sort and pdqsort

easylang.online
1 points·by chrka·2 bulan yang lalu·0 comments

Show HN: Branchless Quicksort – faster than std:sort and pdqsort

easylang.online
2 points·by chrka·2 bulan yang lalu·0 comments

Show HN: Avoiding "if" makes Quicksort faster

easylang.online
3 points·by chrka·2 bulan yang lalu·4 comments

When 'if' slows you down, avoid it

easylang.online
6 points·by chrka·2 bulan yang lalu·0 comments

Show HN: A Fast Quicksort in C with Branch‑Avoidant Coding and Threads

easylang.online
1 points·by chrka·2 bulan yang lalu·0 comments

Show HN: Interactive demos of sorting algorithms with runtime comparisons

easylang.online
1 points·by chrka·3 bulan yang lalu·0 comments

Show HN: Interactive sorting algorithm visualizations with runtime comparisons

easylang.online
1 points·by chrka·3 bulan yang lalu·0 comments

Show HN: Law of Large Numbers or Why It's a Bad Idea to Go to a Casino

easylang.online
3 points·by chrka·6 bulan yang lalu·1 comments

Show HN: Programming a Christmas Tree

easylang.online
2 points·by chrka·7 bulan yang lalu·0 comments

Show HN: A short story of my programming language Easylang

easylang.online
2 points·by chrka·8 bulan yang lalu·0 comments

Analysis indicates that the universe’s expansion is not accelerating

ras.ac.uk
261 points·by chrka·8 bulan yang lalu·208 comments

Show HN: Strange Attractors – Visualized with Easylang

easylang.online
3 points·by chrka·8 bulan yang lalu·0 comments

Show HN: A beginner-programming language and IDE with helpful tab completion

easylang.online
3 points·by chrka·8 bulan yang lalu·0 comments

Splitting (Empty) Strings (2017)

chriszetter.com
1 points·by chrka·9 bulan yang lalu·0 comments

Show HN: Tab completion for my small browser-based programming language Easylang

easylang.online
2 points·by chrka·9 bulan yang lalu·0 comments

comments

chrka
·6 hari yang lalu·discuss
Don't trust your compiler. Your code is only fast if you're lucky.

https://tiki.li/blog/lucky_code.html
chrka
·bulan lalu·discuss
Normally, quicksort works best on random data. But with 90% already sorted and 10% random, it actually becomes harder to pick a good pivot. Sometimes the pivot ends up too large, which creates very uneven splits. When that happens, the algorithm switches to heapsort to avoid worst-case behavior, but heapsort is slower. Now, instead of immediately switching, it tries to partition again. Only if it’s still bad does it fall back to heapsort. That’s why performance improves.
chrka
·bulan lalu·discuss
As for your party trick: The performance drop in "blqs" occurred because heapsort was applied directly to a poorly partitioned input. Quicksort now gets a second chance in this case. With 10% random, 90% sorted, the performance drop no longer occurs. It is now faster than std::sort.
chrka
·bulan lalu·discuss
You will now see the directory listing. This website was actually created for my primary side project: a simplified programming language for beginners. I just added a blog folder there for other things as well.
chrka
·bulan lalu·discuss
Branchful only wins via ILP when data becomes good predictable. But since Quicksort partitioning aims for a 50/50 split, it operates in the worst possible zone for a branch predictor. That's why branchless wins here, as proven by the benchmarks.
chrka
·bulan lalu·discuss
Author here. No, it's also called from the non_trivially_copyable branch (as a fallback). I'll fix that.
chrka
·7 bulan yang lalu·discuss
https://easylang.online/xmas.html