optimization Questions
1
Solved
I've been working on a decompiler (for Glulx) which produces C code. In one mode it outputs all of the code in one switch statement (switching on the program counter). A medium sized input file pro...
Puppet asked 3/5, 2021 at 5:19
1
I've been looking for some guidelines regarding the optimal value of opcache.jit_buffer_size. The proposed values are up to 256M (e.g. https://php.watch/versions/8.0/JIT#jit-opcache.jit_buffer_size...
Redhot asked 1/3, 2023 at 23:19
1
Solved
GCC 14 introduced a new -Wnrvo flag:
New -Wnrvo warning, to warn if the named return value optimization is not performed although it is allowed by [class.copy.elision]. See the manual for more inf...
Mesothelium asked 13/5, 2024 at 8:52
5
I am trying to update a large table (about 1M rows) with the count of words in a field on Postgresql.
This query works, and sets the token_count field counting the words (tokens) in longtext in tab...
Bruce asked 19/6, 2013 at 17:50
12
Solved
I would like to ask what you think is the best way (lasts less / consumes less resources) to clear the contents in order to reuse a StringBuilder. Imagine the following scenario:
StringBuilder sb ...
Serafinaserafine asked 10/11, 2009 at 16:55
1
Solved
I encountered a problem where g++ optimized out something it should not have. I reduced the problem to the following example:
I have a static lib with a function bool my_magic_function(int* x), whi...
Trilemma asked 3/5, 2024 at 11:5
10
I'm developing a game for Android. It uses a surface view and uses the sort of standard 2D drawing APIs provided. When I first released the game, I was doing all sorts of daft things like re-drawin...
Olva asked 25/2, 2011 at 23:55
20
I'm looking to optimize this linear search:
static int
linear (const int *arr, int n, int key)
{
int i = 0;
while (i < n) {
if (arr [i] >= key)
break;
++i;
}
return i;
}
The array i...
Rubirubia asked 30/4, 2010 at 1:50
4
Solved
I have identified one pandas command
timeseries.loc[z, x] = y
to be responsible for most of the time spent in an iteration. And now I am looking for better approaches to accelerate it. The loop...
Nonmaterial asked 10/6, 2016 at 22:14
5
Solved
I have a heavily optimized JavaScript app, a highly interactive graph editor. I now started profiling it (using Chrome dev-tools) with massive amounts of data (thousands of shapes in the graph), an...
Jammie asked 24/1, 2017 at 14:19
5
Solved
I'm working on a vertex shader in which I want to conditionally drop some vertices:
float visible = texture(VisibleTexture, index).x;
if (visible > threshold)
gl_Vertex.z = 9999; // send out o...
Treen asked 6/2, 2011 at 3:40
11
Solved
This is rather the inverse of What can you use Python generator functions for?: python generators, generator expressions, and the itertools module are some of my favorite features of python these d...
Sauterne asked 29/10, 2008 at 4:25
3
I am not very sure whether it is better suited here or on ServerFault, so please feel free to move it, if needed. I just posted it here because I think it is highly relevant to PHP programm...
Gaullism asked 12/4, 2014 at 10:53
4
Solved
I am looking to optimise some SSE code I wrote for converting YUV to RGB (both planar and packed YUV functions).
I am using SSSE3 at the moment, but if there are useful functions from later SSE ve...
Arman asked 31/12, 2010 at 22:20
22
Solved
Fastest implementation of sine, cosine and square root in C++ (doesn't need to be much accurate)
I am googling the question for past hour, but there are only points to Taylor Series or some sample code that is either too slow or does not compile at all. Well, most answer I've found over Google...
Lukas asked 6/9, 2013 at 16:20
34
If I have some integer n, and I want to know the position of the most significant bit (that is, if the least significant bit is on the right, I want to know the position of the farthest left bit th...
Oleg asked 22/3, 2009 at 23:37
7
Solved
Is there a way to profile Vim plugins?
My MacVim becomes slower and slower when I open a large .py. I know I could deselect all plugins and reselect one by one to check which plugin is the culprit...
Sarcastic asked 31/8, 2012 at 10:33
3
Solved
Given a NxN integer lattice, I want to find the clipped circle which maximizes the sum of its interior lattice point values.
Each lattice point (i,j) has a value V(i,j) and are stored in the follow...
Tonus asked 10/3, 2024 at 17:45
41
Solved
This is the best algorithm I could come up.
def get_primes(n):
numbers = set(range(n, 1, -1))
primes = []
while numbers:
p = numbers.pop()
primes.append(p)
numbers.difference_update(set(rang...
Georgiageorgian asked 14/1, 2010 at 23:40
9
Solved
In JavaScript, you can use Lazy Function Definitions to optimize the 2nd - Nth call to a function by performing the expensive one-time operations only on the first call to the function.
I'd like t...
Journeywork asked 23/9, 2008 at 1:49
8
Solved
I've a database used to store items and properties about these items. The number of properties is extensible, thus there is a join table to store each property associated to an item value.
CREATE ...
Wellbeloved asked 24/5, 2010 at 18:9
14
Solved
I'd like to understand better why choose int over unsigned?
Personally, I've never liked signed values unless there is a valid reason for them. e.g. count of items in an array, or length of a stri...
Swayback asked 13/9, 2013 at 21:21
53
Solved
Yes, I know this subject has been covered before:
Python idiom to chain (flatten) an infinite iterable of finite iterables?
Flattening a shallow list in Python
Comprehension for flattening a seque...
Dentation asked 28/1, 2010 at 22:15
12
Solved
Write a branchless function that returns 0, 1, or 2 if the difference between two signed integers is zero, negative, or positive.
Here's a version with branching:
int Compare(int x, int y)
{
int...
Sanatory asked 23/10, 2009 at 0:38
1
I'm reading a C++ function that handles timestamps, and there's an expression like this:
t % (60 * 60) % 60
I thought this expression was strictly equivalent to:
t % 60
However, when I entered th...
Ragsdale asked 4/3, 2024 at 15:14
© 2022 - 2025 — McMap. All rights reserved.