Dev Miscellaneous
358 subscribers
883 photos
6 videos
5 files
912 links
A channel where you can find developer tips, tools, APIs, resources, memes and interesting contents.

Join our comments chat for more.

Comments chat (friendly :D)
https://t.me/+r_fUfa1bx1g0MGRk
Download Telegram
The Raspberry Pico Microcontroller: Hardware and GPIO Functions

The Raspberry Pi Pico, or shorthand Pico, is a new microcontroller from the Raspberry Pi foundation....

https://medium.com/geekculture/the-raspberry-pico-microcontroller-hardware-and-gpio-functions

@DevMisc
#raspberry #hardware #cpp
Free Geoip Api

Free ip geolocation api using c++ and php

https://github.com/Markus-Go/ip-countryside

@DevMisc
#cpp #php #geoip
C++ for Python

Cppyy is a python library to make C++ bindings for your application.

https://github.com/wlav/cppyy

@DevMisc
#cpp #library #python
Rust vs C++ – which is better and why

Both Rust and C++ are system programming languages, which means they can be used to write low-level code like kernels...

https://federicoterzi.com/blog/rust-vs-cpp-which-is-better-and-why/

@DevMisc
#rust #cpp #webasm
Google SAPI

Generate sandboxes for C/C++ libraries automatically.

https://github.com/google/sandboxed-api

@DevMisc
#google #tools #c #cpp
😁12🤩1😍1🌚1
I Coded a Video Editor (and it kind of sucks)

Coding a video editor in a week 8 months with C++/OpenGL/Imgui.

https://youtu.be/iydG-e1dQGA

@DevMisc
#cpp #graphics #misc
🐳6
🤯12🖕1
😁1
Why German Strings are Everywhere

- Developed by Umbra (CedarDB's predecessor)
- Adopted by DuckDB, Apache Arrow, Polars, and Facebook Velox

German Strings are a custom string type highly optimized for data processing. They offer significant improvements over traditional C and C++ string implementations.

Key Features:
- 128-bit struct representation (vs. 192 bits in C++)
- Short string optimization for strings ≤12 characters
- Long string format with 4-char prefix for quick comparisons
- Immutable design for better performance and concurrency
- Storage classes: persistent, transient, temporary

Advantages:
- Space-efficient, fitting in two CPU registers
- Reduced allocations and data movement
- Easier parallelization due to immutability
- Flexible lifetime management with storage classes
- Optimized for common database operations (comparisons, sorting)

Trade-offs:
- Requires careful consideration of string usage and lifetime
- Updates are more expensive (but rare in database systems)
- Maximum string length limited to 4 GiB


https://cedardb.com/blog/german_strings/

@DevMisc
#cpp #data #misc
👍5
Counting Bytes Faster Than You'd Think Possible

- The author was able to significantly optimize a byte-counting program, achieving a ~550x speedup over a naive implementation.
- The key optimization was using an interleaved memory access pattern, reading from different 4KB pages in a round-robin fashion, instead of sequential access.
- This interleaved access pattern takes advantage of the "Streamer" hardware prefetcher in modern CPUs, which can maintain separate forward and backward access streams for each 4KB page.
- Interleaving 8 different 4KB pages was found to be the optimal approach, providing up to a 30% performance boost over sequential access.
- The author also unrolled the inner loop to process 2 cache lines (64 bytes) at a time, and added a prefetch instruction to fetch the next set of data.
- The final solution uses AVX2 SIMD instructions to perform the byte counting in a highly efficient manner.
- The author was able to achieve a ranking of #13 on the HighLoad leaderboard with this optimized solution.
- The interleaved memory access pattern seems to be an under-discussed optimization technique, with the author not recalling seeing it used in other code.
- The author encourages readers to share any other memory-based optimizations they are aware of, as the author is interested in learning about them.
- The document provides the full source code for the optimized byte-counting program, allowing readers to study and potentially apply the techniques in their own work.


https://blog.mattstuchlik.com/2024/07/21/fastest-memory-read.html

@DevMisc
#asm #cpp #optimization
1🤯1