Most voted "performance" questions
For questions involving measurement and improvement of code efficiency
Learn more…479 questions
Sort by count of
-
124
votes8
answers5920
viewsIs it always guaranteed that a multi-threaded application runs faster than using a single thread?
It is possible to observe in some cases that the separation of tasks into multiple threads does not give gain and even makes an application slower than the use in thread unique. It should not always…
competition performance multithreading parallelism optimizingasked 10 years, 10 months ago Maniero 444,682 -
74
votes5
answers2194
viewsExceptions consume a lot of processing. Truth or legend?
I’ve seen shows like this : if(!clienteExiste(1)) { return "Cliente não existe."; } and others like that if(!clienteExiste(1)) { throw new Exception("Cliente não existe."); } The second code will…
-
43
votes5
answers2270
viewsUsing unused affect performance?
While I was developing, I saw that in most of my classes contained a certain amount of using that were not being used and came to me the doubt of the title. Using unused affects the performance of…
-
43
votes3
answers1083
viewsTo what extent is premature optimization a problem?
Premature optimization is when there is an excessive concern on the part of the programmer with the performance of the application. It is usually condemned by some programmers for reasons such as:…
-
41
votes2
answers838
viewsWhat is the overhead of using object orientation?
In the company where I work today we are strongly encouraged to avoid object-oriented programming for both old and new projects. For old projects I agree that it is a bad practice to start inserting…
php oop performance software-architecture characteristic-languageasked 9 years, 9 months ago jlHertel 4,733 -
39
votes2
answers1301
viewsHow does the G1 (Garbage First Collector) work?
In the JEP-248 the definition of G1 has been discussed (Garbage First Collector) as the standard Garbage Collector on Java 9. In this period, I have heard many quotes about the G1, but very little…
java performance memory-management jvm garbage-collectorasked 9 years, 3 months ago Reginaldo Soares 2,256 -
37
votes2
answers2324
viewsWhy do they say using arroba to suppress errors is bad practice?
In PHP, we can suppress errors using arroba before certain expressions. This can be seen in: What is the function of@at the beginning of PHP expressions I already watched some Hangouts on PHP and…
-
35
votes3
answers881
viewsIs there a difference between reporting the size in the loop condition or outside it?
If I have an array or collection in a Arraylist and need to go through its elements, occasionally need to make use of loop repetition. Ex.: for(int i = 0; i < arrayList.size(); i++){…
-
33
votes1
answer522
viewsDoes the size of a function affect memory performance and consumption?
Does the fact that a function is higher or lower affect the performance of the application? Especially in PHP. If you need performance, it would be better to perform large or small? And memory…
-
33
votes2
answers564
viewsPerformance in PHP: consider or not?
I see great connoisseurs here of Sopt, saying the phrase: "Want performance, forget PHP" For example, questions about PHP: "How can I improve the performance of that?" Of course we know that…
-
32
votes5
answers1927
viewsWhy is multiplication faster than division?
Bit brushing question, but I was reading an article about javascript in which says that division is slower than multiplications. And for example, I would recommend changing the code below : var…
javascript mathematics performance optimizing characteristic-languageasked 10 years, 7 months ago Guilherme de Jesus Santos 6,566 -
30
votes6
answers10949
viewsHow to measure code performance in PHP?
To measure performance and compare two codes in javascript, I do it like this, in the browser console: // Vamos testar o código 1 console.time('teste1'); for (var i = 0; i++ < 10000;) { $('#table…
-
29
votes3
answers1131
viewsString and its efficiency
Doubt I would like to know what design patterns or other "nerdy" things have been applied to this class StringBuffer. Why does String create new objects in a concatenation? As far as I know, String…
-
29
votes3
answers847
viewsDoes merging PHP files into one only increase performance?
I get the impression that every time I execute the command dump-autoload to generate the autoload of the classes via composer, an archive bootstrap/compiled.php is created. Within it, there seems to…
-
28
votes1
answer443
viewsWhy is processing an ordered list faster than an unordered one?
I have a C++ code that for some inexplicable reason seems to run much faster when my data is previously sorted. I was able to reproduce the behavior with the following code: #include…
-
28
votes3
answers466
viewsComments weigh in?
Comments weigh? I leave comments throughout my code, will influence something on the site? I’m saying more specifically in HTML, CSS, Javascript, PHP.
-
27
votes6
answers23686
viewsDifference between absolute and relative Urls in page contents
The contents of the page can be requested by entering a complete URL, relative or relative to the root of the location where our base file is located (generally the index.php or index.html):…
-
26
votes3
answers10445
viewsReact Native or Ionic?
I need to create an App and would like to know which of your technologies is the most suitable for mobile development today. What is the main difference between Reactnative and Ionic? Which of the…
-
25
votes1
answer19287
viewsHow does PHP-FPM work?
Guys, I have a question related to the concept of PHP-FPM. From what I understand from the documentation, it is a module of PHP that manages requests to the server to avoid high loads, or am I…
-
25
votes6
answers17379
viewsHow to improve reading performance of a SQL Server database?
I have a database with more than 250 tables, there are tables with more than millions of records and when I need to search or change some of these records, it takes a lot of time, which ends up…
-
24
votes1
answer2772
viewsAre unnecessary bank ratings a problem?
Indexes are usually added to improve the performance of queries. However, it is not usually recommended to add indexes in all columns, only where the need is identified. Why this recommendation?…
-
24
votes1
answer678
viewsWhat is data-driven design?
I came across the term data-oriented design, I saw some things and I was a little surprised because what I could see on top is different than what I could imagine, since these terms usually refer to…
terminology performance modeling encoding-style paradigmsasked 7 years, 3 months ago Maniero 444,682 -
23
votes3
answers627
viewsOptimize Java method using the Scopes concept
Well some time ago, when I took some classes J2ME to Mobile (almost deceased ), where I was presented to a concept of scope hitherto unknown by me, that would be: { // cria um novo escopo } Where…
-
23
votes2
answers5722
viewsWhat’s wrong with the N+1?
Whenever we work with some ORM, it is common to fall into the problem of darlings N+1. It’s something about performance, called even antipattern. But what is really this problem, why it happens,…
-
22
votes2
answers609
viewsCould current Javascript engines optimize "tail" recursive calls?
In functional programming, it is very common to use functions recursive. Certain languages, such as Scheme, do not even have control structures for loops, depending on recursion to iterate over…
-
22
votes3
answers742
viewsHow to improve the performance of static files on a website?
My site has 10 sheets of styles (CSS) and 15 scripts (Javascript / jQuery), outside the images, this influences a lot in loading. In your opinion, what is the best way to make the site…
-
21
votes2
answers378
viewsPerformance in creating strings in Java
What is the best way to create strings in Java to get better performance? Here are two examples of creating strings in Java: Ex. 1: String str = "string"; Ex. 2: String str = new String("string");…
-
21
votes3
answers5317
viewsWhy use get and set in Java?
I learned in college a while back that you should always use getters and setters for access of values in an object and I heard that it is for security reasons. So I ended up always using and seeing…
-
21
votes1
answer622
viewsAt what times is it necessary to force garbage collection in C# for better application performance?
Usually I always have doubts about the use of functions for memory release, in which situations should it be used or should it always be used? And mine really will perform better? If possible…
-
20
votes1
answer422
viewsIs replacing strings with Regex slower than Replace()?
Let’s say I want to do something like this question: How to convert Camelcase to snake_case in C#? You had some answers, but I want to highlight these two. Answer 1 string stringSnake =…
-
17
votes1
answer11086
viewsHow to check the execution time of a method?
Example: I have the Metodo1 and the Metodo2 both have different processing and actions. I want to check how long each takes to run. How do I do that?
-
17
votes1
answer1949
viewsWhenever I am going to scan a string in C I must use "strlen()", right?
It is common to see in C execs that people need to analyze and/or manipulate the content of a string, then we need to make sure that it will not exceed its limit. It is very common to make a for…
-
17
votes3
answers747
viewsHow to test my site on a slow internet?
When completing the development of a website or system, we always test its performance with our internet. Faced with this, there is some way to simulate the performance of my system a slow internet…
-
16
votes2
answers596
viewsWhy is there such a difference in performance between stream and normal loops?
I was reading a article related to the performance of streams/loops, and was startled by the difference in performance between the use of loops for large quantities of data. I decided to perform a…
-
15
votes1
answer1791
viewsHow to apply Dexes to improve the performance of the queries?
I’m looking to increase the performance of my database, which has over 1 million records. Research I have undertaken Sobre index link1 Cluster-wise link1 Link2 Doubt The idea of cluster it seemed…
-
15
votes1
answer1419
viewsWhat is the advantage of semicolons in programming languages?
I know that in programming languages like Java and C#, the semicolon indicates the end of the instruction, as in the example below, in C#: System.Console.WriteLine("Hello, World!"); However, there…
-
15
votes1
answer201
viewsDoes creating many static classes impact system performance?
I’ve been creating many static classes to facilitate and clear code, such as a Google Translate API call. public static class GoogleTranslate { public static string Translate(string word){ //código…
-
15
votes4
answers2051
viewsDropping indexes or Foreign Keys in a table can slow the query?
What I always read some tutorials talking about Mysql and I’ve also heard from some fellow programmers is that the lack of indexes or foreign keys in a table can make a query slow. For example, I…
-
14
votes1
answer287
viewsWhat is the technology behind virtual machines?
Besides Java and the environment .NET various other environments such as Python, Ruby, Moon, etc interpret bytecodes. In the first versions Java left to be desired in terms of performance, but the…
-
14
votes1
answer276
viewsWhy is using String in a switch block more efficient than in an if-Else block?
According to the java documentation: The Java Compiler generates generally more Efficient bytecode from switch statements that use String Objects than from chained if-then-Else statements. Not to…
-
14
votes2
answers625
viewsIs it really necessary to use mutator and access (Setter and getter) methods in PHP? What about performance?
I’ve been noticing that most other libraries use the methods setters and getters (hereinafter referred to as mutator and accessor), to change the property of some classes. For example: class User {…
php performance pattern-design encoding-style getters-settersasked 8 years, 9 months ago Wallace Maxters 102,340 -
14
votes3
answers2619
viewsCan subqueries decrease performance? Myth or truth?
Well, I usually just work with frameworks. I work with frameworks MVC and I usually use Orms to query the database. In my case I use Laravel, but I’ve used other frameworks, and had the opportunity…
-
14
votes4
answers2496
viewsPerformance of COUNT(*) and COUNT(1)
What’s the difference between COUNT(1) and COUNT(*) in an SQL query. For example: SELECT COUNT(1) FROM USUARIOS; and SELECT COUNT(*) FROM USUARIOS; Is there any difference of interactions within…
-
14
votes3
answers2102
viewsWhat is the difference between function and array assignment?
I have recently been coding in my projects where I need to add items in an array, so I don’t know if I should use native language functions for this, for example: array_push($meu_array, 50); or if I…
-
14
votes2
answers355
viewsWhat are the main differences and advantages of using Shadow DOM and Virtual DOM?
Analyzing carefully for a better performance of an application, what are the main benefits in using one or the other and their differences? Angular for example works with the Shadow DOM approach,…
-
14
votes2
answers314
views=, BINARY, LIKE, LIKE BINARY, REGEXP, SQL binary grouping
Reformulation of the question based on @Gabrielhenrique’s answer and research: What is binary grouping in a string column in the table? BINARY serves to make a case-sensitive search and LIKE…
-
13
votes3
answers2226
viewsPerformance: string "concatenated" or all in the same line?
I have a loop with thousands of results that renders a table. The string is mounted through Stringbuilder in this way (sample snippet): ScriptTbody.AppendLine("</select>");…
-
13
votes2
answers1173
viewsIs it safe to minify HTML?
Like JS and CSS, HTML can also be "minified": <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">…
-
13
votes2
answers668
viewsWhy is a Fibonacci faster in Java than in C?
Not exactly like this, but I noticed that when the function needs more time to compute Fibonacci, Java actually does better than C. Here are the implementations: C: #include<stdio.h> unsigned…
-
13
votes3
answers1055
viewsIs there any performance gain when using ternary operator instead of a conditional operator?
What is the difference in performance using conditional operators and ternary operators? Is there any significant gain or the choice of use of ternary operators is unique to code simplification?…