The tag has no usage guidance.

learn more… | top users | synonyms

1
vote
5answers
160 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
84 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
58 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
72 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
84 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 ...
1
vote
0answers
40 views

Storing/caching SQL query

If I have a very long-winded SQL query (that has multiple subqueries), but the result of which is unlikely to change from hour to hour (or even day-to-day, or possibly even week-to-week) is there some ...
2
votes
2answers
221 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
39 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
307 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
58 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
43 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
295 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
75 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
566 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
36 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
283 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
90 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
231 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
39 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
66 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
267 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
342 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
111 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 ...
4
votes
4answers
454 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
133 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 ...
3
votes
1answer
57 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
367 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 ...
1
vote
1answer
721 views

Efficiency of C# dictionaries

C# dictionaries are a simple way to find if something exists etc etc. I have a question though on how they work. Let's say instead of a dictionary I use an ArrayList. Instead of using ContainsKey (or ...
1
vote
1answer
62 views

Should I do a different SQL table for user privacy settings or just keep it at the users table?

So I am developing a Web Application and I have some concerns about the database. I use a lot of boolean settings at the user table with the form privacy_allow_1, privacy_allow_that, ...
4
votes
1answer
147 views

How do I efficiently send notifications for different events to different users based on their preferences?

I'm creating a notification system for particular events. A user can set the criteria that match particular events (ie. New item, changed item, closed item etc) Items have different characteristics ...
0
votes
3answers
554 views

Using action array vs Switch Case [closed]

I have an occasion of code in which I will draw a different set of buttons in a screen (depending on the number of the buttons). One thought (and my current implementation) is to use an action array ...
0
votes
3answers
483 views

What is more efficient, a single square root or multiple divisions?

Say I make a program that calculates all possible (integral) factors of a certain number that has been input. Is it theoretically more efficient to check with all integers up to the square root of ...
1
vote
2answers
333 views

How to approach program design with respect to data strucutres and algorimths - is there an equivelant of the OO design process for d.s.'s + algs? [closed]

My applogies for probably the worst written body of text I have produced in my life and many thanks to those willing to plough through it all. I was (and still am) not able to clearly express what I ...
0
votes
2answers
125 views

Should you avoid adding unecessary stack frames?

I have been working with laravel (PHP) recently, and there is an option when using their fluent ORM to define where clauses using closures. This gives us two, functionally equivalent, ways to specify ...
26
votes
10answers
4k views

When I test out the difference in time between shifting and multiplying in C, there is no difference. Why?

I have been taught that shifting in binary is much more efficient than multiplying by 2^k. So I wanted to experiment, and I used the following code to test this out: #include <time.h> #include ...
1
vote
0answers
38 views

Are Components ideal for packaging and reusing find() requests?

I find myself loading several models over and over again throughout my application. Instead of typing the code to load the model, run a find, would it be reasonable to put that code in a method and ...
3
votes
2answers
110 views

Trivially Sortable Encoding for Arbitrary-Precision Decimals

I'm looking for a reasonably(*) space-efficient way to encode arbitrary-precision decimals (e.g. BigDecimal), such that when sorting the bit-pattern of the encodings lexicographically, the numbers ...
1
vote
1answer
42 views

Custom Domain or Attribute Reference Table or Both?

I'm designing my first real database and I'm weighing the pros and cons of how to enforce uniformity in my data. My first option is to create a custom domain and program my UI to only allow certain ...
3
votes
5answers
335 views

Simplicity-efficiency tradeoff

The CTO called to inform me of a new project and in the process told me that my code is weird. He explained that my colleagues find it difficult to understand due to the overly complex, often new ...
1
vote
3answers
241 views

Is there a difference in resource allocation & efficiency between a web app and a compiled one? [closed]

I'm a web developer. I feel like I develop less resource-intensive functionality often times, because I have this feeling that if I ask too much of the web app (animation, calculation, connections, ...
2
votes
2answers
403 views

Most efficient way to store this collection of moduli and remainders?

I have a huge collection of different moduli and associated with each modulus a fairly large list of remainders. I want to store these values so that I can efficiently determine whether an integer is ...
0
votes
1answer
437 views

How to code efficiently? [duplicate]

I often compare my code to others and I find their solution more efficient and shorter than mine. Although both solutions work, I can't help it but wonder if mine is not adequate enough. As a result, ...
0
votes
1answer
57 views

Replacing string comparisons with dictionary lookups

Given 2 strings s1 and s2, if I do a simple equality check , it is considered to be O(n) when calculating algorithm efficiency. So, if I am using a brute force approach for the rotated substring ...
3
votes
2answers
287 views

How can I approach creating an efficient algorithm for maximizing value with these specific constraints?

I'm having trouble coming up with an approach that isn't n^2 for this problem. Here's a contrived, simplified version I've come up with: Let's say you're a company that needs 4 employees to launch in ...
0
votes
1answer
138 views

How to Learn Doing it Right Way? [closed]

I am self taught web developer. I do not have any computer science degree from university. I know HTML5, CSS3, Javascript, PHP and some Python. But I am having difficulties about being efficient. When ...
1
vote
3answers
515 views

Least Change Problem with Thousands of Denominations

In a hypothetical economy there are currency units that can represent thousands of different values. So, for example there might be coins worth 1c, 3c, 5c, 7c, 7.5c, 80c, 8001.5c etc. Given a list of ...
0
votes
1answer
43 views

lots of images and ajax, or better solution?

I have a control where the user can select a value for the x and y axis from 2 dropdowns, and then there is a 4 by 4 grid (an image) which will show what their selections correspond to (updating ...
0
votes
2answers
656 views

Quick algorithm to find matches between two arrays

I'm faced with the following problem: I have an array which is produced by the parsing of a yaml file which contains patterns in the following structure. "Programming books" Title: a ...