Skip to main content
Filter by
Sorted by
Tagged with
1 vote
2 answers
54 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 } }...
Radioactive's user avatar
Best practices
3 votes
5 replies
139 views

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. ...
sandeep gajula's user avatar
0 votes
0 answers
50 views

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 ...
Amira Yassin's user avatar
-3 votes
0 answers
58 views

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 ...
Peter Wu's user avatar
  • 279
Best practices
3 votes
4 replies
146 views

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::...
xmllmx's user avatar
  • 44.6k
Advice
1 vote
14 replies
250 views

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 ...
Simone Sesana's user avatar
Best practices
1 vote
2 replies
102 views

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 ...
Kun Xiang's user avatar
1 vote
1 answer
75 views

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 ...
Nathan Jones's user avatar
4459 votes
56 answers
2.5m views

The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.? ...
Best practices
0 votes
3 replies
58 views

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: ...
d6u9d12e's user avatar
4 votes
1 answer
263 views

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 ...
Huy Le's user avatar
  • 1,989
1 vote
0 answers
58 views

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 ...
Lighting's user avatar
6 votes
0 answers
144 views

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 ...
Simon's user avatar
  • 664
Advice
1 vote
5 replies
90 views

[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 ...
Matthew Watson's user avatar
1 vote
0 answers
59 views

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 ...
Umar umar's user avatar
4 votes
1 answer
109 views

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 ...
calamari's user avatar
  • 415
2 votes
0 answers
47 views

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 ...
Alex Lipkin's user avatar
1753 votes
34 answers
947k views

Project Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With Python, sometimes the approaches are somewhat kludgey - i.e., ...
Chris Lawlor's user avatar
  • 49.5k
1 vote
3 answers
109 views

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 ...
Viliam Holly's user avatar
1616 votes
37 answers
335k views

I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer): I've done it the easy way, by using the built-in Math.sqrt() function, but ...
3413 votes
13 answers
523k views

Optimizing SQLite is tricky. Bulk-insert performance of a C application can vary from 85 inserts per second to over 96,000 inserts per second! Background: We are using SQLite as part of a desktop ...
958 votes
11 answers
188k views

I wrote these two solutions for Project Euler Q14, in assembly and in C++. They implement identical brute force approach for testing the Collatz conjecture. The assembly solution was assembled with: ...
rosghub's user avatar
  • 9,324
3 votes
3 answers
261 views

C++26 will introduce std::is_trivially_relocatable_v, and the proposal author states: Trivially copyable implies trivially relocatable. However, I think the statement might not always be true, ...
xmllmx's user avatar
  • 44.6k
4 votes
1 answer
137 views

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 ...
asdfldsfdfjjfddjf's user avatar
1 vote
1 answer
107 views

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 ...
user31649534's user avatar
570 votes
55 answers
220k views

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 sequence ...
telliott99's user avatar
  • 7,957
0 votes
2 answers
146 views

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 ...
Liam Verdon's user avatar
985 votes
24 answers
563k views

Most people with a degree in CS know what Big O stands for. It helps us to measure how well an algorithm scales. How do you calculate or approximate the complexity of your algorithms?
sven's user avatar
  • 18.4k
14 votes
3 answers
1k views

Assumption is that we have a dictionary containing exactly one key/value pair. Objective is to extract the only key. I can think of four ways to do this (there may be more). import timeit def func1(d):...
jackal's user avatar
  • 29.1k
2 votes
1 answer
94 views

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 ...
pas-calc's user avatar
  • 170
717 votes
40 answers
281k views

I have a Python script which takes as input a list of integers, which I need to work with four integers at a time. Unfortunately, I don't have control of the input, or I'd have it passed in as a list ...
Ben Blank's user avatar
  • 57k
5 votes
1 answer
257 views

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) { ...
swineone's user avatar
  • 3,000
-2 votes
2 answers
147 views

[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+ ...
peritus's user avatar
-3 votes
1 answer
98 views

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%...
Lance Pollard's user avatar
644 votes
34 answers
95k views

There are plenty of performance questions on this site already, but it occurs to me that almost all are very problem-specific and fairly narrow. And almost all repeat the advice to avoid premature ...
1 vote
1 answer
116 views

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 ...
ScribbleNicks's user avatar
0 votes
1 answer
222 views

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 ...
J-bob's user avatar
  • 9,194
25 votes
3 answers
1k views

Throughout the battle of P1144 vs P2786 to introduce trivial relocation optimisation for C++, one of the points P1144 has raised against P2786 is that polymorphic objects should not be trivially ...
yosemite's user avatar
  • 251
0 votes
1 answer
48 views

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 ...
user2485450's user avatar
0 votes
1 answer
53 views

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, ...
Raj's user avatar
  • 44
0 votes
0 answers
101 views

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 ...
Eniac's user avatar
  • 11
-2 votes
2 answers
261 views

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 ...
0ro2's user avatar
  • 1,040
678 votes
32 answers
690k views

What would be the most efficient way to compare two double or two float values? Simply doing this is not correct: bool CompareDoubles1 (double A, double B) { return A == B; } But something like: ...
Alex's user avatar
  • 6,821
3 votes
2 answers
276 views

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 (...
seh33's user avatar
  • 182
0 votes
1 answer
68 views

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 ...
Mohamed Mokhtar's user avatar
-1 votes
2 answers
86 views

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 ...
Tsogt's user avatar
  • 1
3 votes
1 answer
182 views

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 ...
Martin Brown's user avatar
  • 3,626
402 votes
44 answers
292k views

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....
jbochi's user avatar
  • 29.7k
1409 votes
8 answers
824k views

I keep seeing role attributes in some people's work. I use it too, but I'm not sure about its effect. For example: <header id="header" role="banner"> Header stuff in here ...
jeroen's user avatar
  • 14.2k
2 votes
0 answers
115 views

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 ...
nanh's user avatar
  • 51

1
2 3 4 5
799