39,941 questions
1
vote
2
answers
54
views
How do I optimize a view that potentially contains thousands of views?
I have a grid/tile view implemented like below:
struct Grid: View {
let size: Int
var body: some View {
LazyVStack(spacing: 0) {
ForEach(0..<size) { _ in row }
}...
0
votes
0
answers
50
views
Optimization Challenge in Hugging Face: Effcienntly Serving Muliple, Differently Sized LLMs on a Single Gpu with PyTorch [closed]
I am currently working on a Python based Gen AI project that requires the efficient deployment and serving of multiple LLMs specifically models with different parameter counts ( Llama-2 7B and Mistral ...
-3
votes
0
answers
56
views
Can we solve the following optimization problem by dynamic programming [closed]
Suppose we have an 𝑚*𝑛 grid, let 𝑖=0,...,𝑚−1 and 𝑗=0,...,𝑛−1. For each grid point we have an array 𝑆𝑖𝑗 of size 𝑁 that serves as local score function. We want to to find a way that assigns ...
Best practices
3
votes
5
replies
139
views
Fastest way to read 10M DB rows in Python?
I’m trying to efficiently read about 10 million rows (single column) from a database table in Python and I’m not sure if my current approach is reasonable or if I’m missing some optimizations.
...
Best practices
3
votes
4
replies
146
views
Will std::is_trivially_copyable_v be deprecated by std::is_trivially_relocatable_v since C++26?
The main use of std::is_trivially_copyable_v[1] is to determine if an object array copy/move can be safely and efficiently replaced by std::memcpy.
However, C++26 introduces std::...
1
vote
1
answer
75
views
Remove Cast on int fields on directQuery to 2 billion row fact when computing averages
Using Power BI directQuery to databricks SQL warehouse, I see the queries getting generated to compute an average have
SELECT
SUM(CAST(int_field AS DOUBLE)), COUNT(int_field)
FROM
fact
...
Best practices
0
votes
3
replies
58
views
Compare fingerprints with a set of 10*10^6 other audio fingerprints in postgres
So I have a function that I used to compare audio fingerprints with a few thousand audio fingerprints stored in a postgresql. What I did basically was:
def my_function(cur: Cursor, threshold: ...
Best practices
1
vote
2
replies
102
views
Loading a byte: Partial register stall for intel cpus (r8 vs r64)
My assembly program reads characters in a text file by loading them one by one in register 'al'. However I sometime need to use rax fully, and I think this causes a partial register stall. Now I think ...
1
vote
0
answers
58
views
Why does CVXPY keep failing in solving problems and remain feasible?
This is a convex problem and also conforms to the syntax rules of CVXPY. I have tried changing the solver (ECOS or SCS) and adjusting the experimental parameters, but all failed.
I'm using the CVXPY ...
Advice
1
vote
14
replies
250
views
Ordered array vs. hash map in c++ (100 elements)
I need help regarding a code I want to write in c++.
I want to develop a program that receives and visualizes CAN messages on a GUI. The messages in question are about 100 distinct ID's, so we're not ...
1
vote
0
answers
58
views
Vue/Nuxt app loads slowly on client side -- how can I identify and fix performance issues?
I’m working on a Vue/Nuxt project where my client reports that the website is slow — especially when loading a selection window and when fetching JSON data.
However, the slowness is not very ...
6
votes
0
answers
144
views
Optimized Assembly Generation for Unsigned Multiplication Leads to Unexpected Result for Cortex-M0+
I was experimenting with some fixed-point arithmetic on the Cortex-M0+ in Godbolt's compiler explorer and came across an interesting behaviour with respect to the optimisation of a multiplication ...
2
votes
0
answers
47
views
Why does a DELETE with a JOIN on partitioned columns in BigQuery cost more than dropping specific partitions?
I have a large BigQuery table, big_table, around 5 TB in size.
It is partitioned by the column partition_date, which has about 2000 distinct values.
I also have a smaller table, small_table, which ...
4
votes
1
answer
263
views
Why is Eigen C++ int matrix multiplication 10x slower than float multiplication (even slower than naive n^3 algorithm) when compiled with AVX512
I'm testing int matrix multiplication, but I found that it's extremely slow everywhere (python numpy using BLAS backend is also just as slow). Int matmul being slower than float matmul is ...
Advice
1
vote
5
replies
90
views
How to align a byte array transferred from Blazor to Typescript via interop to a multiple of 2 bytes?
[EDIT] Updated this question with actual working code.
(Note: This discussion talks about the way that the array interop works, which might be relevant.)
I'm trying to transfer an array of shorts to ...
4
votes
1
answer
109
views
Did MS-DOS software rely on memory offset wrapping, in practice?
With the Intel 8088's segment:offset model, code and data reads will stay in the active segment unless the segment is changed. For example, take this instruction:
ABCD:FFFF ADD AL,12
This ADD ...
0
votes
0
answers
54
views
DerivativesWarning:Design variables have no impact on the constraints or objective. Positive directional derivative for linesearch
Good afternoon!
I'm new to OpenMDAO and optimization.
I'm trying to set up a problem with mesh geometry parameterization for a structural (FEM) optimization task. I'm using TACS https://github.com/...
1
vote
1
answer
107
views
Hard reset gekko model to initial state
I am working on a simulation tool for a certain heat exchange system. I first design the system using a certain routine, and then assess it's off-design performance. For the off-design performance I ...
0
votes
1
answer
53
views
Wordpress hook that runs in the last and can help to find and control all registered and enqueued scripts
I need to find and dequeue script and style files from frontend of Wordpress single post, I need a robust and full proof hook which can find out all scripts which are loading on front end of the page, ...
-3
votes
1
answer
98
views
How does Google Fonts browser optimize their font preview experience? [closed]
Analysis of Google Fonts
Here is me scrolling through the Greek fonts
As you scroll, you'll see it progressively calls the css2 url like:
https://fonts.googleapis.com/css2?family=STIX%20Two%20Text%...
4
votes
1
answer
137
views
Is it possible to have GCC inline vectorized trig functions?
Cosine and sine are computed with Horner's method and a Chebyshev polynomial, e.g. a0 + x(a1 + x(a2 + ...))). The fused-multiply add instructions this generates form a dependency chain, meaning we can ...
0
votes
1
answer
48
views
Get Dual Bound of a QP with CPlex
When one wants to solve a convex Quadratic Problem in Cplex with a given time limit, how is it possible to get lower and upper bounds on the actual optimal value ?
The primal and dual objective value ...
2
votes
1
answer
94
views
implicit function fit, linear regression with x and y std
In order to solve a weigthed linear regression (with x and y weights), I converted the explicit to implicit expression.
We are given (xmean,xstd) , (ymean,ystd) each 1d of length n.
The error is given ...
-1
votes
2
answers
86
views
Optimizing ps1 Script that deletes files/folders [closed]
I have here code that recusively deletes all files/folder older than 7 days within a directory. The directory is fairly large last time I ran it took about 12 hours to finish. I know that getting ...
0
votes
0
answers
78
views
How to minimize passenger ride time in OR-Tools Vehicle Routing Problem for school bus?
I'm working on a Vehicle Routing Problem using Google OR-Tools where I want to minimize ride time for passengers as part of the optimization objective.
Context
AM routes: Pick up kids from houses → ...
1
vote
1
answer
116
views
How can I optimize my C# code for capturing a window to use as a texture in Godot?
Cobbling together code from various sources online I was able to create the following function that allows me to capture an image of a window on my desktop (Using Windows 11). I'm attempting to use ...
-2
votes
2
answers
147
views
Split N people in X constrained groups with Google Sheets
[EDIT]
Hi everyone,
I am looking for clues to work out a sorting formula with Sheets.
We are planning "teambuilding" school trips at our international college. I need to split a list of 200+ ...
0
votes
2
answers
146
views
How do gcc optimisations work under the hood?
This problem arose while I was writing a program to retrieve file sizes. I wanted to learn more about file management and other file related things, so I wrote a c++ program using the fstream and ...
0
votes
1
answer
30
views
platypus NSGA-II, Optimal input variable printing issue
I am running into a problem when trying to print the "best" decision variable values based on a certain case (that the one objective is less than 1). I am using the NSGA-II algorithm from ...
0
votes
0
answers
101
views
Optimizing a HTML/XML regular expression
I wish to remove part of an HTML email by regex-matching a start tag (<table>) and its respective end tag (</table>), and anchor them by specifying a unique string which must be positioned ...
0
votes
1
answer
68
views
manage Z-Order with Predictive Optimization in databricks
I want to understand how to manage Z-Order in Databricks when using Predictive Optimization (PO). According to the documentation:
"OPTIMIZE does not run ZORDER when executed with predictive ...
1
vote
3
answers
109
views
How to check search time limits efficiently in a C++ UCI chess engine?
I’m writing a chess engine in C++ that communicates via the UCI protocol, and I need an efficient way to check whether the allocated search time has been exceeded without adding too much overhead. The ...
0
votes
0
answers
35
views
How to dynamically load multiple TensorFlow Lite models in a Flutter app instead of bundling them?
I am building a Flutter app where I have to execute three separate TensorFlow Lite models on-device:
An embedding model
An action video detection model
A DistilGPT2 RAG model
Currently, I bundle all ...
2
votes
0
answers
115
views
JIRA Lexorank in depth
I'm researching about maintaining order in a list like JIRA, and I come across Jira Lexorank. I've already understood it's core concept, but there are 2 questions that I struggle to find the in depth ...
0
votes
1
answer
62
views
VRP modelling in Timefold for a fleet of electric vehicles with a maximum driving range and special trips to recharge
I am working on a Vehicle Routing Problem (VRP) where the fleet consists of electric vehicles. Apart from other properties in Timefold VRP example, vehicle class has:
1. A maximum driving range in ...
3
votes
1
answer
182
views
What is the fastest way to evaluate a cubic given 4 packed double coefficients in a YMM register?
I have a YMM register containing 4 packed double coefficients.
I want to compute the cubic equation that they represent as quickly as possible using SSE and AVX2 intrinsics. Throughput is most ...
1
vote
0
answers
64
views
performance optimization in NextJS
I have 10k+ lines of global CSS in a NextJS project. Does this affect the LCP, as in mobile? I have tried a lot of optimizations, like adding priority for LCP images, adding lazy loading for other ...
0
votes
1
answer
222
views
Efficiency difference between different ways of finding min & max in a Java list
I've found questions similar to this one, such as this but I haven't found one answering this exact question. I have a list of numbers and I want to iterate through them to find the minimum and ...
5
votes
1
answer
257
views
"Repacking" 64 to 40 bits in AVX2
I have an array of 64-bit words, which I need to compact by removing the most significant 24 bits of each 64-bit word. Essentially this code in pure C:
void repack1(uint8_t* out, uint64_t* in) {
...
2
votes
1
answer
163
views
How to enforce per-passenger maximum ride time as a soft constraint in OR-Tools VRP?
I’m working on a Vehicle Routing Problem using Google OR-Tools.
The context is that each “customer” (or passenger) has to be picked up and eventually delivered to a common destination (for example, a ...
1
vote
0
answers
32
views
How can you use GRASP to solve a bi-objective optimization problem (in assembly line balancing)?
My problem is:
I have to optimize my collaborative assembly line with solving a bi-objective optimization model using metaheuristics. We chose to start with GRASP.
The two objectives are to minimize ...
1
vote
0
answers
59
views
How to suspend the rendering thread in UE4?
The mobile platform I'm using in my current UE 4.27 project has low performance, so I'm considering whether I can pause the rendering thread and release the rendering resources in the scene when the ...
3
votes
2
answers
276
views
Why is manual (-ish) computation of log-sum-exp faster than NumPy/SciPy functions?
I’m working with a very large array and was surprised to find that manually computing the log of the sum of exponentials is actually faster than using the built-in functions for this task from SciPy (...
-4
votes
2
answers
102
views
Is there a better way to find matching endings in two strings? [closed]
I have this function, it's supposed to take two strings and return up until when their endings stop matching, so if you put in something like "brasileiro" and "engenheiro" it ...
-2
votes
2
answers
261
views
Is there a better way to keep ids in a vector sequential in C++?
I have a simple C++ program that manages as a todo list. The Todo, class contains a vector of Item to track each todo action and their id. The key constraint is that the ids must be kept strictly ...
0
votes
0
answers
110
views
How to make parallel within the parallel?
Right now I am running a model optimization to optimize one set of parameter for several sites (in total 47 sites, i.e. the cost function sum over these 47 results). Site computation is independent ...
3
votes
0
answers
257
views
Iterating over special semiprimes
For a project of mine related to prime counting, I am interested in iterating over special kind of semiprimes.
For a given n, I want to iterate over semiprimes k=pq with the following properties/...
0
votes
0
answers
95
views
Microsoft Solver Foundation giving wild result for a simple problem
I'm using Microsoft Solver Foundation to minimize chi-square between two distributions. Usually there are multiple peaks in each distribution but occasionally there is just one. I'm noticing in that ...
0
votes
3
answers
155
views
Efficient way to calculate score from a list of scoring criteria and select the highest scoring option
I'm looking for a general algorithm or approach to solving this type of problem (a name or some keywords, I don't know what to Google for). I have a list of options. All of them are valid, but some ...
0
votes
0
answers
39
views
GCC Optimization Within Same Architecture
In an Intel architecture the various families (Haswell, Ivybridge etc.) also have different models, i3, i5, i7 etc. Typically these models differ only in the size of the Cache(s) and the number of ...