Optimization is the act of improving a method or design. Optimization usually takes the form of improving the efficiency of an algorithm, or reducing the resources it requires (space in memory, on disk, or amount of network traffic, etc.).

learn more… | top users | synonyms (2)

0
votes
0answers
2 views

How to execute a task at a particular time in the morning using ScheduledExecutorService?

I have a task which I need to run every 6 AM in the morning. I have my below code which does the job and it is using ScheduledExecutorService. ...
3
votes
1answer
32 views

Solving a one-dimensional Euler equation for fluid dynamics

I just wrote a program to solve one dimensional Euler equation for fluid dynamics. Attached is a snippet of the vtune profile result for one of the function. There are a few things which looks weird ...
0
votes
2answers
106 views
0
votes
0answers
24 views

Detect image in viewpoint of browser window then show image

I am working on a web project and am trying to create a way to detect when an image is in viewpoint of the browser window then load/show the image. Since there are some rather large image that are ...
3
votes
1answer
50 views

Deserialize an email header into key-value pairs

I've created a function that will deserialize an email header into a list of key-value pairs. I've run numerous tests using MS Office Outlook 2010 and MS Office 14.0 Object Library, all of which were ...
5
votes
3answers
656 views

Efficiently generating HTML CSS table using Java

I am trying to generate an HTML table using Java. I have an object which I am iterating to make an HTML table. ...
1
vote
1answer
32 views

Finding the largest repeating substring

Here's my code that takes a large string, and searches for the longest reoccurring substring. It compares the first letter with every other until it finds a match, then saves it. Then it compares the ...
5
votes
5answers
553 views

Simple text DataBase

So I made this simple text database system for storing a list of objects because I hate using other database programs. But I was just wondering what you guys think I could do to make this faster and ...
5
votes
1answer
64 views

Horridly Inefficient Project Euler #14 in Python - Collatz Sequences

I created this solution a while ago, and have been going back over my problems to try to make them all more efficient. I have been stuck on this one, and have tried a few different ideas. So far, my ...
2
votes
1answer
37 views

How to send an email every half an hour if certain condition is met during that period?

I have my below method which will be called every one minute from the background thread. In my below code, if my unauthorizedCount and ...
3
votes
1answer
52 views

Authentication cookie handler class improvements

I just finished the following application service class that handles all my HTTP cookie authentication processes. It is the best I could come up with. Although I don't think I'm violating the SRP, ...
1
vote
2answers
67 views

Optimized code for class derived from List

I need a best optimized code for the below class to increase the performance of searching data. ...
1
vote
1answer
34 views

HeapSort Efficiency

For heap (array based) sort, we need to start at index 1, ignoring the 0th index. If I want to make a static function like ...
2
votes
1answer
54 views

Autocomplete Trie Optimization

I'm currently playing with the Typeahead problem on Talentbuddy. There are already 2 questions on this subject (Typeahead Talent Buddy and Typeahead autocomplete functionality challenge), but none of ...
4
votes
3answers
109 views

Squaring all integers in an array [closed]

I have a function that takes array and replaces all integer elements with their square: ...
3
votes
1answer
51 views

Optimizing gulpfile.js

I'm fairly new to JavaScript and Gulp. I was following this article for creating my gulpfile, trying to follow best practices, but it seems to me that this peace of code can be optimized and written ...
5
votes
1answer
76 views

Lightweight Tic-Tac-Toe in Python

This is a completely functional python script of the Tic-Tac-Toe game. I've used python's set container for almost all data structure and operation. The code is ...
1
vote
1answer
88 views

Reduce CPU usage in mouse-scrolling script

I'm working on a jQuery plugin. The problem is that when I use it I can see a high CPU usage in task manager. I think the problem is here: ...
3
votes
3answers
137 views

Merge Sort - Efficiency

I've written this Java code to implement Merge Sort. ...
1
vote
0answers
17 views

XML data-parsing design that doesn't sacrifice efficiency [closed]

I have the following method signature ...
5
votes
1answer
90 views

Optimizing FirstOrDefault

I'm working on an application in which it takes quite a bit of time to initialize the data. Some background: I'm creating a sort of pivot table in which I turn Figure 1 below into Figure 2. I've ...
3
votes
1answer
45 views

Python small brute-forcer

