2
votes
0answers
50 views

Python: How do I optimize the solving of ODEs?

I have been trying to figure out a way to optimize the solving of ODEs in Python but haven't been able to achieve this goal. I tried getting help via a bounty on SO using cython but nothing came of ...
1
vote
2answers
83 views

Email report generation from database

I have written a small batch job which will collect data from db and send mail to user. Can you please do a review of the code with design prinicples in mind and also with best practices for Db and ...
4
votes
2answers
184 views

How can I memoize or otherwise optimize this code?

The code checks many more conditions like the one below. I was thinking to memoize it, but I can't think about how (writers block). How else could I optimize this? I know it seems silly, but my code ...
3
votes
2answers
117 views

Optimizing unboxed array operations in Haskell

Consider this simplified code which successively permutes array elements: import Data.Word import Data.Bits import Data.Array.Unboxed import Data.Array.Base import Data.Array.ST test3 :: UArray Int ...
1
vote
0answers
39 views

How to make this more efficient

I have a fitness function where inputs x1 to x14 have values between 1:4. Is there a way to make to more efficient, any suggestions are useful please. I need to get the computation time down. A ...
0
votes
1answer
55 views

Optimization: Eliminate conditional expression within common code

Background The following code (part of a natural language processor) was written to eliminate duplicate code by using isLeft as a conditional throughout the method: private void ...
3
votes
1answer
178 views

Fastest way to delete a large folder using JAVA

