Most voted "optimizing" questions
In programming, optimization typically takes the form of increasing the speed of an algorithm, or reducing the resources it needs.
Learn more…134 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 11 years, 9 months ago Maniero 444,682
- 
		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:… 
- 
		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 11 years, 7 months ago Guilherme de Jesus Santos 6,566
- 
		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 votes2 answers3688 viewsWhat are the advantages and disadvantages of minifying Javascript scripts?And which mini-guards can I use? 
- 
		23 votes1 answer2914 viewsIndexes in Mysql queriesUsing indexes in mysql queries really makes the result come quickly for some large queries or tables. For example in the query below: SELECT * FROM table WHERE status = 1; For a table with 1 million… 
- 
		23 votes3 answers627 viewsOptimize Java method using the Scopes conceptWell 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… 
- 
		19 votes1 answer11373 viewsHow to use a specific index in a SQL Server query?I have a non-standard table in SQL Server installed on my PC which is fed monthly by Integration Services (SSIS) from a report in an Excel spreadsheet. I mean, I’m keeping track of a certain report.… 
- 
		19 votes1 answer941 viewsHow does C/C++ "padding work?In several responses here at Stackoverflow I have noticed users commenting on padding in data structures. struct { int a; char b; float d; } What is this one padding (filling) that exists between… 
- 
		16 votes1 answer673 viewsDoes compiling on your computer really improve performance?Any programmer knows that when building a C/C++, the compiler can optimize the code to generate faster executables. But, it is also said that there is the compiler optimization for your processor.… 
- 
		12 votes3 answers1569 viewsHow to create multiple entries in an index based on columns in the same row?I have never found a good way to index multiple columns of a row as index entries or simulate this feature in Mysql. The problem arises when you have fields working as tags or a similar concept.… 
- 
		12 votes1 answer660 viewsHow to optimize the game Battleship in JAVA?I don’t know if this is allowed here on the site, so in case I’m breaking any rules let me know! I recently started learning the JAVA language. I made a naval battle game (human x computer) using… 
- 
		12 votes2 answers312 viewsOptimization of SQL codeHow can I optimize the following code to not use 3 Selects and not plaster the query to only 3 status ( SELECT * FROM historico WHERE his_status = 'FRACASSO' ORDER BY his_data DESC LIMIT 50 ) UNION… 
- 
		11 votes2 answers665 viewsHow to determine the smallest number of small areas to render?I have two images (pixel arrays), one of which is rendered on the screen. The goal is to render the second. However performance is critical and, in the environment where I am, render each pixel is… 
- 
		11 votes1 answer323 viewsWhat are build cache structures?In that question where I wanted to know if I should store settings in a global variable $GLOBALS, I got some very good answers, and there was one that talked about something that I hadn’t even… 
- 
		11 votes2 answers1385 viewsWhen to use "inline"?Everybody says you don’t have to use inline functions since the compiler knows what to do better than the programmer. But if it has in the language it should serve for something. Is it useful in any… 
- 
		10 votes4 answers1546 viewsHow can I optimize a recursive method for finding ancestors?I have a class Pessoa who owned relationships for his father and his mother (these at any time may be null). On a particular piece of my code I need to find out if one person is an ancestor of the… 
- 
		10 votes3 answers302 viewsWhat is the cost of calling many functions?Recently, faced with a discussion about Clean Code and programming best practices, a co-worker commented that in his previous job he had a lot of resistance on the part of the other programmers to… 
- 
		9 votes3 answers10114 viewsWhich JSON structure to use for large data volume without loss of performance?I am thinking about using JSON in a project, because it is highly accepted and there are many libraries ready that encode and decode it in other objects (arrays, for example), but there is something… 
- 
		9 votes1 answer256 viewsWhat is an unrolling?In this question I asked about optimization and performance that the compiler performs. Among the highlighted items, users commented that the compiler makes an optimization called loop unwinding or… 
- 
		9 votes2 answers750 viewsHow to improve the performance of my code with "for"?I have the following code: for ($i=0; $i < 10; $i++) { for ($j=0; $j < 20; $j++) { for ($p=0; $p < 40; $p++) { echo $vaar[$i][$j][$p]; } } } I believe a code that contains a for inside… 
- 
		8 votes1 answer723 viewsCreating a Java Interpreter for android?I am developing an android application where it will be possible to write a java code and run... something similar to the visualg. then I did something different than most tutorials on compilers and… 
- 
		8 votes2 answers168 viewsWhat makes an object eligible to be allocated in the stack?Article link: http://www.vogella.com/tutorials/JavaPerformance/article.html#Escape%20Analysis "The Programming language(Java) does not Offer the possibility to Let the Programmer decides if an… 
- 
		8 votes3 answers223 viewsHow to simplify a problem to get the names of the months of the year?I am beginning to program in C and I realized this problem whose statement is the following: Write an exercise that asks the user for a one-month number and prints the name of the month on the… 
