Questions tagged [performance]

45778 questions
1

votes
1

answer
71

Views

What's a fast way to space-out bits within a word?

I have a 32-bit value in the lower part of a 64-bit register; the top part is 0 (X denotes a bit with information, bits listed from LSB to MSB): X X X ... X 0 0 0 0 ... 0 Now, I want to 'space out' the bits with information, so that I have X 0 X 0 X 0 ... X 0 (or if you'd rather put the 0's first,...
einpoklum
0

votes
0

answer
3

Views

test results of all the webpage components to Influxdb from Webpagetest api

Honestly I'm trying to implement this -https://github.com/siedi/webpagetest-influxdb to have webpage test results to influxdb and later in Grafana. The above package pushes aggregate metrics to InfluxDB. Below is the code written for this i think. var firstView = testData.data.median.firstView cons...
shey
1

votes
2

answer
3.2k

Views

ADB stopping at <waiting for devices>

I was trying to install some custom recovery and ROM on to my phone when I got to this situation. (I have my windows update turned off) ADB or fastboot shows I tried and saw few solutions. I'm writing a detailed solution to this. this was how I solved it. if you have more suggestions you can answer...
Sushanth Kille
1

votes
1

answer
34

Views

Optimize an existing for-loop over three arrays

I have three lists/arrays: one is a list of boolean values, the other two are arrays with certain values. My goal is to loop through the boolean list and if the value is true take the j-th value of the first array and safe it in the solution array, and if the value is false take the j-th value of th...
zeniapy
1

votes
4

answer
54

Views

ORACLE LIKE with multiple values

I have the below query in ORACLE which takes a really long time to run because of the OR in between the 2 likes. select pat_mrn_id,surgery_date, proc_name from or_log_all_proc, or_proc, or_log, patient where upper(proc_name) like ('%CRANIOTOMY ANEURYSM%') OR upper(proc_name) like ('CLIPPING%ANE...
JHegde
1

votes
2

answer
48

Views

Using a spatial index to find points within range of each other

I'm trying to find a spatial index structure suitable for a particular problem : using a union-find data structure, I want to connect\associate points that are within a certain range of each other. I have a lot of points and I'm trying to optimize an existing solution by using a better spatial inde...
Jean-Pierre Coffe
1

votes
2

answer
69

Views

Powershell - Fastest way to create a very large array of hashtables

I am trying to create a rather large array of hashtables, with much of the data either fully randomized or randomly picked from a list. Here is my Current Code $ArrayData = @() $ArrayDataRows = 150000 foreach ($i in 1..$ArrayDataRows) { $thisobject = [PSCustomObject] @{ Number = $i Place = Get-Rando...
AdilZ
1

votes
2

answer
36

Views

Calculating which compiler is faster in terms of cycling

I just have a simple question, a bit silly, but I just need some clarification for an upcoming exam so I don't make a stupid mistake. I am currently taking a class in computer organization and design and am learning about execution time, CPI, clock cycles, etc. For a problem, I have to calculate th...
Janeson00
1

votes
2

answer
19

Views

Combine 2 update querys in a single query - performance

Im programming a favourite function. For example we have multiple adresses and can choose one as favourite. At the moment i got 2 querys to do this job: UPDATE userdata SET maindata = 0 WHERE cid = :id; UPDATE userdata SET maindata = 1 WHERE cid = :id AND id = :id2 LIMIT 1 In the first query i mak...
delato468
1

votes
2

answer
80

Views

Clojure comp doesn't tail-call-optimize (can create StackOverflow exception)

I got stuck on a Clojure program handling a very large amount of data (image data). When the image was larger than 128x128, the program would crash with a StackOverflow exception. Because it worked for smaller images, I knew it wasn't an infinite loop. There were lots of possible causes of high memo...
brundolf
1

votes
3

answer
51

Views

indexed order by is slow when doing inner join

I am trying to join two simple tables with ORDER BY clause Tables: Alerts: Total Rows: 690000 Indexes: (createdAt DESC, id DESC) SubscriptionFeed: Total Rows: 99990 Indexes: (createdAt DESC) The problem is when I add ORDER BY a.'createdAt' DESC, a.id DESC the query becomes much slower than using...
Muhammad
1

votes
2

answer
781

Views

SQL Overlapping and Multi-Column Indexes

I am attempting to tune some stored procedures and have a question on indexes. I have used the tuning advisor and they recommended two indexes, both for the same table. The issue is one index is for one column and the other is for multiple columns, of which it includes the same column from the first...
Dustin Laine
2

votes
0

answer
20

Views

How to delete large amount of data in sql server without data loss?

I've been dealing with million of data deletion in day to day process. Basically I have 4 tables. Table_A Table_B Table_C Table_D I'm attempting to delete data older than 10 days in all tables. Possibly I will be deleting around a million in each table. I have created a stored procedure to do these...
Pandiyan Cool
1

votes
2

answer
398

Views

More efficient to check if a variable is set, then set it, or just constantly set it?

Making a game... More efficient to do this? if (37 in keysDown) { //left arrow if (sprite.state != 'left') sprite.state = 'left'; } or this? if (37 in keysDown) { //left arrow sprite.state = 'left'; } This is being called in my game's update function (constantly, as fast as possible). Sidenote: her...
Sam
2

votes
1

answer
22

Views

Performance of mat-table with 30 000 rows

I use Angular 6, Firebase and Angular Material. I have 30,000 json objects stored in firebase that I want to load them into a mat-table. Only I get way below that I wish. I wait 30 seconds before I can click on my application, sometimes chrome is in error ... Yet I load my data after pagination. Can...
Alan ENTEM
1

votes
0

answer
11

Views

In terms of time complexity, what is the most efficient way to overlay multiple smaller images onto a bigger image?

I am trying to overlay multiple smaller images onto a bigger background image using openCV. Currently I am using addWeighted() API with alpha=1.0 but this API only takes in two images. If img1 is overlaid onto img2 which is in turn overlaid onto img3, then I would have to call addWeighted() multiple...
Rahul Pradeep
1

votes
2

answer
369

Views

Calling and executable with arguements and getting its STDOUT more efficiently in a Python Script

I'm writing a script that takes longitude and latitude and runs them through an executable called gdallocationinfo. The executable takes the latitude and longitude as its arguments and returns its STDOUT as the value for that coordinate. I've been reading about sub-processes and I was wondering if t...
Grant
1

votes
1

answer
565

Views

I get almost same performance on both Tesla K40 and Tesla K80

I have developed two CUDA kernels. One is a memory-bound kernel and the other is compute-bound. The kernels, first have been optimized on Tesla K40 and I am doing a performance test on both Tesla K40 and Tesla K80 now to compare their performance results. However, I am really confused because I get...
Siamak
1

votes
1

answer
1.4k

Views

Improve Spring-Boot startup in Docker

Approximately for standalone start as java process : java -jar myspring_boot.jar it takes around 20 seconds. But if I run it in a docker container which contain more micro services it takes around 3 minutes. Is there a way to speed up the spring-boot boot time as for an example if I enable debug lo...
Jordan Borisov
1

votes
1

answer
1.4k

Views

Gatling Feeder Issue : No attribute name 'CSVFieldName' is defined issue

I am newbie for Gatling and trying to read some fields from CSV and use them in my gatling scenario but facing No attribute name 'CSVFieldName' is defined issue ; some details: Gatling Version : bundle-2.2.3 CSV Name : memId.csv CSV contents : memid CKABC123 Scala File contents : //Class Decl...
Ritesh Sharma
1

votes
2

answer
59

Views

MongoDB performing slow under load

We use mongodb 3.4.14 with 8 core, 32GB RAM. I was performing the load test with Jmeter, with 70 threads I have acceptable output. But as the load increases SLA is exponentially increasing and throughput reduces drastically. I tried increasing the ulimit and sharding is the next step, apart from tha...
Raghuveer
1

votes
3

answer
61

Views

Why is an elementwise product of a matrix much faster with apply?

I want to multiply all the elements of a matrix together. I can do it with two for loops or with apply. My intuition was that the for loops would be faster. Apply has to create a temporary vector to store the results of the product of rows, then apply product to that. It still has to execute for lo...
badmax
1

votes
3

answer
355

Views

Angular 6 performance issue with large table [duplicate]

This question already has an answer here: Angular many rows grid performance in Chrome browser 1 answer I have a problem with Angular 6 performance issue. In the page there is a large table which has 100 rows and each row has 100 columns. Then this page is kind of laggy when I trying to use librari...
You Zhou
1

votes
1

answer
101

Views

Fast way to get Expression method call target

Given the following code line of code, Expression expression = () => target.ToString(); is there a fast way to obtain the target object? Below code works public object GetExpressionTarget(Expression expression) { MethodCallExpression methodCall = (MethodCallExpression) expression.Body; LambdaExpress...
Thomas Flinkow
1

votes
1

answer
60

Views

Why would one define a local function in C# just to call it right away (in context of IEnumerable<T>) [duplicate]

This question already has an answer here: Meaning of the syntax: return _(); IEnumerable _() [duplicate] 1 answer I had a look at the implementation of several extension methods of the genious MoreLINQ- project. And I came across a style habit that I cannot explain. Maybe some of you can? It happen...
Robetto
1

votes
3

answer
46

Views

Searching records in database by list of Ids

I have a list of ids (itemID's) which I pass to the query like following: using (var ctx = new MyEntities()) { ctx.Configuration.LazyLoadingEnabled = false; ctx.Configuration.AutoDetectChangesEnabled = false; ctx.Configuration.ValidateOnSaveEnabled = false; ctx.Configuration.ProxyCreationEnabled = f...
User987
1

votes
1

answer
63

Views

Is it ok to attach a lot of event listeners?

Assume I have some component, that represents some kind of smart image (IUKWIM :D). export default class SmartImage extends React.Component { state = { visible: false } wrapper: HTMLDivElement componentDidMount() { window.addEventListener('scroll', this.handleScroll) this.handleScroll() } componentW...
Levitator Imbalance
1

votes
2

answer
39

Views

Avoid slow looping when plotting irregular raster plot using patches.Rectangle

I've written a code to make an irregular raster plot (i.e. one in which the size of the raster rectangles is variable). Here is a minimum reproducible example below. The problem is that looping over the blocks is very slow for my example (each plot has a lot of rectangles and there are a lot of...
Adrian Tompkins
1

votes
3

answer
93

Views

Performant way to clear excessive old data in a text file

I have some text files that I need to be able to write to on the fly, and quite often. These files can get pretty big in size, but the text inside them can be completely different between two iterations. This means that text can be shorter than it previously was. Which, if i wouldn't clear the old d...
remy_rm
1

votes
1

answer
90

Views

DispatchQueue: why does serial complete faster than concurrent?

I have a unit test setup to prove that concurrently performing multiple heavy tasks is faster than serial. Now... before everyone in here loses their minds over the fact that above statement is not always correct because multithreading comes with many uncertainties, let me exlain. I know from rea...
ErikBrandsma
1

votes
1

answer
62

Views

Error: PLS-00642: local collection types not allowed in SQL statements

I want to retrieve data from a table with multiple values in a variable and with where clause on this variable. My database version is 11.1 CREATE OR REPLACE PACKAGE BODY pr_retrieve_data as PROCEDURE FETCH_MYTABLE_DETAILS() is TYPE ACCNT_NUMBER_TYPE IS TABLE OF MYTABLE.MYCOLUMN%TYPE; L_ACCNT_NUMBER...
user2488578
1

votes
2

answer
69

Views

Performance of array lookup vs bitshift

For an implementation of Othello (Reversi), I precomputed powers of two to be looked up in an array. Today, while trying to optimize for speed, this struck me as a premature optimization since I previously assumed lookup to be faster and never actually made a benchmark. Here's how i precalculate the...
Marv
1

votes
2

answer
132

Views

PowerShell5. Find/replace text. Switch and .NET framework or cmdlets & the pipeline? Which is faster? Which is easier to read?

How to find and replace text in a windows text file with search and replace strings that are easy to read and easy to add/modify/delete. This script will parse a 6800 line file, find 70 instances of the strings, re-number them and overwrite the original in less than 400ms. Search for strings 'AROUN...
somebadhat
1

votes
2

answer
52

Views

Is using Pattern/Matcher more efficient than looping through a string and looking for characters?

I am working on a project that will look through a java file for a particular method, and output the lines that method occupies to a file. I am already using a Pattern and Matcher to find the method, but then I iterate through characters in a line to find matching curly braces. My question is, woul...
Chandler Davis
1

votes
3

answer
87

Views

How to save a matrix in C++ in a non-linear way

I have to program an optimized multi-thread implementation of the Levenshtein distance problem. It can be computed using dynamic programming with a matrix, the wikipedia page on Levenshtein distance covers that well enough. Now, I can compute diagonal elements concurrently. That is all alright. My...
Jan Kolombo
0

votes
2

answer
22

Views

Optimize speed of Mysql JOIN query

I have 2 tables called T1 made of 1.6mln of rows and T2 made of 4.6mln of rows with with one-to-many relationship. The CREATE STMT of T1 is: CREATE TABLE `T1` ( `field_1` text, `field_2` text, `field_3` decimal(10,6) DEFAULT NULL, `field_4` decimal(10,6) DEFAULT NULL, `field_4` decimal(10,6) DEFAULT...
UgoL
1

votes
1

answer
64

Views

using Map vs Enum

I need to keep a mapping which finds some properties given a String. For an example like below, I need to get possible colors for an animal given the description for that animal. I have 'An animal with four legs' - not 'CAT' - and need to find BROWN and GREY. Keeping this in an enum makes code more...
canan
1

votes
1

answer
40

Views

Performance: Using try (statement) and catch (output error) instead of checking if email already exist

Very often i need to prevent querys to get executed when a value like a email already exist. Until now i searched for the value like that: $checkemailexist = $X['db']->prepare('SELECT uid FROM userdata WHERE uid = :uid LIMIT 1'); $checkemailexist->execute(array( ':uid'=>$uid )); if(empty($checkemail...
delato468
1

votes
1

answer
47

Views

How to prevent string builder in log message if log level is disabled

When I have a log message in the code (say logger.debug('Some message {}', someFunction());) in situations where the log level is above debug, I've now built a string and called someFunction() for no reason. I'm used to C++ and there I would use some macro which would check the log level before actu...
Avi Poss
1

votes
1

answer
203

Views

Why operation on list is slower than operation on numpy array

I am doing a project on encrypting data using RSA algo and for that, I have taken a .wav file as an input and reading it by using wavfile and I can apply the key (3, 25777) but when I am applying the decryption key (16971,25777) it is giving wrong output like this: The output I'm getting: [[ 0...
Sandipan

View additional questions