Questions tagged [tradeoff]

44 questions
57
votes
11 answers

Why not mark everything inline?

First off, I am not looking for a way to force the compiler to inline the implementation of every function. To reduce the level of misguided answers make sure you understand what the inline keyword actually means. Here is good description, inline…
deft_code
  • 57,255
  • 29
  • 141
  • 224
33
votes
4 answers

Differences between System V and Posix semaphores

What are the trade-offs between using a System V and a Posix semaphore?
corto
  • 2,657
  • 4
  • 21
  • 9
33
votes
16 answers

Why should I ever use inline code?

I'm a C/C++ developer, and here are a couple of questions that always baffled me. Is there a big difference between "regular" code and inline code? Which is the main difference? Is inline code simply a "form" of macros? What kind of tradeoff must…
Marcos Bento
  • 2,030
  • 4
  • 22
  • 19
29
votes
4 answers

Advantages of firestore sub-collections

The firestore docs don't have an in depth discussion of the tradeoffs involved in using sub-collections vs top-level collections, but do point out that they are less flexible and less 'scalable'. Given that you sacrifice flexibility in setting up…
pwray
  • 1,075
  • 1
  • 10
  • 19
13
votes
5 answers

Redux / ngrx/store architecture: why not dispatch actions from dumb components?

I'm building an Angular 2 ngrx/store application and trying to understand best practices. I love having an immutable state that changes only based on dispatched actions so that the app state is very clear and debug-able. I love one-way data flow…
David
  • 335
  • 4
  • 14
9
votes
1 answer

Python Shelve Module Memory Consumption

I have been assigned the task of reading a .txt file which is a log of various events and writing some of those events into a dictionary. The problem is that the file can sometimes get bigger than 3GB in size. This means that the dictionary gets too…
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
9
votes
1 answer

RAII and unit testing principles

The RAII (Resource Acquisition Is Initialization) is one of the suggested ways of constructing objects. How does it relate to the unit testing principles that are saying: no complex job done in the constructor? And especially no explicit creation of…
thatsme
  • 325
  • 1
  • 2
  • 10
6
votes
1 answer

Microservices styles and tradeoffs - Akka cluster vs Kubernetes vs

So, here's the thing. I really like the idea of microservices and want to set it up and test it before deciding if I want to use it in production. And then if I do want to use it I want to slowly chip away pieces of my old rails app and move logic…
Matjaz Muhic
  • 5,328
  • 2
  • 16
  • 34
5
votes
2 answers

Shortest-path algorithms which use a space-time tradeoff?

Problem: finding shortest paths in an unweighted, undirected graph. Breadth-first search can find the shortest path between two nodes, but this can take up to O(|V| + |E|) time. A precomputed lookup table would allow requests to be answered in O(1)…
Chris Mounce
  • 51
  • 1
  • 2
5
votes
5 answers

Database alternatives?

I was wondering the trade-offs for using databases and what the other options were? Also, what problems are not well suited for databases? I'm concerned with Relational Databases.
prafulfillment
  • 911
  • 2
  • 11
  • 26
4
votes
2 answers

Pros and cons of using CCUIViewWrapper versus a ported functionality

I'm trying to understand the pros and cons of using something CCUIViewWrapper in Cocos2d versus a ported functionality. For instance, would it be better to use a UITableView in a CCUIViewWrapper, or to use the CCTableViewSuite. At first glance, I…
Joey
  • 7,537
  • 12
  • 52
  • 104
4
votes
2 answers

Best data structure for high dimensional nearest neighbor search

I'm actually working on high dimensional data (~50.000-100.000 features) and nearest neighbors search must be performed on it. I know that KD-Trees has poor performance as dimensions grows, and also I've read that in general, all space-partitioning…
3
votes
4 answers

Error Handling Trade-Off in Java

There are two ways of error handling: 1) Use nested If and check errors 2) Use try/catch Here is tutorial about this. But it is said here that try/catch hurts the performance. So, it seems there is a trade-off. How to decide? What should be done?
ndemir
  • 1,881
  • 3
  • 19
  • 25
2
votes
1 answer

bookmarklet popup: generate divs via JS, or iframe?

When creating a bookmarklet that opens a "fake popup" (similar to amazon's wishlist, pinterest, etc) why do people not use iframes instead of generating all the elements and removing all page styles from them? As far as I can tell: Iframe pros: can…
Mala
  • 14,178
  • 25
  • 88
  • 119
2
votes
2 answers

Merging k sorted lists in Python3, problem with trade-off between memory and time

The input is: The first line - a number of arrays (k); Each next line - the first number is the array size, next numbers are elements. Max k is 1024. Max array size is 10*k. All numbers between 0 and 100. Memory limit - 10MB, time limit -…
shpindler
  • 357
  • 2
  • 12
1
2 3