Questions tagged [performance]

Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

Filter by
Sorted by
Tagged with
3 votes
1 answer
1k views

Inserting data into SQL-Server table dynamically

I know I can do all this via SSMA quite quickly, but I wanted to see if I could do it efficiently in PowerShell myself as a little project. Basically, the entire script takes tables from an Access ...
Owain Esau's user avatar
2 votes
1 answer
760 views

2D Matrix with jagged array isn't faster than one with a multidimensional array

I was trying to use Math.Net's dense matrix class. But, it doesn't support int. So, I have to create a wrapper for a jagged 2d array. I knew that jagged arrays ...
user avatar
1 vote
1 answer
247 views

Efficiently sample a single row of an array at random

I have the following C++ code snippet that randomly samples a single row in an array called pop with num_specs columns and ...
compbiostats's user avatar
1 vote
1 answer
73 views

Optimizing loop - Reducing native calls

I am developing Android-Disassembler. I need to optimize the loop below. It is currectly calling native method for each instructions(about 4 bytes). So this loop will be looped about millions of ...
KYHSGeekCode's user avatar
-2 votes
1 answer
329 views

Using Reflection to call multiple methods and cast various classes [closed]

I have written the following Reflection code: ...
Joehot200's user avatar
  • 107
5 votes
2 answers
187 views

Encoding and decoding log entries in a Lossy Binary Format

One of the projects I'm working on requires logging a huge amount of information (basically, every function call). The problem is obviously that logging a lot of information has a few side-effects, ...
Der Kommissar's user avatar
1 vote
2 answers
142 views

Loading items into array from SQL Server [closed]

The program we are working at has the following function: ...
user avatar
2 votes
2 answers
84 views

Method that receives a hexadecimal string and returns a formatted matrix of those values

This method is part of a larger project and comes after encoding ascii characters into hexadecimal values, so it assumes the parameter is always a valid hex string. ...
enon's user avatar
  • 387
1 vote
2 answers
5k views

Check if a string is a valid english word, and convert to a valid english word

This is an interview question. For the purpose of the question, a valid English word is a string that begins with an uppercase English letter, and the rest of the string contains only lowercase ...
Mark's user avatar
  • 13
2 votes
2 answers
105 views

Looping text with directional control

The code is an implementation of looping text (similar to a circular buffer - wraps around when it reaches the edge of the defined bounds) with directional control. The code is functional and works ...
user avatar
1 vote
3 answers
376 views

Finding the name of a given constant using reflection

The code below comes from the Arm_const class of my Android disassembler project: ...
KYHSGeekCode's user avatar
2 votes
1 answer
60 views

Looping text in Python with directional control

The code is an implementation of looping text (similar to a circular buffer - wraps around when it reaches the edge of the defined bounds) with directional control. The code is functional and works ...
user avatar
3 votes
1 answer
404 views

Search for rows in a 2D array that contain a given sequence

I have a 2d array of m * n dimension (m and n can vary from 1 to 100000). The following snippet of code checks if the sequence exists in the row and stores the index if it exists. The time taken by ...
user avatar
4 votes
1 answer
595 views

Hash table, using special values to mark empty and deleted indexes

The following is a program for my school. It's supposed to use a hashtable to store values/keys. We use a marking system to mark for empty indexes and deleted indexes. -1 for empty and -2 for deleted. ...
S School's user avatar
4 votes
1 answer
78 views

Hungarian algorithm to perform least-cost assignments

The Hungarian algorithm solves the assignment problem, and I'm looking for any suggestions regarding improvement on my implementation (also coding style). It is based on the wikipedia entry and ...
Bob Dobalina's user avatar
10 votes
4 answers
6k views

Comparing two large binary files in C

I'm trying to read two sufficiently large binary files, comparing them and printing the offset at which they differ. I'm using fread to read the binary files and <...
ampat's user avatar
  • 103
3 votes
0 answers
2k views

Word search algorithm

I have a Word Search algorithm, the main function (wsearch) takes a grid of letters as an input and a 'word' to search for. The output is the number of occurence of ...
Redsbefall's user avatar
  • 1,132
0 votes
1 answer
246 views

Modeling a capacitor with DC Bias