I am trying to delete a large folders (with many levels of subfolders) over a network (i.e, on a remote machine. I have the following code and it takes 10 minutes. Is there a way to improve this, ...
0
votes
0answers
50 views

Not sure if I missed some obvious CPU brakes

I have three functions (out of a medium 2 digit number of functions) which use up 80% of CPU time, so I kind of wonder if there are points for optimization that I am missing. Function 1, Extracting a ...
3
votes
3answers
170 views

Optimization Of Code With Runtime of 150Hours

XPost from Stackoverflow questions as Nicholas Pickering kindly referred me to this. I've been working on a project where I am importing a large document of documents and tokenizing each document. I ...
2
votes
1answer
46 views

python Improve a function in a elegant way

I have a grid as >>> data = np.zeros((3, 5)) >>> data array([[ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.]] i wrote a function in ...
3
votes
1answer
68 views

Optimize jQuery Iteration

I have a list of elements (well, nested lists of elements, really) that the user can reorder (using jQuery sortable()). A simplified view of the structure is something like: <div ...
0
votes
2answers
73 views

How to optimize this?

This is a user Javascript for youtube, the point is to make the thumbnail bigger on mouseover, I just want some help making it better because I don't want it to waste resources with all the extensions ...
3
votes
2answers
465 views

How can I improve the performance of this code?

I was solving the Find the Min problem on facebook hackercup. The code below works fine for the sample inputs given there, but for input size as big as 10^9 this takes hours to return the solution. ...
1
vote
0answers
84 views

Sudoku Valid Arangements Permutations Enumerator

I wondered if anyone has any ideas to make this cleaner or more efficient. Mostly this was an exercise to generate the data once (So speed really isn't too important, but I'd love to see what ...
1
vote
1answer
103 views

Initialize a bunch of NSDateComponents objects at once (in a loop)?

I'm developing an iPhone app that is heavily Calendar-based, and it requires a good amount of (what I'm calling) "date boundaries." I use these "date boundaries" to fetch EKEvents from specific ...
8
votes
3answers
268 views

Please review my exercise about linked lists

I'm learning C++ by myself and therefore I have no direct access to a mentor. This is the reason why I'd love if you guys could take the time to do a peer code review. I am very much aware, as per ...
0
votes
2answers
103 views

Correct way of using HBRUSHes..?

If I create a brush like so HBRUSH hBrush = CreateSolidBrush(RGB(33, 33, 33)); and then later on, I want to change the color of the brush, how would I do this? I googled a bit and found out that ...
2
votes
1answer
146 views

How can I improve my matrix multiplication?

I am working on a sparse matrix application in C and I choose compressed sparse row(CSC) and compressed sparse column(CSC) as my data structure for it. But the difficult part is I cannot improve my ...
2
votes
2answers
157 views

A* shortest path algorithm optimization request

Good day to ya'll. I had this programming excericise of mine where I had to find the shortest path to an exit in an NxM -grid maze in under a second (both N and M would be anywhere between 3 and ...
2
votes
3answers
167 views

Is there a faster way to clear the screen?

I'm currently clearing my console window with this piece of code: void clrScr() { COORD cMap = { 0, 3 }; if(!FillConsoleOutputAttribute(hCon, 0, 2030, cMap, &count)) { ...
1
vote
1answer
68 views

Using java keyword final on reference objects inside methods body [closed]

As per Joshua Bloch's book "Effective Java", Item 15 - Minimize mutability, using final keyword on private class fields in addition to immutability and thread-safe syncing could improve performance. ...
1
vote
1answer
64 views

How to optimize this CUDA code?

Look the code: void OpenNNL::calculateNeuronsOutputsAndDerivatives(double * inputs, double * deviceOutputs, double * deviceDerivatives) { int inputsCount = _inputsCount; double * deviceTemp; ...
2
votes
0answers
152 views

Not getting Log(n) performance from quadtree

Here is my QuadTree class and node. The problem is really with Querying. In my game, I have a city which can have n * n streets (randomly generated). And each street has buildings. What I do is put ...
3
votes
1answer
155 views

Need an algorithm to optimize grouping python dictionaries in hierarchical form

Previously I asked a question on how to group dictionaries in a list in a hierarchical structure. Initially I wanted to group a list of dictionaries that looks like the following, using multiple ...
6
votes
3answers
466 views

PHP ideal way to check function returns true

Which of the following way of checking whether a function returns TRUE or FALSE is best, in terms of efficiency and code readability? I was told by a friend that Method B is a good practice, but I ...
4
votes
1answer
155 views

I'd like a general review on this script that scrubs data from a csv file

Really, what I would like to know is: "What does this script tell you about how I need to improve as a programmer?" I'm somewhat new to both Python and programming, so feel free to minimize your ...
7
votes
2answers
216 views

How can I make this command line utility better?

I have been developing a capitalizer in Python. This is actually a script that an end user will type at their terminal/command prompt. I have made this script to: Taking the first argument as a file ...
5
votes
1answer
239 views

Depth-first search algorithm in clojure

Context As an exercise for myself (I'm learning clojure). I wanted to implement the Depth-first search algorithm. How I did it Using recursion (def graph {:s {:a 3 :d 4} :a {:s 3 :d 5 :b 4} ...
2
votes
1answer
263 views

filter a collection in a PagedCollectionView

I have scenario wherein I have to filter a collection in a PagedCollectionView. The filter criteria are Name and status which are check boxes with Enabled and Disabled labels If Enabled is checked it ...
3
votes
1answer
180 views

Generating 1-d cellular automata in Python?

I wrote a program that generates a set of 1-d cellular automaton. Basically, it generates this (rule 150): ...and rotates it to form this: I then introduced an element of randomness to it, so it ...
5
votes
1answer
123 views

How to speed up this following code

I am doing my research about scheduling by using Matlab. I am a new Matlab user and I have a problem with time execution of my following code: clc clear all A=8; B=12; C=10; ProcessTime= [ 11 11 11 ...
2
votes
3answers
332 views

C++ My matrix class

I created a Matrix class. I tested it and it seems to works. Can someone tell me if this class is a good class? Can I improve it? Can I use more move semantics (where)? What I have to modify? There ...
1
vote
1answer
88 views

Efficiency of grid generated by for-in loop

I've spend the last several hours working on a loop designed to take items in an array and arrange them as a so to speak "gird" of UIButtons. As far as I've been able to see through testing this code ...
3
votes
2answers
307 views

Restructure program code in a standard approach in C#

I changed some methods used previously, and I am wondering if I need to do the multiple for loops over and over again? How do I convert my arrays to lists to use in nested for loops? using System; ...
4
votes
2answers
350 views

Can anyone optimize the C# code for parallel programming and computation efficiency?

I would like to optimize the code to be efficient. Basically the code finds and generates an Anova table with the p-value also computed. I am inputting a text file with data delimited with commas. ...
1
vote
1answer
33 views

SQL iteration-Insertion plus renaming

Base Info Two tables: tData, tData2 Exactly the same columns About 200,000 records SQL Server 2008 R2 Logic At first sight we need to insert tData rows into tData2. What else? We need a ...
0
votes
1answer
141 views

Performance Optimization of n:1-mapping

I am filtering a List (childList) based on the contents of another List (parentList). The parentList can contain 0-n entities where items of the childList are referenced by an ID (btw. ID is in this ...
2
votes
2answers
221 views

Code/Performance Optimization - Deep clone method

I'm quite new to javascript and wrote this clone method to be able to clone any kind of object, It works quite well for the cases i testet until now, but for JSON objects it seemed kind of slow to me, ...
3
votes
2answers
1k views

.hasScroll function, checking if a scrollbar is visible in an element

I have constructed a function that checks whether an element has a scrollbar or not, and can also check individual axes. I don't know if this works in all major browsers and am unsure about the ...
2
votes
3answers
2k views

Brute force HTTP with Python

I am playing around with brute force attack on my home network. I wrote the following script with Python. However progress is a little slow. Does anyone have a suggestion how to make this faster? ...
3
votes
1answer
377 views

Efficient Album Cover loading for ListView

I have a list view which display in each view a Album's name, the associated Artist and the album art. Here is the code of my ListFragment which display this list: public class AlbumsFragment ...
1
vote
3answers
201 views

Performance Improvement

Problem Statement:- First Case:- Where inclusion and exclusion both are not empty so that means inclusion overrides anything in exclusion so for that algorithm is like this --If key is either equal ...
3
votes
2answers
474 views

Which SQL statement is faster

My co-worker claims that using a parameterized Like statement is equivalent to dynamic sql and won't have its execution plan cached for reuse. He says that using sp_executesql will allow the execution ...
1
vote
2answers
282 views

Comparing strings

My question is What's the fastest (quality is important too, but a little less important) way to compare two strings? I'm looking for the most efficient way to compare two strings. Some of the ...
3
votes
4answers
143 views

Improving file reading

I am programing in C language and have created the below functions to read files. There are two functions that I can use to read files. I wanted to know how I can further improve these two in terms of ...
1
vote
0answers
127 views

Slow OpenCV code: Is something wrong?

This code is quite slow, maybe someone could optimize it. static Mat correctColor(Mat AImage) { Mat copyImage; AImage.copyTo(copyImage); Mat imgLab; cvtColor(copyImage, imgLab, ...
1
vote
3answers
338 views

Returning all possible English dictionary words that can be formed out of a string

I am using an external library named enchant here. My problem is that I guess my program is not returning all possible English words and is slow as well for large string input. I am using both en_US ...
2
votes
2answers
132 views

Review and how I can improve this code

This my first python program and game, can you please point how I can improve & which codes should be changed, I couldn't keep the right indentation during the code formatting so I have the game ...
3
votes
1answer
123 views

Song database query optimization

I am relatively inexperienced with MySQL and have a query which to my eyes appears relatively complex: SELECT SQL_CALC_FOUND_ROWS songsID, song_name, artist_band_name, author, song_artwork, ...
4
votes
3answers
271 views

Validating password rules

Edit: I already know password rules beside length are counter-productive. It's not my choice. Also, I know that performance is absolutely trivial here. I only care about performance by way of ...

1 2