Questions tagged [speed]
53 questions
110
votes
15 answers
When to optimize for memory vs performance speed for a method?
I recently interviewed at Amazon. During a coding session, the interviewer asked why I declared a variable in a method. I explained my process and he challenged me to solve the same problem with fewer variables. For example (this wasn't from the…

Corey P
- 1,224
- 2
- 7
- 14
91
votes
15 answers
How can I favor quick (and dirty) over clean (and slow) in practice?
Preface, TL;DR
This question is about the implied tradeoff between the speed of development and the quality of code.
I am looking for methodologies which can be followed in order to optimize development speed, even at the expense of code-quality and…

Gulzar
- 1,240
- 1
- 7
- 12
24
votes
2 answers
SQL IN() versus OR
I was working with a query I wrote today had to change the code from the WHERE clause to use a IN(list of stuff) filter instead of using something like
item_desc = 'item 1'
OR item_desc = 'item 2'
OR item_desc = 'item 3'
OR item_desc = 'item 4'
The…

MCP_infiltrator
- 745
- 2
- 6
- 12
21
votes
6 answers
How important is memory alignment? Does it still matter?
For some time now, I have searched and read a lot about memory alignment, how it works and how to use it. The most relevant article I have found so far is this one.
But even with that I still have some questions about it:
Except in embedded system,…

Kane
- 371
- 1
- 2
- 9
17
votes
6 answers
PHP and performance
I always hear that PHP is for medium and small websites whereas .NET and Java for enterprise applications. My question is about PHP. Why is PHP not a good option for enterprise web applications? Is it because if the web application becomes bigger…

Naif
- 453
- 2
- 7
- 13
15
votes
5 answers
Resources on Writing Efficient C Code for Micro-controllers?
Serious help needed here. I love programming. I've been reading bunch of books(such as K&R) and articles/forums online for C language lately. Even tried looking into Linux code(although, i was lost where to start but peeking into small libraries…

AceofSpades
- 605
- 1
- 7
- 12
14
votes
2 answers
Object oriented vs vector based programming
I am torn between object oriented and vector based design. I love the abilities, structure and safety that objects give to the whole architecture. But at the same time, speed is very important to me, and having simple float variables in an array…

Ramanuj Lal
- 141
- 1
- 5
7
votes
1 answer
Hardware that accelerates pointer dereferencing?
Most modern languages make a heavy use of pointers / references: a typical OOP language uses VMT lookups, a typical functional language builds key data structures out of pointers, etc. Even typical C code often sports things like foo->bar->baz.
It…

9000
- 24,162
- 4
- 51
- 79
6
votes
3 answers
Effecient algorithm for data deduplication in procedural code
I have written a data cleansing application which, for the most part, works well. It is not designed to handle large volumes of data: nothing more than about half a million rows. So early on in the design process, a decision was made to try and do…

Bob Tway
- 3,606
- 3
- 21
- 26
6
votes
2 answers
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 are the code. Entities and components are all…

Daniel Martin
- 163
- 4
5
votes
2 answers
Is creating and writing to one large file faster than creating and writing to many smaller files in Python on Linux?
If using Python on a Linux machine, which of the following would be faster? Why?
Creating a file at the very beginning of the program, writing very large amounts of data (text), closing it, then splitting the large file up into many smaller files…

LazerSharks
- 397
- 3
- 9
4
votes
2 answers
What are the bottlenecks for the Java build speed?
Which underlying system parameters have most influence on how fast a typical Java project (say dozens of classes and dependencies) builds?
There is a lot information on JIT (bytecode to CPU instructions) compiler optimization, but what if you need a…

J. Doe
- 175
- 7
4
votes
4 answers
Selecting a CPU or microcontroller needed for a given software application?
Say I had a software algorithm (for example, an FFT), and I need it to process (n) amounts of data in (t) milliseconds. This is a real-time task written in C. There are a lot of CPUs out there, and you could just select the fastest one, but we also…

9a3eedi
- 2,101
- 3
- 23
- 29
4
votes
3 answers
Best way to choose random element from weighted list
I want to create a simple game. Every so often, a power up should appear. Right now the different kinds of power ups are stored in an array.
However, not every power up should appear equally often: For instance, a score multiplier should appear much…

Qqwy
- 4,709
- 4
- 31
- 45
4
votes
3 answers
Is it conceivable to have millions of lists of data in memory in Python?
I have over the last 30 days been developing a Python application that utilizes a MySQL database of information (specifically about Norwegian addresses) to perform address validation and correction. The database contains approximately 2.1 million…

Hubro
- 676
- 1
- 7
- 13