5,875 reputation
31949
bio website chrisaycock.com
location New York, NY
age 33
visits member for 4 years
seen Dec 1 at 20:16

I do high-frequency trading, mostly in C++ and Python (formerly q/kdb+). My views are my own and do not reflect the same of my employer.


Mar
26
answered How does understanding computer architecture help a programmer?
Mar
26
revised Why can't a compiler avoid importing a header file twice by its own?
Corrected typo
Mar
24
comment Why many programming languages have only 2 data-structures: arrays and hashes?
@DonalFellows Good point. I notice that counter machines require "obscure coding" rather than indirect addressing. As for SKI combinators, how would one represent state changes in that?
Mar
24
revised Why many programming languages have only 2 data-structures: arrays and hashes?
Updated to focus on practicality given the comment from Donal Fellows.
Mar
24
revised Why many programming languages have only 2 data-structures: arrays and hashes?
added 76 characters in body
Mar
24
answered Why many programming languages have only 2 data-structures: arrays and hashes?
Mar
23
comment Why many programming languages have only 2 data-structures: arrays and hashes?
Plenty of languages in the ML family have lists rather than arrays (head/tail semantics instead of random access). Also, q/kdb+ has a table container that mimics an in-memory SQL-like container. And C doesn't have built-in hashes at all. So I think your premise takes a narrow views of what's out there.
Mar
18
comment What is the maximum value of index of an ArrayList?
A computer doesn't have "endless memory"; it has, at most, an amount that can be referenced by the memory-address register. So if you have a 64-bit machine, then you can access 2^64-1 bytes of addressable memory.
Mar
14
comment A good C Variable Length Array example
@MikeBrown The question/answer you link to is asking about cache effects of accessing the stack or heap after the array has been allocated. The OP here (hyde) is asking about performance differences during the allocation. The stack is always faster to allocate on than the heap because it's just a movement of the frame pointer. std::vector can't use VLAs because the frame pointer will have been moved back once the constructor returns.
Mar
14
comment A good C Variable Length Array example
@Lundin Does C++ scale the vector by powers of ten? I just got the impression that Mike Brown was really confused by the question, given the linked list reference. (He also made an earlier assertion that implied C99 VLAs live on the heap.)
Mar
14
comment A good C Variable Length Array example
Why would a std::vector need scales of arrays? Why would it need space for 10K elements when it only needs 101? Also, the question never mentions linked lists, so I'm not sure where you got that from. Finally, VLAs in C99 are stack-allocated; they are a standard form of alloca(). Anything that requires heap storage (it lives around after the function returns) or a realloc() (the array resizes itself) would prohibit VLAs anyway.
Mar
14
revised How were some language communities (eg, Ruby and Python) able to prevent fragmentation while others (eg, Lisp or ML) were not?
typo
Mar
14
comment A good C Variable Length Array example
Wow, my system shows a 30% improvement in the VLA version over std::vector.
Mar
14
comment A good C Variable Length Array example
A bit speculative (since this is a hammer looking for a nail), but perhaps alloca() would really outshine malloc() in a multithreaded environment because of the lock contention in the latter. But this is a real stretch since small arrays should just use a fixed size, and large arrays will probably need the heap anyway.
Mar
9
comment Connection between programming language and solutions
The Wikipedia article on the Sapir-Whorf Hypothesis mentions applications to programming languages.
Mar
9
answered Why is a Boolean value stored as a byte inside of a computer when it only requires one bit
Mar
9
answered Do any LOP languages exist?
Mar
9
awarded  Announcer
Mar
9
answered What API is required for code completion/syntax highlighting/similar IDE features?
Mar
9
revised How did JavaScript become popular?
Better example