The tag has no usage guidance.

learn more… | top users | synonyms

-1
votes
2answers
96 views

better way to load data for millions of users

I am working on a Spring/JSF app in which i have 1 scheduler to load user's sleep activity from fitbit. Right now what i do is that whenever the scheduler kicks in, I load ALL users from mongoDB and ...
-1
votes
2answers
91 views

Is using AJAX worth it in the inner administrative system?

Imagine we have a administrative system that is designed to be as fast and lean as possible, without too much fancy CSS or JS. The UE is not that great, but still it is pleasing on the eyes and gets ...
1
vote
1answer
103 views

Should I use this very short Python Quicksort implementation?

def quicksort(N): if len(N) < 2: return N else: less = quicksort([number for number in N[1:] if number < N[0]]) more = quicksort([number for number in N[1:] if ...
1
vote
2answers
231 views

Most efficient method for large switch statements

Let's say you have many paths that an application can take at a certain point based on the value of a specific input (for example a simple int). Is there a certain method that is most efficient for ...
3
votes
1answer
59 views

Creating a service to to run logic / queries and update a table vs. running logic / queries on client refreshes

I'm not sure if this is a thing. I'm sorry about the ambiguous title--I wasn't really sure how to explain it. Basically I have a ASP.NET web page that runs two SQL queries and does some logic to ...
7
votes
1answer
236 views

How do I feel more productive after programming? [closed]

I really enjoy the actual programming part of programming, and actually writing the code, and figuring it out. But on this project I've been working on, most of my time has been spent on kind stupid ...
1
vote
2answers
295 views

What is Big O of sqrt(1) + sqrt(2) + … + sqrt(n)? [duplicate]

Given for example this code: for(int i=1;i<n;i++) for(int j=1; j < sqrt(i); j++) foo(); //foo takes constant time can someone explain to me how to calculate the ...
0
votes
3answers
221 views

Is there any technical reason to be concerned with casting speed?

So, I'm working on a project that takes a very complex entity from a third party framework and converts it into the native object that defines that entity. This entity has several one-to-many ...
-1
votes
2answers
116 views

Most efficient way to find top values

Let's say we're given n positive integers in random order. What's the most efficient way to find the m largest elements and what's the complexity? For example, given 1000 values, find the top 10.
0
votes
3answers
117 views

Getting RowCount without wasting resources

I have a large SQL query that relates 6-7 different tables and returns fourteen different rows as distinct sets, in a union with an equally-large query, that at times can return over a thousand ...
0
votes
2answers
225 views

Efficient Repeating Alarm Clock in Low Level Language like C

I was thinking about it and I was curious as to how one would code an efficient repeating alarm clock in C? Would you set an alarm time and then offset the time with the ms time equivalent of a day (...
1
vote
3answers
160 views

Should I be using any algorithm to sort/find items, or use a language's built-in ways?

I'm currently a first semester IT student, and I'm wondering if it's better to write my method to find something e.g. in a C# List, or to use any built in method to do these, such as LINQ or .Find or ....
9
votes
4answers
507 views

What is the most efficient way to store this data?

I am in charge of rewriting some old VB code. I understand how it works, but I feel like there is a far-more efficient way to do what they did. I just can't figure out what it is. Here is a contrived ...
0
votes
2answers
388 views

How to scramble a word, keeping first and last characters the same?

I have a task, which is to scramble a single word, whose size is greater than 3 letters. The scrambled word must not be equal to the original, and the first and last letters of the word must remain ...
1
vote
3answers
98 views

Reading from Memory vs Performing an Operation [closed]

I'm learning to program microcontrollers and am trying to develop good habits: Suppose I have a set of values which can be calculated based on what is already in memory. As a general rule, is it ...
1
vote
1answer
167 views

Low cost exceptions implementation using metaprogramming [closed]

(preface - boring stuff, feel free to skip down to the implementation details) I need to provide exception handling to a language I am working on. It "compiles" to a subset of C, and since I don't ...
2
votes
3answers
154 views

Temporary Variables or Not: Choose CPU Time or RAM? [duplicate]

In a case where multiple variables are set equal to an operation using the result of an other operation, is it best to create a temporary variable for the result of the second operation (this would ...
4
votes
2answers
159 views

Sort a list while putting together or after?

I have to read through an extremely large amount of network data from various log files, and compile relevant information about that data to perform statistical analysis on it (the top communicators, ...
0
votes
3answers
163 views

Difference of efficiency [duplicate]

I'm doing a compiler, and I'm using the System.out.println(); to print assembly; And the code get bigger, and more complicate to understand. I want to know whats is the difference of efficiency ...
0
votes
3answers
81 views

Identical Databases for Multiple Users Reading Efficiency

Our project utilizes a static database (no writes). With many users we don't actually have a problem per se reading it. If a database "locks" per read request by any user, then would it not be more ...
0
votes
5answers
436 views

How do I avoid having to compute square roots for every element in a data set?

I have a list of points, with floating point coordinates, of which I've computed the square of the Euclidean distance between these points. I have not computed the actual Euclidean distance between ...
13
votes
2answers
1k views

Is it wasteful to create a new database table instead of using enum data type?

Suppose I have 4 types of services I offer (they are unlikely to change often): Testing Design Programming Other Suppose I have 60-80 of actual services that each fall into one of the above ...
4
votes
6answers
235 views

Class design, responsibility granulation, efficiency and performance

I am in a design dilemma. I have a set of data that can be interpreted in numerous ways, but I cannot really decide how finely grained should it be. To illustrate it with some simple code: class Base ...
1
vote
2answers
120 views

Multi-pattern matching

I have a given byte array in C and I need to match it against several byte arrays and return true if there is any match. I can make various memcmp's but I feel that it is very inefficient. Do you ...
3
votes
2answers
103 views

Reducing a sequence of array modification operations (insert, sort, replace, remove)

Given a plain array of values, e.g. ["Apple", "Orange", "Banana", "Strawberry"] and a list of operations from the set of [insert, delete, sort and replace], e.g. [ {cmd: "insert", index: 2, ...
1
vote
1answer
83 views

What is a good metric for guiding a switch from a prototyping language to a production language? [duplicate]

By "prototyping language", I mean one which was chosen by virtue of it's relative ease of quickly accomplishing the sort of design changes common to prototyping in a particular context. (such as data ...
0
votes
2answers
124 views

Are case-studies an effective way of getting efficiency-focused team members to be willing to trade some efficiency for quality? [closed]

Firstly, this does not suggest that efficiency and quality are in conflict... only that some methods prioritize them differently. Secondly, this is not a question of whether you agree with Scrum ...
2
votes
2answers
466 views

How do I make this functional DSL written in an imperative language more efficient?

Suppose I create a simple functional Domain-specific language (DSL) using an imperative language, in this case C++. Here is a simple implementation of a DSL that can has the notion of a simple value ...
0
votes
1answer
137 views

Optimizing and caching frequently accessed but rarely updated Tables

My app has some tables that will be rarely updated, probably just once in the beginning and at the system setup. Despite that, they will be frequently accessed. Almost every operation depends on ...
3
votes
2answers
639 views

How to avoid calling String.Replace() in a loop?

I am building a very simple email templating system in C#, and it works amazingly, but I have a personal issue with the way I designed it: Template looks like this: Hello {UserName}, Welcome to .......
1
vote
1answer
70 views

Need semi-efficient algorithm for 3-dimensional increasing sequence

I have a set of puzzle challenges for a prototype jigsaw puzzle kit, similar to commercial products offered by Thinkfun and Popular Playthings. I have a candidate list of 300 puzzle challenges and ...
0
votes
0answers
80 views

Handling image and audio files in iOS

Currently I have an iOS app that downloads image and audio files from a server, but each view controller downloads its own set of image and audio files (This is because each view controller needs a ...
4
votes
1answer
649 views

How does modulus work?

I am not asking asking how the mathematical concept of modulus works, or how 20 % 3 == 2 I understand this fine. I'm more curious how the compiler/interpreter determines this. I can think of a very ...
1
vote
1answer
225 views

Single import in a large file vs. multiple imports in smaller files. [Golang]

I'm sure the folks at Google worked long and hard to ensure the programmer wouldn't have to worry about details like this, but I'm curious. In Go if I have multiple files in the same package, but ...
0
votes
5answers
1k views

Fastest way to determine if a value is in a list?

I'm aware there may not be a good solution to this problem. I'm looking for a fast algorithm that determines whether or not a value (let's say an integer) exists in a set of values, however I need the ...
2
votes
0answers
52 views

IRLBot Paper DRUM Implementation - Why keep key, value and auxiliary buckets seperate?

Repost from here as I think it may be more suited to this exchange. I'm trying to implement DRUM (Disk Repository with Update Management) as per the IRLBot paper (relevant pages start at 4) but as ...
1
vote
1answer
355 views

How would a compiler turn an else-if cascade into a switch?

I don't like switch in C and its descendants. Maybe it's the need for a break or the clumsiness of the syntax requiring a shifting of mental gears, I don't know. Whatever the reason, I will almost ...
1
vote
2answers
127 views

What is better for scalability for this specific dataset, MongoDB or MySQL?

I have a web app which has users, forms, and volunteers signed up on those forms. Currently I am using MongoDB and have it setup with a collection for admins, and a collection for forms with ...
0
votes
1answer
359 views

Most efficient LINQ result for Contains() query

I currently use the following: var result = list.Union(otherList).SelectMany(l => l.children).ToList() foreach(var child in lotsOfChildren){ something = result.Contains(child) } I only use ...
2
votes
1answer
42 views

Comparing path strings against list of rules

I am trying to find a way to enhance a filtering algorithm. I am developing a backup software that enables users to specify custom filters to exclude unwanted files/directories. Currently when trying ...
3
votes
2answers
6k views

Which way is more efficient for getting the space count?

I have just started reading Cracking the Coding Interview. One of the problems (specifically 1.4) after solving and then looking at the answer made me question the way it is done and decided to post ...
2
votes
1answer
78 views

timed events to modulation of real-time audio

I am new very to audio programming and am having trouble figuring out the right kind of algorithm for converting control events (e.g. like MIDI) to real-time sound genesis with a buffer. At the ...
0
votes
1answer
281 views

Efficient way to map changes in a filesystem hierarchy

I'm currently working on a project that will enable file searching based on metadata found in the file. It'll be comprised of 2 parts: a filesystem crawler that passively scans for changes and ...
1
vote
2answers
2k views

What benefit is there to using recursive binary search over iterative binary search or vice versa?

In a recent assignment for my programming 2 class we tested the efficiency of searches by populating a java ArrayList with 13,040 strings. The sequential search was obviously slower than the binary ...
2
votes
1answer
120 views

Closest Point to Moving Target

I have a target which is constantly moving, and only its current position is ever known. I also have about one hundred objects surrounding it, and for each of these only the current position is known....
4
votes
4answers
474 views

Why are return values from compare functions in many languages defined loosely?

Many languages define that compare functions should return ANY negative value, zero, or ANY positive value. Is there some reason that it shouldn't be clearly defined as -1 0 and 1? Does a wide range ...
0
votes
2answers
305 views

When trying to find out if a number is even or odd: AND 1 or OR 0

I recently learned of the trick for finding out if a binary number is odd or even. If the last bit in the number is 0, then the number is even. If it ends in a 1, then the number is odd. In the ...
5
votes
1answer
70 views

Bottleneck performance in ECS

I've been looking into building an entity-component-system. Basically, an entity is just an id wrapped around a struct, components are data belonging to that entity(and reference said id), and systems ...
4
votes
1answer
1k views

(jQuery) What is wrong with methods such as .append?

tl;dr: What is wrong with the efficiency of methods such as .append() and what can be alternatives to this? Explanation: Hello everyone. I occasionally have to build A/B tests for websites, which ...
2
votes
2answers
1k views

How does Yahoo's Smush.It work and why doesn't everyone use it?

I've recently come across an application by Yahoo called SmushIt. Apparently it does lossless compression on images. Sometimes the image size is reduced by as much as 90%. This of course has major ...