Most voted "performance" questions
For questions involving measurement and improvement of code efficiency
Learn more…479 questions
Sort by count of
-
4
votes3
answers146
viewsPerformance "Where in foreach vs if"
Which case would perform best? var chaves = new list<string>(); foreach(var item in lista) { if(!string.IsNullOrEmpty(item.Chave)) { chaves.Add(item.Chave); } } Or listaValida = lista.Where(x…
-
4
votes1
answer519
viewsHow to measure the performance and costs (processing and memory) of a frontend?
I am working on a project that uses a lot of Javascript (ecmascript-6, jQuery), Html5, CSS and would like to have some way to measure the performance, the consumption of processing and the…
-
4
votes1
answer339
viewsUse IN or multiple OR? Which one performs better?
I have the following queries in Mysql: 1º: Using multiple devices OR SELECT SUM(qtd) FROM produtos WHERE qtd > 10 and (status = '0' or status = '4' or status = '7') 2º: Using IN SELECT SUM(qtd)…
-
4
votes1
answer275
viewsWhat’s faster: Stack or Heap allocation?
This question may sound elementary but it has given me a good debate with a co-worker. I whenever I can make allocations on Stack because for me the growth of Stack is constant in time. And already…
-
4
votes3
answers221
viewsList<> Best practice, start with fixed capacity or start without limit?
I have a scenario where I will receive a list, or an array, or any other type of data from the database where I can know the size of my list before creating it, what is the advantage between the…
-
4
votes3
answers634
viewsHow to make my program consume less CPU without disturbing its execution?
I have a program that reads the memory of a computer process continuously (with the while (true)), but it ends up requiring a lot of CPU, arriving at 20% used, my question is, how to decrease CPU…
-
4
votes1
answer97
viewsHow much each function "costs" to the server
My question is about function is_dir to find out if there is a directory. How much does it cost for the application to use this function? How to measure the use of this or another function in PHP?…
-
4
votes5
answers2275
viewsHow to reduce the search time in a table with more than 200,000 records?
I’m trying problems to list and search data table with more than 200 thousand records. I read in researches, that for the search system, the ideal would be to make indexes of type "fulltext" in the…
-
4
votes3
answers158
viewsDeclaration of Java variables
Is there any difference between the two statements: First: int a; int b; Second: int a, b; Which is the best? Are the variables closer in memory or is that just a myth? Is there any significant…
-
4
votes1
answer85
viewsDoes using CTE (Common Table Expression) create a type of "cache" in the database?
I have an appointment with several JOIN and queries, and when executed, it takes about 7 seconds to return. Getting the same result, using CTE’s, the query takes around 8 seconds of the first…
-
4
votes1
answer126
viewsWhat is the most performative way to convert an int into the sum of its digits?
I have a certain int and would like to turn it into another that is the result of the sum of your digits in the best possible way. For example: int n = 2601; Should result in 9 since this is the…
-
4
votes2
answers299
viewsData Modeling: Integrity x Performance
In the company that I work for, there’s a data architecture that I’ve never seen before, and I’d like to know if this is common, or if it’s a new market trend. Just to mention the bank is Oracle.…
-
4
votes1
answer118
viewsNumber of Columns X performance in tables
I am working with Mysql 10.x in a table that already has 60 columns, but it turns and moves I need to include more columns, I usually dismember in several tables precisely to not create a very large…
-
4
votes2
answers346
viewsReuse of variables
I had a question about code optimization. I assume that the more the code is dried, the faster the algorithm will be compiled and executed. Starting from this principle, I have the habit of reusing…
-
4
votes2
answers210
viewsImprove function performance that determines whether it is palindromic
Objective: to optimize performance Description of the problem: I have a function that returns me if the word is a palindrome with true otherwise with `false, until then quiet, but need to improve…
-
4
votes1
answer113
viewsHow should I assign strings in C#?
As far as I know, System.String no. NET (I don’t know if on other platforms the string type is also like this) is immutable, ie if I do: string a = "texto"; a = "outro texto"; Behind the scenes, by…
-
4
votes0
answers83
viewsWhat is the best way to do a very large and repetitive task?
I need to take the duration of 18000+ audios, using the library audioread for each audio it takes right 300ms, ie at least 25~30 minutes of processing. Using a system of Queue and Process, using all…
-
3
votes3
answers2284
viewsDoubts binary search
Assuming that the binary search works only with array of ordered integers, if I had to search for an integer in an ordered vector the speed of the search would be much faster than a sequential…
-
3
votes2
answers383
viewsGetting around the problem with hot Java development?
Problem situation: You are developing a website and debugging on it. For example a CRUD of users. For this you are using Javaee 1.7, Eclipse Kepler and Apache Tomcat 7. However, at the development…
-
3
votes1
answer8490
viewsOracle Relationship Search Query
I have a program to search dependencies of records to proceed with data deletion here in the company. We support some databases but on Oracle the query is processed very slowly (about 10 to 15…
-
3
votes1
answer3217
viewsHow to prevent a simple query from traversing the entire Mysql database
I have an application in Rails that uses a Mysql database with a table with millions of rows. Sometimes it happens that some part of my application does a very heavy query, locking all the rest of…
-
3
votes3
answers727
viewsDoes complex code interfere with application performance?
I have a somewhat legacy C# web application, which works on my client, but it’s been about 3 years. At the time, I programmed as I learned in college and did not know the concept of clean code. It…
-
3
votes1
answer154
viewsWhat is the average cache time for static files?
What is the average cache expiration time for poorly updated static files? There are techniques or recommendations that can help me to determine the expiration time? An example would be:…
-
3
votes1
answer426
viewsHow to improve the performance of a foreach
I’m consuming a webservice, that has at least 5557 records. The problem is after consuming. I have to add in my database the records, and for that, I have to do a foreach, what ends up disturbing a…
-
3
votes2
answers301
viewsDoubt regarding permanent links to posts
In my project, users can post, and I would like each post to have a permanent link so it can be accessed separately. What I’ve already thought: Create an archive php post. that would receive the id…
-
3
votes4
answers142
viewsDoes calling dozens of classes in a system noticeably influence the performance of the application?
I’m starting to work with object orientation in PHP and would like to know if the amount of existing classes in a system can interfere in the performance of it or if it would have to be hundreds of…
-
3
votes1
answer252
viewsMore performative way to return data to the View
In a view where we return a list of objects, and we need to demonstrate the quantity, as a small report, using some conditions. What is the most performative way to return data to view? Explaining…
-
3
votes1
answer180
viewsIs it true that ++$variable (preincrement) is faster than $variable++ (post-increment)?
It is true that ++$variavel is faster than $variavel++? In that reply given in SOEN, we see the following excerpt: ... However pre-incrementing is Almost 10% Faster, which Means that you should…
-
3
votes1
answer221
viewsDoubts about gzip compression on IIS servers
I have a question, I have accommodation in kinghost and before activating the support I would like to know if what happens is even a problem. what happens is that the static files (mainly in…
-
3
votes2
answers1472
viewsDatabase for mobile devices
I’m creating a mobile app and need to use a database to store user data. I’ve thought about Sqlite, but it is not recommended to use it on sites with more than 100 thousand requests per day, and if…
-
3
votes1
answer1218
viewsFind out if a point is within a circle on a Cartesian plane
I was doing the task Target shooting of the 2013 Brazilian Computer Olympiad (OBI) at Programming level 2, which can be found here, and I was able to do it without great difficulty. The task was to…
-
3
votes1
answer94
viewsCompare performance of two PHP scripts
I worked on a script PHP, later I found it too complex and heavy and felt the need to simplify it. eliminated some unnecessary functions; simplified some parts of repeated code into functions; I…
-
3
votes1
answer103
viewsSimple code performance improvement in C
I had a proof that the question was : Cosiderando that the periods of history are four: (1) period prior to 4000 BC; (2) from 3999 BC to 476 AD; (3) from 477 AD to 1789 AD; and (4) after 1790 AD.…
-
3
votes1
answer258
viewsHow to improve the performance of a key search?
In view of the fact that TDictionary exposes only ways to recover value through the key, I have the following algorithm to fetch a key from its value: var Table: TDictionary<Int64, Extended>;…
-
3
votes1
answer687
viewsHow does the frame-Pointer work?
In the official GCC documentation there is a option that allows you to remove the frame-Pointer when it is not necessary. What the frame-Pointer ago? How removing this pointer can improve…
-
3
votes1
answer76
viewsPerformance in applications with multiple loops
While searching a little, I found several codes in Java to calculate the determinant of an array. I passed one of them to javascript and it was like this: function determinant(A, N) { var det = 0;…
-
3
votes2
answers125
viewsShould I use int_least8_t or int_fast8_t?
I am studying the limits of types that c++ 11 brought and I noticed that there are officially several types of integers. In addition to the Joint Declaration int now I can declare: int8_t…
-
3
votes1
answer70
viewsWhen relating two tables, is the correct one on the SQL side, PHP or whatever?
I have this doubt of what is preferred to do when I need data from the two tables to get the result. I always did the comparison in PHP, but I learned the SQL relationship commands that could help.…
-
3
votes2
answers4279
viewsCan setting run-time to infinity affect server performance?
Generally, I see many people (including myself) have run-time problems with a PHP script. This is because, by default, PHP sets a deadline for running a script in 30 seconds. These problems usually…
-
3
votes2
answers999
viewsWhich is more efficient, perform multiple queries or use JOIN?
I have a table X that has my user data, and I need to return to the client the data related to that user in the table Y and Z. I can do it using JOIN or: SELECT attr1, attr2 FROM Y WHERE X_id = id…
-
3
votes2
answers59
viewsWhat is the usage limit of . push_back()?
I use a lot .push_back(element) when I’m working with vector, but I don’t know what’s the most elements I can add to a vector before it overflows and performs the reallocation of a new space in…
-
3
votes1
answer115
viewsWhy does bitmap indexing work well for low cardinality domains?
I have just read chapter 29 of the book Overview of Data Warehousing and OLAP On page 725 the author talks about indexing techniques to support high performance access, this technique is called…
-
3
votes1
answer715
viewsHow to increase performance in PHP?
If I increase the memory_limit (default: 256MB) in PHP settings, my application will run faster or I will end up losing performance because it consumes more server CPU processing?…
-
3
votes1
answer306
viewsPHP x C++ web performance and security
Today I work in a company that manages some sites with too much traffic, which is generating some problems of server overload and etc. These sites are mostly news portals and are running Wordpress,…
-
3
votes1
answer278
viewsDecode vs Case Query
We have two ways to work with condition within consultations in Oracle SQL, are they the Case and the Decode, the two have the same function. Allow dynamically and practice how to get a return from…
-
3
votes2
answers106
viewsPerformance of ternary operator
I recently came across an assignment to a boolean variable as follows: bool varTeste = (varEntrada == 100) ? true : false; I know this is the same as the code below: bool varTeste = (varEntrada ==…
-
3
votes1
answer266
viewsAlternative String.replace()
I got a flea behind my ear. I have a method that removes / changes some characters from the string, it is something like this : public static String replaceCharSet(String texto) { texto =…
-
3
votes1
answer775
viewsHow do you read the ADVPL profiler report?
I recently asked a question about how to analyze the impact of a chunk of code on ADVPL. The big @siga0984 gave a great answer, and even with my little intimacy with Protheus I managed to connect…
-
3
votes1
answer127
viewsTypes of ordering and their performance, which one to choose?
I know of various forms of ordination such as Selection Sort, Bubble Sort and Quicksort, we also have PHP functions like sort() and array_multisort(). Currently the system I developed works with…
-
3
votes1
answer240
viewsWhat is the most performative way to convert int[] to int?
What is the most performatic way to convert the inverted positions of a array for int? For example, the following array should work in full 153 for the purpose of future calculation: int[] a = new…