I am modeling a capacitor which has its capacitance varying according to the DC Bias. The DC Bias is computed by taking the mean of the voltage across the capacitance. ...
Mathieu's user avatar
  • 211
2 votes
2 answers
2k views

Reading a gzipped file with JSON data for thousands of users

I'm a newbie in Python. I need to read a GZ file contains thousands of users. But I think my code is not optimized in this case. Could anyone can help me? What should I do to improve performance? Or ...
Han Van Pham's user avatar
-1 votes
1 answer
74 views

Javascript code to make Matrix wallpaper [closed]

I am a javascript noob. I did this program for the sake of learning javascript in a better way. the code is to display matrix live wallpaper in the browser. Here is the code ...
Khushit Shah's user avatar
4 votes
1 answer
1k views

Counting integers that are within intervals

I am looking for a more efficient way than bruteforcing my way through in the following problem in python 3. Problem statement: Input: An array of n integers, scores, where each score is denoted by ...
codingnoob's user avatar
1 vote
5 answers
2k views

Checking if a number is divisible by 2-11

I am writing a Python class which checks if a given number is divisible by numbers 2-11. I am not using the __init__ method which in my opinion is not necessary in ...
Jonas.S.'s user avatar
  • 165
5 votes
1 answer
4k views

Determinant using Gauss Elimination

We had a question in examination to compute determinant of general square matrix. Now I had made the normal program using Laplace Formula of determinant, ie, recursive solution. Now I was thinking of ...
jeea's user avatar
  • 103
1 vote
2 answers
105 views

Font and color checker chrome extension in JavaScript

I have written this code for a color and font checker on a webpage. The code is current and not so good. I would really like if I can get comments, reviews or any better approach for my PoC. PoC: I ...
Bhansa's user avatar
  • 141
1 vote
2 answers
244 views

When given 7 letters, find all possible words with length 3 to 7

I am writing a program in JavaScript to find all possible words given 7 letters. The words have to be 3 or more characters, and for right now I am limiting it to 7 characters long. The code below ...
Wowsk's user avatar
  • 113
0 votes
1 answer
63 views

Copying contents between BufferedStreams in Java

This is a simple function that copies the content of one stream to another. My question is simple. I am currently, copying between the streams one byte at a time, but the streams are both Buffered. ...
Gnik's user avatar
  • 882
20 votes
2 answers
13k views

Intersection over Union for rotated rectangles

Problem Statement I am trying to find the intersection over union (IoU) metric for one to several rotated rectangles compared to many different rotated rectangles. Here are some images to help ...
syb0rg's user avatar
  • 21.8k
2 votes
1 answer
102 views

Iteratively simulate a parasite population

I'm trying to build a simulation in R to model the effects of different parasite egg laying behaviors on how many offspring the parasite has, given a limited amount of resources. In brief, this ...
Jake's user avatar
  • 123
2 votes
0 answers
73 views

Insert items from one table that do no exist in the other one [closed]

The insert query below must insert the items not present in the Articolo table by importing them from Importazione, and must update the items in the Articolo with those present in the Importazione. To ...
riki's user avatar
  • 153
0 votes
1 answer
925 views

Sorting CSV table in Powershell

I'm wondering if some PS gurus can advise on whether my method for sorting and recombining some data fields by using an array of PSCustomObjects is as efficient as it might be. I'm importing a CSV ...
LeeM's user avatar
  • 103
-1 votes
1 answer
242 views

Decoding a string encoded by Caesar Cipher and some delimiters [closed]

I have the following code which I seek to optimize. The result of the bruteforce I already have but I'm just trying to learn some more python using the same example. The code in the data needs to be ...
BartD's user avatar
  • 9
3 votes
1 answer
39 views

Reads paragraphs of common artists separated by commas

I want to make this faster, I'm not a great coder and just want to learn. This program reads paragraphs of common artists separated by commas. The user inputs the name of a desired artist and the ...
Alexander Oroudjev's user avatar
2 votes
1 answer
1k views

String search algorithm for finding if a long list of long strings string exists in a similarly sized haystack

My use case is that I have a list of emails and I need to find if the email is in the chain: ...
Ryan Schaefer's user avatar
2 votes
2 answers
471 views

Number factor of a number

