оптимизация

Speed up working with strings

There is an array (1-10 elements) consisting of long (up to 10,000 characters) immutable strings. There is also one (equally ... ealized that the program should run faster if I pass values to the function by reference (or pointer). Any other suggestions?

Text output: should I use echo or not?

When creating any site, you must use HTML code to build blocks and generally build a site. And often this code is located in ... er? Or still can you not think about it and write as convenient as possible? What if you output a lot of HTML code via echo?

How do the algorithms for calculating matlab matrices work?

How do matlab calculations work? In particular, how does it work with matrices? Can anyone explain, or give links to the rele ... gorithm, or perhaps my class is not optimized that much. Matlab also performs all other operations with matrices much faster.

Counting the number of all palindromes in a string

Help me solve the problem. The function counts the number of all palindromes in a string (single-letter ones are also counted ... t = s[i:j] r = ''.join(reversed(t)) if t == r: res = res + 1 return res

What's faster: Dynamic memory allocation vs array, Windows 7 vs Linux

A test is written to measure the speed between dynamic memory allocation and array usage, as well as between Windows 7 64-bit ... gh new and delete are used? Why is Linux faster than Windows 7? PS. Both use the release version with speed optimization.

Deleting data from multiple linked tables

There are three tables linked one-to-one by ID. I need to delete all records from three tables that satisfy the condition: A. ... D LOOP; COMMIT; END; There is a lot of data and so it works for a very long time. Is there any way to make it faster?

Android-Code Optimization

Hello! I display a background that will scroll slowly (as in Parallax Scrolling), the size of the scrollable image is 16k+ by ... p and made drawing without anti-aliasing, FPS increased from 3 to 14 on Chinese devices. But optimization is still required.

Python Anagram Search (Optimization)

There is a task where you need to find the number of pairs of anagrams.I wrote the code using Counter, but it works too slowl ... range(n): tmp.append(input()) for i in range(n): x = tmp.pop(0) comparing(tmp,x) print(comparing([0,0],-999))

Animating sprites more than once

I wanted to make sure that all the information about the sprite is stored in the object and the drawing function can be used ... idthGen, widthGen); //отображение первого спрайта } <canvas id="field" width="900" height="400">hi</canvas>

How to calculate the determinant of the matrix more efficiently?

The code below counts the determinant of the 20x20 matrix by the minor method and records the time it took to calculate it. B ... nge(N)] print(f"result:\t{division(matrix)}") for i in range(N): print(matrix[i]) print(f"Time:\t{time.time() - timer}")

MS SQL query optimization

Hello, please help with query optimization there are 2 tables DOCUMENT([DOC_DATE], [SUM], [FIRM_ID]) And FIRM([FIRM_ID], [N ... UMENT.DOC_DATE Tell me how to optimize it if the FIRMS table contains 150,000 records, and the DOCUMENTS table weighs ~50 Gb

Optimization of the Mandelbrot set

I made a program in which you can approximate the Mandelbrot set My question is how can it be optimized? import pygame from p ... x += x0 y += y0 scale *= 5 mandelbrot(x, y, scale)

Bitwise operations - which ones are useful for programmers of "higher" levels to know about?

Hello! I ask this question more for self-education than out of a real momentary need: What do "higher-level" programmers ne ... of a number without a comparison operation Do bitwise operators (other than shifts) make any mathematical sense in base-10?

Request via Python.Requests takes an extremely long time to complete

I am developing and testing (via requests) the code of a remote server, from some day I suddenly began to receive responses w ... y AAAA with an invalid IPv6 address, in addition to A an entry with a valid IPv4, and deleting this entry solved the problem.

Selection of methods for optimizing mathematical functions

Due to the increasing importance of machine learning and approximate methods for optimizing loss functions, I would like to have a list of different options for optimization algorithms. If you want to add another optimization method, edit the answer

stl: time spent for adding elements to a vector

Please explain where the legs can grow in time costs when working with the addition to the vector: There are the following da ... e else do not occur, then why add empty ones !!! chains for which only 2 reserve() are called for each spending so much time?

Brute force works for a long time as you can speed up the execution of the program

Password-protected archives are given. The archives were created by the 7z program. #include <ctime> #include <fstr ... bruteForce(file_name); string pass = dictionary(file_name); printFileContent(pass, file_name); return 0; }

runtime error when solving a python problem

Task: Given a tree with n vertices and a number k, we want to find the smallest number of edges, when removing which there i ... en this code on the pros, he went in, i.e. the problem is not in the algorithm. What are the options for why it doesn't work?

How to optimize an sql query (a sample of 1.5 M rows)?

I select data between two dates with the number of rows more than a million with this query: SELECT time AT TIME ZONE 'UTC ... ion time: 5414.691 ms The query runs for 9-13 seconds (although explain shows 5.5). Is there any way to optimize the query?

Why use mixins?

Why use mixins in preprocessors? If we can create a special class. For example there is such an html structure: .defa ... ive both options the same way(i.e. it doesn't care if these styles are applied to the element directly or via another class)?