New answers tagged optimization
Advice
0 votes
0 replies
0 views
DDD Aggregate Roots: How to avoid loading unused child entities without tightly coupling to the ORM?
It is an option, not a design principle. Sharing domain objects is usually more concerned with business capabilities and validation (methods) than data structure (properties). The question is whether ...
Advice
0 votes
0 replies
0 views
How to decide number of partitions using repartition vs coalesce in Apache Spark for optimization?
A good rule of thumb for deciding the number of partitions would be twice the number of executor cores available
Advice
0 votes
0 replies
0 views
DDD Aggregate Roots: How to avoid loading unused child entities without tightly coupling to the ORM?
Thank you for sharing your valuable insights! I really appreciate it, as it's hard to find in-depth discussions about practical DDD out there. I have a follow-up question regarding your point: You ...
0 votes
Optimization 8-puzzle
The main bottleneck in your implementation is use of a deque to implement the A* priority queue. Having to (re)sort that deque on each iteration of the outer loop comes with a performance impact. Use ...
0 votes
What to do with Java BigDecimal performance?
I participated in writing many systems intended for banks and insurance companies. In all of them, critical calculations were performed using double variables. However - and this is important - all ...
Advice
0 votes
0 replies
0 views
DDD Aggregate Roots: How to avoid loading unused child entities without tightly coupling to the ORM?
How to load only what I need? Are there good patterns to run business logic on an Aggregate Root without loading the whole object tree, while still keeping the business rules safe? You are allowed to ...
2 votes
Accepted
How can I speed up vertices showing and animation?
First of all, pygame.key.get_pressed()[pygame.K_RIGHT] and pygame.key.get_pressed()[pygame.K_LEFT] are recomputed len(vertices) times while this is not actually needed. While you can pre-compute it ...
Best practices
0 votes
0 replies
0 views
How do developers usually handle database optimization for growing WordPress sites?
First, make a backup and make sure you can restore it in case you fat-finger something. Even better, try out all these optimizations on a staging site before using them on a live site. I wrote a free ...
0 votes
Optimizing Exact Filtered Pagination Count (COUNT(*)) on MySQL with Dynamic JSON Filters in Spring Boot API
Since you need to get at various parts of the JSON, you should make columns for those parts in the table. Extract them when receiving the data. Also, do cononical transformations as desired (remove ...
0 votes
Optimizing JPEG quantization table for grayscale text document images
I have total control of the JPEG encoding parameters, including subsampling ratios and quantization matrix. I would start with 444(no subsampling) and q=100 and revisit subsampling and q<100 later ...
1 vote
Compute sin(x)-x efficiently to double precision accuracy on range |x| <= pi
There are obvious trade-offs between accuracy and efficiency here. As opposed to the computation of exp(x)-1, where the most significant term is 0.5*x, which can be computer error free in binary ...
0 votes
Genetic algorithm for kubernetes allocation
Let's stay in Python, and keep using the test data you offered. This is not a greedy solution, it's an optimal one. LP works, and you can reduce the number of nodes down to 4 and all pods will still ...
Advice
0 votes
0 replies
0 views
DDD Aggregate Roots: How to avoid loading unused child entities without tightly coupling to the ORM?
Can't speak for EF, but NHibernate offers the ability to filter collections. This provides the ability to load an aggregate root but only load related entity based on some criteria. IIRC, UML has the ...
Advice
2 votes
0 replies
0 views
Sorting Multi Variable Data into Efficient Groups
This in, indeed, a question too abroad with no real data or any efforts tried. I guess you want to create those 10 groups based on different variables (your data). You could take a look to clustering ...
0 votes
What are the memory implications of passing a MySQLi result to a function in PHP?
You don't need to worry about memory implications in this case. $result is an object of type mysqli_result. When you pass an object into a function, only its identifier is passed and not the whole ...
Best practices
0 votes
0 replies
0 views
What is the most efficient way to maintain a real-time COUNT(DISTINCT column) on a large PostgreSQL partitioned table?
The Table bars should have the primary key/index bar, depends on how many distinct values there are. If its a small number it could be the table never leaves the db-cache and the index is not used...
Best practices
0 votes
0 replies
0 views
What is the most efficient way to maintain a real-time COUNT(DISTINCT column) on a large PostgreSQL partitioned table?
Is this distinct column indexed in any way?
Best practices
0 votes
0 replies
0 views
What is the most efficient way to maintain a real-time COUNT(DISTINCT column) on a large PostgreSQL partitioned table?
You could create a table bars with columns bar and bar_count, fill it initially with SELECT bar, count(*) from foo group by bar. Then you need to let INSERT/UPDATE/DELETE TRIGGER on foo handle the ...
Top 50 recent answers are included
Related Tags
optimization × 39915python × 7358
performance × 4441
c++ × 4128
algorithm × 2835
mysql × 2623
java × 2396
c × 2268
javascript × 1994
c# × 1962
r × 1911
sql × 1837
php × 1459
matlab × 1214
scipy × 1203
numpy × 1069
arrays × 1036
gcc × 847
query-optimization × 724
python-3.x × 682
database × 641
loops × 636
mathematical-optimization × 620
android × 614
pandas × 604