Let me talk about something obvious but with a bit of quantification...
Theoretically, both arrays and linked lists take O(n) time to traverse, but here's what actually happens when you benchmark by summing 100k integers
- Array: 68,312 ns
- Linked List: 181,567 ns
Summing an array is ~3x faster than LinkedList. Same algorithm, same complexity, but wildly different performance.
The reason is cache behavior. When you access array[0], the CPU fetches an entire cache line (64 bytes), which includes array[0] through array[15]. The next 15 accesses are essentially free. Arrays hit the cache about 94% of the time.
Linked lists suffer from pointer chasing. Each node is allocated separately by malloc(), scattered randomly in memory. Each access likely requires a new cache line fetch, resulting in a 70% cache miss rate.
This is a good example of why Big O notation tells only part of the story. Spatial locality and cache-friendliness can make a 2-3x difference even when the theoretical complexity is identical.
I am sure you would have known this, but this crude benchmark quantifies just how fast cache-friendly algorithms can be.
Hope this helps.
Theoretically, both arrays and linked lists take O(n) time to traverse, but here's what actually happens when you benchmark by summing 100k integers
- Array: 68,312 ns
- Linked List: 181,567 ns
Summing an array is ~3x faster than LinkedList. Same algorithm, same complexity, but wildly different performance.
The reason is cache behavior. When you access array[0], the CPU fetches an entire cache line (64 bytes), which includes array[0] through array[15]. The next 15 accesses are essentially free. Arrays hit the cache about 94% of the time.
Linked lists suffer from pointer chasing. Each node is allocated separately by malloc(), scattered randomly in memory. Each access likely requires a new cache line fetch, resulting in a 70% cache miss rate.
This is a good example of why Big O notation tells only part of the story. Spatial locality and cache-friendliness can make a 2-3x difference even when the theoretical complexity is identical.
I am sure you would have known this, but this crude benchmark quantifies just how fast cache-friendly algorithms can be.
Hope this helps.
Back in 9th grade i tried to make an animation by drawing a picture slightly differently multiple times ... using ms paint
There weren't enough drawings i made so it was a bad animation
There weren't enough drawings i made so it was a bad animation
Back then i also created subtitle files for one of my fav cartoon network shows: Angelo Rules. They were in Amharic and they were so perfect. I just opened notepad and edited an srt file, by autistically tracking the timestamps in the video
Meanwhile me now: "what if i cut my hair using the knife?π€"
(p.s. it's much harder to cut a strand of hair than it is to cut potatoes or bread)
(p.s. it's much harder to cut a strand of hair than it is to cut potatoes or bread)
Saw a key and peele vid where bro says
>some idea
>nah bro that's like lightning in a bottle
>well i got lightning in a bottle *shows lightning in a bottle*
Goofy ahh humor
>some idea
>nah bro that's like lightning in a bottle
>well i got lightning in a bottle *shows lightning in a bottle*
Goofy ahh humor
This media is not supported in your browser
VIEW IN TELEGRAM
ααα ααα α αα¨α°α΅αα’
π₯°1π1
developus mediocrus
i be mad why goland doesn't have the () around the if condition, and then make this kind of mistake myself.
dart btw. i'm cooking up sth
β‘1
I went to this workspace at Bole, thinking it would be cheap
α₯α¬α α°αα₯α©π
α₯α¬α α°αα₯α©π
π3
developus mediocrus
dart btw. i'm cooking up sth
Introducing: which-port. A simple Flutter app for linux desktop for freeing occupied ports. Are you tired of seeing messages like "port 3000 is already in use"? Now you can simply track which process is holding the port, an kill it, so that you can use the port as you wish.
Check out the soure code on Github: (don't forget to leave a star :) )
https://github.com/Dechie/which-port
Check out the soure code on Github: (don't forget to leave a star :) )
https://github.com/Dechie/which-port
π₯2β‘1
developus mediocrus
Introducing: which-port. A simple Flutter app for linux desktop for freeing occupied ports. Are you tired of seeing messages like "port 3000 is already in use"? Now you can simply track which process is holding the port, an kill it, so that you can use theβ¦
i just love doing this
β€1
developus mediocrus
Introducing: which-port. A simple Flutter app for linux desktop for freeing occupied ports. Are you tired of seeing messages like "port 3000 is already in use"? Now you can simply track which process is holding the port, an kill it, so that you can use theβ¦
Also i learned that Dart has powerful capabilities when it comes to dealing with OS stuff. You can use pure dart to create new processes, kill them, or manipulate them.
You can literally call commands like cat and ls with dart.
Underrated language fr
You can literally call commands like cat and ls with dart.
Underrated language fr
developus mediocrus
Introducing: which-port. A simple Flutter app for linux desktop for freeing occupied ports. Are you tired of seeing messages like "port 3000 is already in use"? Now you can simply track which process is holding the port, an kill it, so that you can use theβ¦
This app has no dependencies btw. Zero flutter packages used. There were two places i needed provider (or other state management), but i still did it without that.
β‘1
Forwarded from It's FOSS
MidnightBSD is not taking any chances with age verification. π²
https://itsfoss.com/news/midnightbsd-age-verification/
https://itsfoss.com/news/midnightbsd-age-verification/
It's FOSS
MidnightBSD Bans Users in Brazil and California, Warns More Regions Could Follow
Colorado, Illinois, and New York could join the list if their proposed age verification bills pass.
It's FOSS
MidnightBSD is not taking any chances with age verification. π² https://itsfoss.com/news/midnightbsd-age-verification/
The state of California in USA and Brazil are aggressively enforcing age verification laws, even asking Ubuntu OS to build it in (in a way that affects all Linux distros).
This BSD based OS has protested against them.
This BSD based OS has protested against them.
I swear one day I will be an Artix user.
I already have it in vm. I just gave up on it because installing flutter without systemd is unbearably difficult
I already have it in vm. I just gave up on it because installing flutter without systemd is unbearably difficult