Questions tagged [processing-efficiency]

622 questions
14
votes
3 answers

When doing IPC using TCP/IP sockets using the loopback address, do common networking stacks skip framing the message in lower-level PDUs?

In some environments such as Java, it's natural to use TCP/IP sockets to pass messages between processes on the same host using the 'localhost' address (127.0.0.1 in IPv4, or ::1 in IPv6). (Because Java tends not to expose other IPC mechanisms in…
David Bullock
  • 6,112
  • 3
  • 33
  • 43
13
votes
4 answers

How to efficiently create a multi-row photo collage from an array of images in Swift

Problem I am building a collage of photos from an array of images that I am placing onto a tableview. I want to make the images wrap when the number of images reaches the boundary of the tableview cell's width (this would allow me to display rows of…
Tommie C.
  • 12,895
  • 5
  • 82
  • 100
12
votes
2 answers

What is difference between Array and Binary search tree in efficiency?

I want know what is the best : Array OR Binary search tree in ( insert , delete , find max and min ) and how can I Improve both of them ?
12
votes
6 answers

Performance when reading a file line by line vs reading the whole file

Is there a noticeable difference (in theory) when reading a while line by line compared to reading the whole file in one go? Reading the whole file does have a negative impact on the amount of memory used but does it work faster? I need to read a…
RushK
  • 525
  • 1
  • 5
  • 13
12
votes
7 answers

C++ String Interview Question

I was recently in a C++ technical interview, where I was given a bit of simple string manipulation code, which is intended to take a string and return a string that is comprised of the first and last n-characters, and then proceed to correct any…
Matthieu N.
11
votes
6 answers

Alternative to using % operator and / Operator in C++

It is told that modulo operator "%" and divide operator "/" are very inefficient in embedded C++. How can I alternatively achieve the following expression: a = b % c; I understand that this can be achieved using the following logic: a = b -…
kiki
  • 13,627
  • 17
  • 49
  • 62
11
votes
6 answers

How to Best Run Hadoop on Single Machine?

I have access to a computer running Linux with 20 cores, 92 GB of RAM, and 100 GB of storage on an HDD. I would like to use Hadoop for a task involving a large amount of data (over 1M words, over 1B word combinations). Would pseudo-distributed mode…
9
votes
3 answers

C++ How to merge sorted vectors into a sorted vector / pop the least element from all of them?

I have a collection of about a hundred or so sorted vector's Although most vectors have a small number of integers in them, some of the vectors contain a large (>10K) of them (thus the vectors don't necessarily have the same size). What I'd…
Deniz
  • 1,481
  • 3
  • 16
  • 21
9
votes
1 answer

Multiple video sources combined into one

I am looking for an efficient way to do the following: Using several source videos (of approximately the same length), I need to generate an output video that is composed of all of the original sources each running in its own area (like a bunch of…
Oded
  • 489,969
  • 99
  • 883
  • 1,009
9
votes
3 answers

Reading in only part of a Stata .DTA file in R

I apologize in advance if this has a simple answer somewhere. It seems like the kind of thing that would, but I can't seem to locate it in the help files, by searching SO, or by Googling. I'm working with some datasets that are several GB right…
Ari B. Friedman
  • 71,271
  • 35
  • 175
  • 235
9
votes
2 answers

Why would my parallel code be slower than my serial code?

In general, is it possible for a parallel code to be slower than the serial code? mine is and I am really frustrated at it! what can I do?
8
votes
5 answers

Best way to do binary arithmetic in C?

I am learning C and writing a simple program that will take 2 string values assumed to each be binary numbers and perform an arithmetic operation according to user selection: Add the two values, Subtract input 2 from input 1, or Multiply the two…
jmlane
  • 2,109
  • 1
  • 16
  • 24
7
votes
3 answers

How to efficiently implement Youtube's Thumbnail preview feature?

I am trying to implement the Youtube's Thumbnail Preview feature for my Simple Video Player. Here's the Snap for it : Good thing is : It is working smoothly once the Player fetch all the thumbnails previews from a HTTP server. Bad thing is :…
7
votes
5 answers

most efficient way of swapping values c++

I was wondering what the most efficient, in terms of operations, way of swapping integers is in c++, and why? Is something like: int a =..., b = ...; a = a + b; b = a - b; a = a - b; more efficient than using a temporary? Are there any other more…
Mara Jade
  • 73
  • 1
  • 7
7
votes
2 answers

Efficient Average of Three Values in C

We are reading some signals from pins and setting some more events based on this reading. To be safe, I want to sample the pins 3 times, compare the three values and use the most common value (i.e. sample A is 1, B is 3 and C is 1, I want to use 1,…
Puffafish
  • 173
  • 3
1
2
3
41 42