I currently have a number factors program that performs the following things: The user enters a number, checks whether it is a perfect square (yes or no), prints the square root if it is a perfect ...
Rod Argumedo's user avatar
4 votes
3 answers
620 views

Effieciently validate multiple DataRows with return early option

I'm looking for an efficient way to validate multiple rows originating from multiple .csv files. Below is the current code to accomplish that. The validation logic is in the function ...
ftp.x32's user avatar
  • 43
0 votes
2 answers
99 views

check if two elements exist in array with older browser support [closed]

Currently I have this code ...
hrp8sfH4xQ4's user avatar
4 votes
1 answer
489 views

Group-wise deviations from means / centering with dplyr vs. data.table

I am trying in R to "center" a matrix (i.e. remove mean) group-wise (i.e. remove group means for each variable). Input is a matrix (including the grouping variable), and output is the same matrix, ...
Matifou's user avatar
  • 163
3 votes
2 answers
783 views

Pairwise adding tuples in a list

I have two list of tuples: [[1,8],[2,7],[3,14]] [[1,5],[2,10],[3,14]] and a desired sum 20. I need to find two tuples from two list whose second element either ...
Rohit's user avatar
  • 1,066
1 vote
2 answers
80 views

Merge both sql queries into one to get the performance

Currently i am using 2 queries - one for reattemptdate & one for holddate.... if we merge both queries & get the results in single query , than will it give better performance? if so how to ...
vickey colors's user avatar
-1 votes
1 answer
44 views

Extract a box with pixel values from an image, calculate the mean of each possible box [closed]

I have a two-dimensional array with M rows and N columns, with each element having a value between 0 and 255. I have a second two-dimensional array with m rows and n columns, m < M, n < N. ...
Narcis Neacsu's user avatar
0 votes
2 answers
85 views

Tracking employee data

We have hundreds of employees and for tracking each employees' data, and I am using this code: ...
vickey colors's user avatar
2 votes
2 answers
234 views

Index Match implementation

The code below takes header variables, retrieves the column index, and then, using an Index/Match function, returns data from a matching account number. The reason it is written this way is because I ...
Nahuatl's user avatar
  • 131
1 vote
1 answer
984 views

Odd Even Subarrays

I've been trying to understand Dynamic Programming lately, here's the question I just attempted: You are given an array A of N positive integer values. A subarray of this array is called an Odd-...
Pranjal Verma's user avatar
4 votes
1 answer
138 views

INCARDS SPOJ challenge

Question- In short question says that you have N bus stops and K bus routes. Every bus routes is linked to two bus stops. Each route has some cost of travelling. It says one person visit any ...
Ladoo's user avatar
  • 69
4 votes
1 answer
320 views

Optimizations of C Code - Bilateral Filter

I'm working on a nice approximation for the Bilateral Filter. I have a working code which runs pretty fast yet still I think much can be improved. The code (C Code,...
Royi's user avatar
  • 582
1 vote
0 answers
1k views

Using multi-threading efficiently with million GET requests

Disclaimer: The following question is not related to any malicious activity. Only performance testing we are doing. I am working on querying an internal server with lots of requests (~20 million). ...
E235's user avatar
  • 237
5 votes
2 answers
662 views

Converting Reverse Polish to Infix Notation in Java

I am trying to solve a programming challange that involves converting reverse polish notation to infix notation. For example: 1 3 + 2 4 5 - + / would be: ((1+3)/(2+(4-5))) My solution so far does work,...
Sander's user avatar
  • 151
4 votes
1 answer
2k views

Swift - Finding longest binary gap of a given integer

I recently had the chance to try Codility's algorithm training, and the very first one in the list is finding the longest binary gap of a given integer. I tried to implement this in Swift, and after ...
badhanganesh's user avatar
12 votes
1 answer
2k views

Seating Students (partitioning sort of)

The goal of this code is to seat students in a classroom based on a single test score. We want students to be evenly distributed across the class such that every student is positioned next to the ...
iVinny's user avatar
  • 121
2 votes
0 answers
102 views

Pandas: missing value imputation

I want to find a more efficient solution to the following problem: My dataset is about online games. Each player may have multiple plays (rows in the df). Each play has its corresponding timestamp. ...
EAMC's user avatar
  • 21

1
53 54
55
56 57
176