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
25 questions with no upvoted or accepted answers
4
votes
0
answers
431
views
Solar System simulation with real values in pygame
Inspired by TechWithTim, I built up the solar system including Pluto. I have added a camera feature, zoom feature and displaying information about the selected planet.
Zoom in and out using arrow keys,...
4
votes
0
answers
110
views
Reduce size of minesweeper program to fit in qr code
I saw a guy who fit snake in a qr code and I wanted to do the same thing but with minesweeper. The maximum amount of data a qr code can hold is 3kb. My c program, without any compiler magic, takes up ...
4
votes
0
answers
853
views
Kadane's algorithms to leetcode "121 Best Time to Buy and Sell Stock"
I employed the conventional Kadane's algorithms to solve a maximum subarray problem in leetcode Best Time to Buy and Sell Stock - LeetCode
Description
Best Time to Buy and Sell Stock
...
4
votes
0
answers
497
views
Two solutions to leetcode 127.wordLadder
I am working on Word Ladder - LeetCode
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such ...
4
votes
0
answers
437
views
Cleaning up memory after loading Access DB into a datagrid
I wrote an app that pulls a MS Access DB into a DataTable and then displays it into a WPF datagrid. The dialog window has a search button which calls on a class ...
4
votes
0
answers
1k
views
Memory optimization when finding the Cartesian product in Python
My function gets the Cartesian product of a list of lists of tuples. The function is correctly producing the list of lists, but it's a memory hog (and leads to a MemoryError for large data sets, with ...
3
votes
0
answers
309
views
screen recording application
I'm developing a screen recording application using java. I've modified code from https://dzone.com/articles/screen-record-play-using-java where all the external jars required for this application are ...
3
votes
0
answers
195
views
Memcpy function optimzation
Here is my memcpy algorithm I've been working on:
...
3
votes
0
answers
165
views
Custom allocator for improved cache locality and fast iteration in C++
I am writing a custom allocator for my educational game engine project where I need to iterate through a collection of components(similar to Unity3D) every frame. There are game objects and every game ...
3
votes
0
answers
65
views
Batch normalization code optimization?
I am trying to implement Deep Quaternion Networks. I was able to implement the batch normalization technique. But it requires a lot of GPU memory. Is there any way I can optimize the code provided ...
3
votes
0
answers
72
views
Minimization problem solving and its step limits
I am trying to solve the following minimization problem:
$$
\min\lvert\lvert{x}\rvert\rvert_1 + \beta\lvert\lvert{x}\rvert\rvert^2_2 s.t. \sum_{m = 1}^M (y - \lvert{c}^{H} . x\rvert^2)^2 \le \epsilon
...
3
votes
0
answers
513
views
Pandas data extraction task taking too much memory. How to optimize for memory usage?
I need to process some data (one of its columns contains a json/dict with params- I need to extract those params to individual columns of their own; catch- some rows have some parameters, others have ...
3
votes
0
answers
647
views
Populate MongoDB with random documents using a Go channel
I recently created a small app in Go that generates random bson documents and insert them in a database (MongoDB). See this question
for details.
After doing some profiling, I realised that garbage ...
3
votes
0
answers
33
views
URLEncoder implementation Round 2
Half an year ago I posted an implementation of a URL encoder for review. I didn't have any time to work on it until recently, but now looking at my old code with new eyes I saw how unreadable the code ...
3
votes
0
answers
55
views
LinkedList of Nodes at each level - optimalization
That's already known problem: to return an array of linked lists that contain values of elements at each level. Eg for tree with depth n there should be n linked lists.
I wrote the solution:
...
2
votes
0
answers
109
views
Dynamic heterogeneous container
I want to have dynamic continuous block of memory for different types, that inherit from single base class. I've written structure for that purpose. I know I play with a fire here, but I would like to ...
2
votes
0
answers
1k
views
C# class to dump the memory of a process in several formats
I made this because I couldn't find any good C# classes/libraries that allow you to dump the contents of a process' memory into a file or a byte array. I haven't tested this on 32 bit systems but it ...
2
votes
0
answers
284
views
Split a string into valid words
I am trying to solve this LeetCode question:
Given a non-empty string s and a dictionary wordDict containing a list
of non-empty words, add spaces in s to construct a sentence where each
word ...
2
votes
0
answers
306
views
Initializing Reinforcement Learning Q-Table State Space-Python
The code below is a "World" class method that initializes a Q-Table for use in the SARSA and Q-Learning algorithms.
Without going into too much detail, the world has "Pickups" and "Dropoffs" that can ...
2
votes
0
answers
513
views
Partial file encryption with AES
Task is to encrypt part of the file using aes encryption algorithm. I did
...
2
votes
0
answers
573
views
"Partial solution" on Code Eval for Clojure FizzBuzz
I'm just getting started on the site CodeEval, and I submitted my first solution today. What I don't understand is why it's marking my (working) answer as only a "partial solution". The site doesn't ...
1
vote
0
answers
28
views
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 ...
1
vote
0
answers
701
views
Sticky notes in a Virtual JDesktop
I made a very practical program consisting of a virtual desktop with a right-click pop-up menu that brings up a button to open a 'stikinote.' These 'stikies' are simply little note-windows where text ...
0
votes
0
answers
74
views
PHP SCRIPT OPTIMIZATION OF METHODS
Here is some php code which i think is optimized but still want to optimize it more but not sure how to do it.
...
-2
votes
1
answer
107
views
Default food property wording when translation not available
I have food table having number of foods, each food can have specific properties in multiple languages (en, es) like name, description etc. But it is not sure if all of the properties are always ...