I have 20+ key set. Keyset is like: Key[0] = { "PossibleKey0", "PossibleKey0Another", "AnotherPossibleKey0" } Key[1] = { .... There is an encryption which needs ...
2
votes
1answer
79 views

Any improvements for my LoginController class?

This is probably going to be my final question regarding controllers. I feel like I have a good enough understanding of them now and am able to write them cleanly. I've recently adapted a less error ...
4
votes
1answer
35 views

Optimization of Barnes-Hut Multithread Insertion algorithm

I'm currently working on optimizing a Barnes-Hut implementation (connected to a previous post I did) and I need help to optimize it further. After some testing, the main problem appears to be in the ...
2
votes
1answer
29 views

Time complexity of 0/1 Knapsack challenge

The code gives correct output. How do I calculate time complexity for code like this? The program finds all the combinations of items and sees if the combination gives the max profit. If the last ...
5
votes
0answers
109 views

Is my LoginView class valid?

I know the Model, Controller and View's purpose, but I have never really found a good concrete class example of a View class. Usually I see people having some small ...
3
votes
2answers
71 views

Answer to an implementation of Project Euler #8

I saw that there was a previous question asking to review an answer to the Project Euler question #8. My answer didn't look anything like the answer in that question and as a beginner, I was wondering ...
4
votes
1answer
71 views

Is this algorithm efficient for the 01Knapsack?

This code uses recursion to solve the 01Knapsack problem. It evaluates all the item permutations that can be added to the knapsack and checks if it gives the maximum profit. What else could have been ...
1
vote
0answers
24 views

Extracting country data from HTML tables

I am trying to optimize/improve my coding skills in python The rationale behind this code is to extract some data from files and store them in a dictionary. I tried to comments lines to improve ...
6
votes
3answers
286 views

Leaving out the max value in an Enumeration

This is part of a school assignment and I came up with the following solution to leave out the max value in a Enumeration: ...
4
votes
2answers
110 views
+50

Ugly optimized caching of SimpleDateFormat

Concerning the optimization of this simple function String formatDate(String format, Locale locale, Date date) {...} formatting a ...
2
votes
2answers
70 views

How to efficiently use RestTemplate with HttpComponentsClientHttpRequestFactory in multithreaded environment?

I am working on a project in which I need to make a HTTP URL call to my server which is running Restful Service which returns back the response as a JSON String. I ...
1
vote
0answers
30 views

Lightweight tabulation written in Python

I wrote this module in python for some minor tabulation needs in my science projects. This was very helpful for testing, debugging and plotting various data. I often use dictionaries for storing such ...
1
vote
1answer
51 views

Efficiently use RestTemplate for http request timeout?

I am using RestTemplate to make an Http call to one of my service and I would like to have timeout for my Http Request - ...
4
votes
2answers
132 views

IMDB website query to find actors by time period

I'm using data from a database from the IMDB website. The database consists of five relevant tables. Actor (id, fname, lname, gender) Movie (id, name, year, rank) Director (id, fname, lname) Cast ...
5
votes
1answer
339 views

Summing two time periods using JodaTime

I'm building a Java method to sum arithmetically two time periods, using the JodaTime library. My code works fine, but I think that it's possible optimize to reduce the time execution. ...
11
votes
2answers
130 views

CSV reader using StreamReader and LINQ

Mostly due to readability, I am using the following code to find a specific csv file on a drive read that CSV file using a streamReader parse it into a ...
12
votes
8answers
1k views

Increase difficulty based on score

What I'm trying to do is very straightforward and easy, but I am wondering whether there is a more elegant solution. Basically I have a game and I want the difficulty to increase the moment the ...
-1
votes
0answers
46 views

Optimizing searching and comparisons [closed]

There are big words, small words and "rarity" of the small wards. I have to find for each small word that big words, which starts with this small word. And take 10 of them with top rarity. I ...
5
votes
1answer
82 views

Producing the intersection of several sequences

Based on this SO answer I have created a method that produce the set intersection of several sequences: ...
4
votes
2answers
114 views

Serializing data from two URLs in the same object efficiently

This is a follow-up to: Serializing JSON data coming from two URLs in the same object I have two URLs (urlA and urlB) and they ...
2
votes
0answers
30 views

Careful simulation of a 3D space [closed]

What is an accurate computer-description of space? I've been building up my abilities with various population simulations, and I'd like to add a spacial element to them now. I'm self-taught with ...
1
vote
1answer
64 views

Spreading the load more evenly from a background thread

I have a background thread which runs every 5 minutes. I am using ScheduledExecutorService for this. Every five minutes, I am making a call to one of my service and ...
7
votes
3answers
249 views

Having full atomicity against all the threads without impacting performance or throughputs

I am working on a project in which I construct a URL with a valid hostname (but not a blocked hostname) and then execute that URL using RestTemplate from my main ...
6
votes
1answer
58 views

Implementation of Tower of Hanoi iterative procedure

I have been working last night on implementing Tower of Hanoi without using recursion. I have found an algorithm on Wikipedia about the same topic here. I have implemented it and it's working fine ...
2
votes
2answers
83 views

Filtering by value X from array Y with a fallback

I wrote a function that solve a special problem. But one of my 'special hardcore software engineers' told me that this is a bad solution - but he will not give me a better solution. So I ask you: What ...
1
vote
0answers
39 views

Efficient C Code Alternative to MATLAB's im2col

The function im2col in MATLAB is very useful to vectorize Patch based Image Processing algorithms. The problem is the function isn't optimized and doesn't use C ...
11
votes
1answer
156 views

Making loop in CSS Stylus more efficient

I'm not sure if this could be more efficient because I don't think I should need 2 keyframe loops in addition to the for loop? ...
3
votes
1answer
125 views

Interview task to efficiently find compact representation of nodes in tree and find big O time

I recently had an interview problem where I was asked to find a compact representation of nodes in a tree. As an example, consider the following tree: ...
4
votes
2answers
43 views

Batch file-download script - is it necessary to re-phrase commands?

I run a script to download a file and unzip it. An import process then runs and leaves the files in their source location. I wrote the fully functioning code below to clean up that directory to be ...