102,766 questions
Advice
0
votes
0
replies
24
views
Why is FileReader as efficient as BufferedReader in reading 1KB chunks of data?
I was trying to read data (chars) from a large text file (~250MB) in 1KB chunks and was very surprised that reading that file using either FileReader or BufferedReader takes exactly the same time, ...
0
votes
1
answer
30
views
Why does heavy object cloning degrade JS performance even when using structuredClone compared to manual optimization?
In a high-performance Node.js service, I noticed that structuredClone() introduces unexpected latency spikes when cloning large nested objects (30–50 KB each). Even switching to manual cloning ...
0
votes
1
answer
127
views
SQL CLR function bad performance comparing to .NET App
In our system we are hashing passwords with the following method.
public static string HashPassword(string password, byte[] salt)
{
if (salt == null)
{
throw new ArgumentNullException($...
Advice
0
votes
2
replies
74
views
What prevents Javascript memory leaks in software applications?
I was thinking back to WinJS or WinUI with Windows Universal Applications (WUA) from about 10 years ago. I am wondering how it compiled and avoided typical architecture errors. If there is no memory ...
-6
votes
1
answer
161
views
How should I efficiently add all pairs in a key-value array to an object?
I have an object obj; and I then obtain an array arr of key-value pairs. Assuming that the key sets of obj and of arr are disjoint (i.e. no key appears in both) - how do I efficiently add all pairs in ...
-1
votes
0
answers
28
views
Solr 9.9.0 getting slow when there is high load
I'm using Solr 9.9.0 and I recently increased the server RAM from 16 GB to 32 GB, as well as the JVM heap memory to 16 GB. The issue I'm facing is that under high load, both the Solr 9.9.0 UI ...
Advice
0
votes
1
replies
50
views
Does the way a program is written/formatted affect how fast and large it is at compile time?
We all know that there's no wrong way to write code, and infinite possible ways to complete a task. Everyone codes differently.
There are of course many ways to shorthand code, so the same code can be ...
0
votes
0
answers
21
views
How to set alerts on time correlation between logs on datadog?
For example, we have multiple logs that share the same structure:
Order Created { ..."trace": { "order_id":123456, ... }}
Order Paid { ..."trace": { "order_id":...
-1
votes
0
answers
160
views
Inserting rows into table with geometry column creating awful execution plan [closed]
I am seeding a database by copying over data from another database on the same server. In one of the tables, I am doing an INSERT INTO SELECT statement to bring over a few columns. While existing and ...
3
votes
0
answers
150
views
The cost of non contiguous reads and writes (naive matrix transpose, power-of-2 and other sizes)
I was benchmarking a naive transposition and noticed a very large performance discrepancy in performance between:
a naive operation where we read data contiguously and write with a large stride;
the ...
3
votes
0
answers
135
views
Why polars join function performance deteriorates so much from version 1.30.0 to 1.31.0?
I noticed a significant performance deterioration when using polars dataframe join function after upgrading polars from 1.30.0 to 1.31.0. The code snippet is below:
import polars as pl
import time
...
0
votes
0
answers
50
views
Parallel Equations Expansion in TFORM
TFORM is considered a great tool for manipulating large and symbolic equations. In this thread, I’d like to share my optimization problem, which concerns a very simple operation — equations expansion.
...
7
votes
1
answer
132
views
Why are prototype extensions so much slower than functions?
I compared the speed of normal JavaScript functions and prototype extensions.
function NormalizeSpace(str)
{
return str.trim().replace(/\s+/g, " ");
}
String.prototype.NormalizeSpace = function ()
...
3
votes
3
answers
232
views
Performance issues with reading lines from *standard-input*
I need to process 100 Gigabytes of logs in a weird format, then do some analysis on the results.
Initial parts of parsing and CLI done, tried on some test data with 1 GB and it took around a minute. I ...
2190
votes
42
answers
3.1m
views
How do I measure elapsed time in Python?
I want to measure the time it took to execute a function. I couldn't get timeit to work:
import timeit
start = timeit.timeit()
print("hello")
end = timeit.timeit()
print(end - start)
-5
votes
1
answer
213
views
Scalar product C++ vs Python
I'm writing code that must perform a dot product between a vector b and a matrix C, where the dot is performed between b and each line of C.
I made two implementation, one in C++ and one in Python. ...
Best practices
0
votes
0
replies
42
views
Why does my Next.js app’s performance drop significantly when using dynamic routes with large datasets and server-side rendering (SSR)?
I'm working on a Next.js 14 app with several dynamic routes (e.g., /product/[id]) that render product details from a large dataset (around 50k+ records) stored in PostgreSQL.
I'm using ...
0
votes
0
answers
147
views
Generation of array that will represent the best case for a quick sort?
I have implemented the quicksort algorithm using the last element as the pivot. Now I want to generate an array for the best-case scenario. This is the function that I wrote, but I am not sure that it ...
0
votes
2
answers
72
views
Create an open delegate via MethodInfo of a Value Type instance method with out parameters
I have an instance of ReadOnlyMemory<byte> over a byte[] that I need to convert to ArraySegment<byte>. I'm doing this as part of a major code refactor, and I'm having to adapt an existing ...
3068
votes
12
answers
378k
views
Why is "1000000000000000 in range(1000000000000001)" so fast in Python 3?
It is my understanding that the range() function, which is actually an object type in Python 3, generates its contents on the fly, similar to a generator.
This being the case, I would have expected ...
0
votes
1
answer
44
views
AVR 8-bit: Reusability vs. Efficiency?
My implementation of an API function doing a simple SPI transfer, offering a void *intfPtr parameter to pass a "device descriptor" which I am using to pass the I/O port and pin for SPI chip ...
-2
votes
1
answer
81
views
What means the key in the declaration of a STANDARD internal table?
I see in many existing ABAP programs that standard internal tables are declared without key fields, for instance:
TYPES type_itab TYPE STANDARD TABLE OF sflight WITH DEFAULT KEY.
DATA itab_0 TYPE ...
1753
votes
34
answers
946k
views
How do I profile a Python script?
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., ...
-4
votes
1
answer
62
views
How to precompute nested date ranges efficiently to optimize range filtering and pagination? [closed]
📝 Body
I have a Mongo collection CollectionA where each top-level object contains a nested array of meetings now each meetings have start and end times, for example:
CollectionA = [
{
&...
0
votes
1
answer
192
views
Does source length of SQL functions matter
First, to define what I'm talking about, the "length" of a source is how many characters it has. Having more characters allows improving readability by using more descriptive function and ...