All Questions
Tagged with performance c
536 questions
2
votes
1
answer
74
views
Efficiently simulating a control sequence
I have a control problem that I am simulating in C. The premise is that I have some continuous-time signal s(t) and I am given some length-150 array ...
3
votes
2
answers
145
views
Numerical integration using Gauss and trapezoidal methods [closed]
I have written a code that performs numerical integrations—one using the Gauss method and the other using the trapezoidal method. For the Gauss method, I have five separate text files containing the ...
7
votes
1
answer
206
views
Robin Hood Hash Table
The following code comes from an intrusive container library I am working on in C23. So far, it works correctly due to extensive testing and sample programs I have written with it. I have implemented ...
8
votes
2
answers
196
views
Leetcode 93: Restore IP Addresses (C version)
This is posted in response to this request made in a discussion of my "C-ish" answer to a recent Code Review question regarding a Python solution to a Leetcode challenge. It was reported ...
1
vote
1
answer
71
views
Optimizing C System Design for Sensor Data Handling
I am developing a system in C for a device running Yocto Linux (Posix compatible, libc, etc.) on a microprocessor. The Yocto build is "quite generalized", as it's supposed to run several ...
7
votes
3
answers
990
views
Dynamic Arrays with Count / Capacity in C
I write in C for several projects (e.g. learning / teaching,
coding competitions, data processing) and frequently need
arrays (e.g. strings) with fast appending / concatenation / reversing.
I've ...
6
votes
3
answers
1k
views
Implement Huffman code in C17
I just finished my first coding project. Prior to this I have only made small programs so I'd like some feedback on what to improve on and how I did in general. The whole code is 658 lines long.
The ...
3
votes
2
answers
88
views
Reading a file into lines (benchmarking getline() vs mmap_memchr() vs mmap_getline() vs fread())
This is a follow-up to: Reading a file into lines with mmap vs getline.
The actual names of the functions are not ...
7
votes
1
answer
252
views
Reading a file into lines with mmap vs getline
I required a function to read a file into lines for a text editor, and ended up with two routines. One uses getline(), and the other uses ...
9
votes
4
answers
2k
views
Implementing a simple byte manipulation encryption
Can you kindly take a look at the code? Any suggestions regarding performance, readability, potential bugs, portability, security measures, etc. are highly appreciated.
The code reads a character, a ...
5
votes
2
answers
261
views
This is a simple stopwatch cli application with a few options
My goal of this when I started writing it was simply that it be able to record thousandths of a second in a very performant and accurate way. I'm not sure I have achieved the performance aspect of ...
2
votes
1
answer
66
views
Benchmarking putchar_many vs puts Performance for the Same Byte
Whilst writing an interpreter for Brainfuck, I had collapsed sequences of .......... to a single instruction OP_PUT (10) (Note ...
5
votes
0
answers
261
views
tbf - An Optimizing Brainfuck Interpreter and Transpiler in C
Language:
The Brainfuck programming language consists of eight commands:
...
8
votes
2
answers
285
views
Filling a buffer with a repeating pattern of N bytes
My program will clear the screen to a 24bit RGB color; in other words, it will fill a buffer with a repeating pattern of 3 bytes. So I wrote patternMemcpy to perform this operation efficiently*. It ...
9
votes
4
answers
1k
views
Reverse Engineering Data Files (Binary Visualization)
Binary Visualization based on Christopher Domas talk: youtube link and this Russian programmer where I discovered this talk: youtube link.
Algorithm:
Scan the pairs of bytes of a file with a sliding ...