Questions related to improving application performance.
0
votes
1answer
16 views
Should I use and loop, or just a loop?
I build a code like this
if(listObj.Any(x => x.id < 0))
{
foreach(ModelClass item in listObj)
{
if(item.id < 0)
{
// code to create a new Obj in the ...
1
vote
1answer
29 views
Jquery Geocoding Script
The rules for this script are simple:
If geocode is hit, then just geocode
If geocode and submit is hit, then geocode and then submit
If an autosuggest link is hit, then geocode instantly
In this ...
0
votes
1answer
19 views
Progress 4GL - Luhn algorithm
My implementation in Progress 4GL of the Luhn Algorithm. Any suggestions on improving it?
FUNCTION fnLuhnAlgorithm RETURNS LOGICAL
(INPUT pcNumber AS CHARACTER):
...
1
vote
0answers
58 views
Conway's game of life - Optimizing the code
I have just finished my first iteration of conway's game of life as a codeing excercise. I have little experience with coding, so I think my code could use some refactoring. What i am curios about is ...
0
votes
0answers
36 views
How can I improve this OpenGL Code (LWJGL, Particles)
I wrote a small particle engine in Java for my Pong clone.
I read that changing a texture is very expensive in OpenGL, so I tried to change the texture as few times as possible.
Therefore I change the ...
1
vote
1answer
54 views
Considerable difference in Running time of thse two java codes
While solving a problem on an online judge, I tried with these two implementations.
These two implementations do the same thing. Task is to report duplicate entry for a given set of data.
...
2
votes
0answers
59 views
Implementing recursive filters with Haskell/Repa
I recently learned Haskell, and I am trying to apply it to the code I use in order to get a feeling of the language. I really like the Repa library since I manipulate a lot of multi-dimensional data. ...
2
votes
1answer
71 views
jQuery: Better method to do a mouseenter mouseleave events
I'm a newbie to javascript, and day after day, I try to write better code with jQuery.
For example, I wrote this code earlier:
$$foo= $(".foo");
$$foo.mouseenter(function() {
...
0
votes
2answers
38 views
Performance testing in PHP
I need to test performance of a function in PHP. This has to happen accurately, of course. In the end I need to know how long it takes for a function to perform. What I'm doing now:
<?php
$start = ...
1
vote
1answer
29 views
How to reduce memory usage of nested vectors?
I recently asked this question about performance of an unordered_map, but I realize my question is probably more about this piece of code here.
I create a 8 x 10 x 30 x 30 x 24000 nested vectors of ...
2
votes
1answer
51 views
How can I speed up access to an unordered_map?
How can I improve the access time to this unordered map? If I instead allocate a 8 x 10 x 30 x 30 x 24000 std::vector<std::vector<std::vector<std::vector<std::vector<float> > > ...
1
vote
1answer
35 views
Boiler.js Deep Object Comparison Code/Performance Optimizations?
I have a deep equality comparison method that returns true when two objects are equal (see method Doc):
_.isEqual = function (obj1, obj2) {
// Quick compare objects that don't have nested objects
...
0
votes
2answers
44 views
Setting element attributes via JavaScript as opposed to in HTML code itself [closed]
While code reading I came across a piece of code in JavaScript which set the placeholder attribute for an input element ($("#el").attr("placeholder", "I am Input");). I myself have always set such ...
0
votes
2answers
74 views
Remove matched Rows from two Datatable (performance optimization)
Here I have two DataTables:
dtTotalDateRangeExcludeSundays
dtAbsentsLeavesHolidaysWorks
Each having 10k+ values. I need to delete matched rows.
Below code works fine
foreach (DataRow rw in ...
1
vote
1answer
58 views
Best way to do a Determinant of a Binary Matrix C++
I'm looking for the best way to do a determinant, for determinants until 15x15 and looking for speed
int Determinant(const vector<vector<int> > &a,int n)
{
int i,j,j1,j2;
int ...
0
votes
0answers
41 views
Calculate work progress in percentage of batches that contain tasks and task contain sub tasks
I was being referred to here from stackoverflow.
I am trying to calculate work progress in percentage. I have multiple batches, and each batch contains a set of tasks and each task also contains a ...
1
vote
0answers
34 views
Collision System in Pong-like game - How good is this code? (Blitzmax)
I am writing a game like Pong. Therefor I am using an entity system approach, so I use component based design.
The hardest part until now was to write the collision system. As I just began with the ...
1
vote
1answer
47 views
SQL Query efficiency within class
I'm trying to figure out whether I should do the following:
This class (over-simplified version) retrieves information about an order by having 1 main query function that select a specific column ...
3
votes
0answers
108 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
67 views
Time limit of a c program while calculating factorial of numbers in c
I am solving a problem on calculation of factorial and the challenge is as follows!
You are asked to calculate factorials of some small positive integers.
Input
An integer t, 1<=t<=100, ...
3
votes
1answer
101 views
First Javascript - Geocoder - Can it be improved?
So I'm pretty excited to have coded my first javascript file which now works, and I've spent my evening trying to improve it.
It takes a location in the #loc input box and geocodes it (gets ...
2
votes
1answer
48 views
Looking for code quality suggestions with my open source CFML database project
I just posted a small open source CFML project on github.com, https://github.com/jetendo/db-dot-cfc
db.cfc is a standalone CFC with 472 lines of code.
Anyone interested in reviewing the way this code ...
1
vote
2answers
126 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 ...
3
votes
1answer
137 views
Improvement of my php code
I wrote a class with this function. Can I improve my code performance in the bottom of the function? I don't like the while loops!
public function loadFields(array $fields, $as_object = ...
2
votes
0answers
91 views
How to improve readability and memory footprint of this haskell script?
I have this small haskell script that I wrote some time ago to parse a set of financial CSV files to produce other CSV files. I've recently had a problem with large input files (around 300Mb) that I ...
6
votes
1answer
179 views
Haskell Particle Simulation
I recently started learning Haskell and as my first project I decided to port a particle simulation I had written in C.
The simulation is pretty simple. We have a cubic box with particles (spheres) ...
3
votes
3answers
189 views
Linq query performance improvements
As I am getting my Linq query to a functional point, I start looking at the query and think about all the "ANY" , and wonder if those should be a different method and then I have data conversions ...
2
votes
5answers
270 views
Performance: Divide group of numbers into two groups of which the sums are equal
I have a piece of code that divides a group of numbers into two groups of numbers of which the sums are equal.
I created this because of a StackOverflow question: ...
0
votes
0answers
52 views
How to make the code more optimal?
Maybe some of you have an idea how to make the code more optimal? This had to be a little faster, because i cant pass few time tests :/
Unfortunately I can not add tests whose over time because they ...
3
votes
1answer
53 views
Selecting element from a collection based on bitwise-and result
I need to improve this section of code:
uint32_t to_handle = 0;
uint32_t test_const1 = Constraint3::VAL1 + Constraint3::VAL2;
uint32_t test_const2 = Constraint1::VAL2 + ...
1
vote
4answers
108 views
improve this code for pattern
my aim is to design a function with arguments(int m,int n) so that output is like (for m=3,n=5)
3
34
345
34
3
i came up with this code
void func(int m,int n)
{
for(int i=1;i<n-m+2;i++)
{ ...
4
votes
2answers
194 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 ...
2
votes
0answers
69 views
Very fast query selector — did I miss something?
A few months ago, I wrote a query selector that seems to outperform the query selectors in the popular GP libraries by a pretty hefty margin. I'm wondering if I overlooked something; it seems odd that ...
6
votes
2answers
344 views
Speed up solution to Project Euler problem 75
I've been programming for a few months now, and have used Stack Overflow a great deal, but this is my first post. Anyway, I wrote this code for Project Euler problem 75, and was curious if anyone knew ...
2
votes
2answers
100 views
Improving the CRC code with “unsafe features”
I have the following CRC 16 code.
Is it possible to improve the performance of the code with unsafe constructs.
My knowledge about pointer arithmetic is rather limited.
public enum Crc16Mode : ...
4
votes
2answers
288 views
Is there a better way to consume an ASP.NET Web API call in an MVC controller?
In a new project I am creating for my work I am creating a fairly large ASP.NET Web API. The api will be in a separate visual studio solution that also contains all of my business logic and database ...
1
vote
1answer
47 views
Please Review Performance Test and Idea: Initialize a widget
I want to extend an app object with a widget that initializes itself immediately.
Immediately-Invoked Function Expression:
var app = {};
(function() {
app.widget = {
init: function() {
...
6
votes
2answers
127 views
Generic wrapper for equality and hash implementation: Is there a way I can make it more efficient?
I was writing an answer in another thread and came across this challenge. I'm trying to have a generic class so that I can delegate the routine (and tiring) Equals and GetHashCode implementation to it ...
1
vote
2answers
101 views
What could I have done better with this code from a calendar?
I was writing a calendar a long time ago and, coming back to the code, I've realized that it's not the best. I was fairly mediocre at programming back then.
I'm using jQuery, Mousetrap, and ...
1
vote
1answer
100 views
jQuery plugin: Parsing a JSONP feed using ajax()
I'm fairly new to JavaScript and jQuery and this is my first attempt at creating a plugin. The code below I've written to parse a JSONP feed from a search engine API (funnelback) using ajax() calls. ...
3
votes
2answers
138 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
45 views
General Code Review - Key Press Handler
I have made a class to import into my projects to more easily handle the state of the keyboard so I can use stuff like:
if(Keys.returnKey(37)){
As opposed to setting up key listeners.
Could you ...
0
votes
1answer
100 views
Miller-Rabin Prime test (Speed is the main goal)
The code below is for testing Primes.
testPrime(100000);
testPrime(1000000);
testPrime(10000000);
testPrime(100000000);
Now my goal is to make the code super fast at finding prime number, min-max, ...
1
vote
0answers
44 views
Can I make my render method more efficient?
I get great FPS with this as is, but I'm a performance freak and I don't know AffineTransform or the Java graphics libraries very well. I'm sure there is something I could be doing differently to make ...
3
votes
1answer
55 views
Finding missing items in an int list
Here is a problem I am trying to solve: trying to find missing photographs from a sequence of filenames. The problem boils down to: given an unsorted list of integers, return a sorted list of missing ...
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 ...
-1
votes
1answer
98 views
How to apply Sieve of Eratosthenes test into my code [closed]
I have this code that tests prime numbers and I'm trying to make it fast as possible. I know a way but I just can't find how to execute it in to my code. Does any one know how to input in to the code ...
1
vote
1answer
39 views
Return most common items in list (php)
I was wondering what's the best way to return the most common items in a list, so far the best way I could do it was:
//@param string $this->matched_ids_list = 1,11,12,11,12,
...
0
votes
3answers
176 views
Primes Tester for speed performance
I was given a homework assignment in Java to create classes that find Prime number and etc (you will see in code better).
My code:
class Primes {
public static boolean IsPrime(long num) {
...
0
votes
1answer
465 views
Responsive Left Fly out menu performance improvement
I am working on this website currently
if you resize the window to less than 650px then the main menu is replaced by a button which when pressed triggers a left fly-out menu similar to the facebook ...