- 
		7 votes2 answers969 viewsHow to do an optimization with inequality restriction?Suppose I want to minimize the following function: -(5-(x1-2)^2-2*(x2-1)^2) s.a. x1+4*x2 < 3 For optimization problems without restriction I can use the following code. fr <- function(x){ x1… 
- 
		7 votes2 answers1444 viewsHow to organize code without losing performance?Using functions instead of putting code directly influences a program’s performance ? For example: void minhafuncao(){ printf("Funcao"); } main(){ minhafuncao(); } in place of main(){… 
- 
		7 votes1 answer128 viewsIs there any way to optimize this code?How to optimize this code to make it faster? if (strpos($qt, "blood") !== FALSE){ if (preg_match("/^blood (?<blood>.+)$/", $qt, $match)){ switch ($match['blood']) { case "a+": $result = "A+";… 
- 
		7 votes1 answer2978 viewsPagination with large amount of dataThinking about performance, what is the best way to paginate a large amount of data? I’m currently wearing a List<Produtos>, keeping around 500 products in it, and using subList(min,max),… 
- 
		7 votes1 answer3570 viewsWhat is the purpose of using inline functions in the C language?I would like to know what is the purpose of functions inline in the language C? Is there any difference in performance or other characteristics that should be taken into account in comparison to… 
- 
		6 votes1 answer3596 viewsInterpret the Mysql Explain commandI have a query that is taking 6/8 seconds to execute. The database I’m using is Mysql. In Phpmyadmin I did the following: EXPLAIN SELECT id_categoria, sc.categoria, categoria_principal, associada… 
- 
		6 votes2 answers532 viewsAdvanced image optimization and compression on web servers without using external servicesHow to do even more optimized compression than you can achieve with tools like ImageMagick and libgd (GD) without generating WEBP image? Some services such as https://tinypng.com/ and… image optimizing unix image-compression image-processingasked 10 years, 4 months ago Emerson Rocha 3,710
- 
		6 votes1 answer392 viewsHow to calculate point cardsI am developing an application that matches the calculation of total hours worked on points cards, taking into account whether it is night time reduction or not and, if it is, what is the entrance… 
- 
		6 votes2 answers188 viewsSQL Query Optimization in Mysql and IndexGuys I’m having a performance problem at a consultation SQL in the MySQL who is using my server a lot, I’ve done index and yet consumption does not decrease. The query I’m using is: SELECT CONCAT(… 
- 
		6 votes2 answers606 viewsWhat is a tail recursion?In that question I asked about performance. One of the users replied that the compiler does several interesting optimizations, such as inlining, Loop unwinding, tail recursion and caches. How Tail… 
- 
		6 votes1 answer85 viewsShould I avoid operations between constants in a loop?In C++ there is some sort of optimization or cache that prevents the same mathematical operation between constants to be repeated, mainly in loops, thus decreasing application performance? For… 
- 
		6 votes1 answer69 viewsWhat is the impact on the browser when there is infinite and direct interaction in HTML?I have several polygons that change their points infinitely (while on the page), this interaction is done by a js plugin and in my code I have these calls: var config = { targets: '', points: [],… 
- 
		5 votes4 answers556 viewsWhat is the fastest, most memory-saving type?I am making a game of navinha in C, and therefore need to put in a vector a large amount of projectiles. These projectiles have at least one position and speed to make calculations, and I’m trying… 
- 
		5 votes4 answers545 viewsFile Subdomain, Site OptimizationWell, I heard that for more downloads in parallel the indication is to put them in a subdomain, and even a fact that cookies not go in the request would also make faster. Anyway, truth or myth, how… 
- 
		5 votes4 answers1841 viewsDoes the order of the WHERE clauses interfere with performance?I recently ran some tests on a database with a query using two Where AND clauses. I noticed that there was a significant difference using clause A before clause B and vice versa. Intuitively, it… 
- 
		5 votes1 answer723 viewsProblem loading image in HTML (Performance)While the entire DOM parser process is blocked, this prevents the rendering of the rest of the page. And this if applied to each page script tag. A way that I found to "circumvent" this problem was… 
- 
		5 votes2 answers937 viewsHow to remove CSS and Javascript blocking files in Blogger, such as Widgets.js?I’m trying to optimize the loading speed of my Blogger site by removing unnecessary CSS files that I don’t use, nor do I intend to do in the future. For example: <link type="text/css"… 
- 
		5 votes2 answers147 viewsIn Java because (250 >> 4) is more optimized than (250 / 16)I’m taking a Java course and in a class the teacher said that this code: int xstart = Camera.x >> 4; int ystart = Camera.y >> 4; is more "fast or optimized" than this code: int xstart =… 
- 
		5 votes1 answer612 viewsWhat tools to optimize a C#code?Code optimizer tools aim at, for example: - Removal of dead code: removes any dead class, attribute, or method code that is not referenced and used in the project. - Rewrite and reduce functions:… 
- 
		5 votes3 answers1291 viewsOptimize HTML video 5I’m developing a website. In each header this site will have a video, it would be the same video for all headers. I used the tag video of HTML5 even stayed and so: <div class="video-institutional… 
- 
		5 votes2 answers111 viewsShould I avoid repeated access to the same method within a loop?I worry about the final performance of an executable, at the same time I don’t want to penalize the programmer with excessive or unnecessary care in the code. In the code below, for example, it will… 
- 
		5 votes1 answer106 viewsIs an executable in imperative programming language smaller than an executable in object-oriented language?Well, that is, usually object-oriented programs have several calls to small methods for passing messages, encapsulation is also a common consequence of the model, not to mention polymorphism and… 
- 
		4 votes2 answers6308 viewsOptimize Mysql tablesI work with some huge tables in a system I developed. These tables are constantly being updated and sometimes the query becomes slow. Some of them even have more than 100,000 lines. I would like to… 
- 
		4 votes3 answers154 viewsOptimization of PHP functions for database querysI often see different functions in PHP for each query. I wonder if there is any other way to do the following, in a connection with PDO: function get_user_data($table, $columm, $required) { $db =… 
- 
		4 votes1 answer281 viewsOptimize search in MysqlHello I have a query that I can’t optimize. Records: 1.904.447 records Name: table_mae Related to Records: 10.748.360 records Name: table_son -- index criado para id_tabela_mae -- index criado para… 
- 
		4 votes2 answers1229 viewsImprove code performance in C#I’m doing some tests with some C# codes and during an analysis I realized that some high-peak problems happen when integer value conversions occur to string, in the vast majority the conversion…