39,897 questions
Best practices
0
votes
7
replies
104
views
How can I encourage malloc() to return a series of consecutive allocations?
I've observed that when I write a little test program that builds a linked list and prints the addresses, they tend to be consecutive. This is a very cache-efficient behavior, since the nodes pack ...
Best practices
0
votes
3
replies
86
views
How should ID's be accessed/issued in ECS?
I have been writing a simulation that uses ECS, and i wanted to ask what the best practice would be for issuing/using IDs.
My main question is: Should the index of the component be the ID, or should ...
Best practices
1
vote
5
replies
126
views
ARM GCC 16.1.0 - sub-optimal compiler behaviour for division by 7 etc?
I am using Compiler Explorer and ARM GCC 16.1.0 with -OFast option, 32-bit (though I think the same issue applies with 64-bit). The following C code:
int divide( unsigned int num) {
return num/7;...
Score of 2
2 answers
217 views
Optimizing Euclidean distance array filter for 3D points within a radius of a given point? [closed]
I have a performance-critical radius search function in a hot path running on an Intel Xeon Ice Lake 8352Y (AVX-512 capable, 32 cores, 2.2 GHz) and compiled with gcc 14.3.0.
The function computes ...
Advice
2
votes
5
replies
128
views
Adding explicit constraints in C
I'm learning C currently and want to practice it while having resource limitations like fixed memory budgets, performance constraints, restricted lib usage. How do I place them? Any good practices, ...
Score of 3
1 answer
139 views
How to optimize $O(N)$ insertion time in a custom Java Singly Linked List used as a Priority Queue?
I am implementing a custom generic Singly Linked List in Java to manage elements ordered by a specific priority (a custom priority task queue). While the implementation works fine for small datasets, ...
Advice
0
votes
6
replies
191
views
Is there a faster/better way to add a string to all the cells in a table column in VBA?
at the moment I am using this code snippet to add "20" to the beginning of each cell in a table column:
For Each r In Range(TabellNamn & "[Date/Time]")
r.Value = "20&...
Best practices
0
votes
3
replies
74
views
Optimize total record count
I need help optimizing COUNT(*) on a very large MySQL table.
Stack:
.NET (Dapper)
MySQL
API endpoint returns both paged items and totalCount in one response.
Table:
campaign (~70M+ rows)
...
Advice
0
votes
4
replies
163
views
Mandelbrot optimization
I am trying to optimize a Mandelbrot-like computation in C++.
The important difference from the usual Mandelbrot set is that the exponent is not fixed to 2.0. It is read from input and can be values ...
Tooling
0
votes
3
replies
85
views
Deeply nested JavaScript blocking main-thread on mobile view but passing on desktop
My website loads within 1.5 seconds on Desktop, but Lighthouse reports a 6-second Time to Interactive (TTI) on mobile due to "Reduce unused JavaScript" and main-thread blocking.
I have ...
Score of 1
1 answer
166 views
How do I stop transform.rotate() from tanking my FPS?
I have been working on a top-down game where, instead of the player character facing the mouse, the map is rotated around the player. The direction of the map is modified by mouse movement, the player ...
Best practices
2
votes
8
replies
137
views
Optimization and performance of multiple array iterations for WooCommerce role-based discounts
I have a WooCommerce discount system that calculates fees based on product categories (box sizes) for a specific user role. The code is functional, but I am concerned about the execution cost of ...
Score of 3
1 answer
147 views
Implementing toy model as linear programming problem
I am trying to implement the following toy model as linear programming problem, and look forward to hearing whether I missed anything.
Consider the following toy model, with three factories A, B, and ...
Best practices
0
votes
16
replies
199
views
Counting continuous membership in SQL
I have a table containing for each months the ids of all people who where a member this months. Something like this
Month
MemberID
January
100
January
101
February
100
February
102
..
..
I would like ...
Score of 0
0 answers
170 views
How do I optimize VS Code library debug symbol loading?
As of today after updating my Ubuntu OS, VS Code takes forever to start debugging. It used to be only slow the first time you'd debug in the session, then the next time you'd debug it'd be faster. Now,...