Skip to main content

New answers tagged

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 ...
ArwynFr's user avatar
  • 1,850
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
fuzzy-memory's user avatar
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 ...
Quốc Dũng's user avatar
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 ...
trincot's user avatar
  • 358k
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 ...
przemek hertel's user avatar
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 ...
ArwynFr's user avatar
  • 1,850
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 ...
Jérôme Richard's user avatar
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 ...
O. Jones's user avatar
  • 110k
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 ...
Rick James's user avatar
  • 144k
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 ...
rsaxvc's user avatar
  • 1,795
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 ...
njuffa's user avatar
  • 27.4k
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 ...
Reinderien's user avatar
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 ...
David Osborne's user avatar
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 ...
Foxfire And Burns And Burns's user avatar
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 ...
Dharman's user avatar
  • 34k
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...
Turo's user avatar
  • 5,079
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?
Joe Love's user avatar
  • 6,136
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 ...
Turo's user avatar
  • 5,079

Top 50 recent answers are included