Questions tagged [memory-optimization]
Memory Optimization is a subset of Optimization: it is the goal of reducing the memory consumption (the amount of memory used during compile or run time) of your program or of a specific algorithm
241 questions
5votes
2answers
175views
LeetCode Number 416: Partition Equal Subset Sum
Problem: MLE I am confused as to why the LeetCode judge reports Memory Limit Exceeded when my solution looks close to the editorial solution. I not too familiar with ...
7votes
1answer
206views
Robin Hood Hash Table
The following code comes from an intrusive container library I am working on in C23. So far, it works correctly due to extensive testing and sample programs I have written with it. I have implemented ...
3votes
2answers
128views
Running yolov to detect class on many files in-memory accumulate RAM on Google Colab T4 GPU
I have thousands of files and I am detecting with YOLOV some classes on them with my own model file. My files are inside a zip file. I must usually extracting json files which have vector data, then ...
8votes
2answers
196views
Leetcode 93: Restore IP Addresses (C version)
This is posted in response to this request made in a discussion of my "C-ish" answer to a recent Code Review question regarding a Python solution to a Leetcode challenge. It was reported ...
11votes
4answers
2kviews
Leetcode 93: Restore IP Addresses
(Source: Leetcode 93: Restore IP Addresses [Medium])(Topics: [String] [Backtracking]) The problem is as follows: Definition: A valid IP address is defined to consist of exactly four integers ...
5votes
4answers
1kviews
Custom Iterator for Processing Large Files
I frequently work with large files and implemented a custom iterator to process these files efficiently while minimizing memory usage. The iterator reads each line from a file, parses it into a ...
1vote
0answers
34views
Optimizing MJPEG stream handling in Service Worker
Background: I'm implementing a small react app in which an MJPEG stream transmitted by HTTPS is displayed. The stream is only accessible if the user is authorized (using Basic Auth). Therefore, I can ...
5votes
1answer
194views
Memory-optimizing arduino code to be able to print all files from SD card
I started an Arduino project that could execute instructions from an SD card file on the screen. I managed to do it, but another problem appeared: I can't print all the files from the SD card to the ...
3votes
1answer
89views
Check which sinks are connected in the pipe system using Python
It would be very helpful to me as a beginner if I could get feedback on my code, specifically about the efficiency of algorithm used and potential improvements in code quality. Code context: There is ...
5votes
3answers
231views
HackerRank, Haskell simple "compression" algorithm
The question asked is very straight-forward and is simple enough to solve. What I am looking for is that hopefully I can get some understanding for using the constructs and built-ins of the Haskell ...
4votes
2answers
66views
Optimizing a Function to Generate a Row of Consecutive Odd Numbers in a Triangle
I've written a JavaScript function that generates a row of consecutive odd numbers in a triangle. The triangle looks like this: ...
2votes
1answer
98views
Generic container wrapper type with a default underlying buffer (2nd rev)
This is a revision of the previous question. I was told to ask an additional question with more context for the modified code to be reviewed. The changes: changed from ...
3votes
1answer
84views
Autocompletion trie for English words in zig
I am trying to write a program that creates a Trie from a list of all English words, and then when run provides completions for a given prefix. Basically for each node I allocate a list of 255 null ...
5votes
4answers
1kviews
Optimized Python Solution for Determining if an Array Contains All Possibilities
Problem: You have been tasked with writing a method named is_all_possibilities (or IsAllPossibilities, as per your preference) ...
3votes
1answer
57views
A collection based on a bitset to store a set of unique integers from a given range (rev. 3)
All right, let's do this one last time. This is continuation of this review. I applied most of the proposed changes, making interface of my container very close to that of ...