Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
halayli
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
64 ms
·
691.
▲
by
halayli
13y ago
lval* v = malloc(sizeof(lval)); v->type = LVAL_QEXPR; For goodness sake, when teaching C, make sure to check alloc's return values.
692.
▲
Coconut Headphones: Why Agile Has Failed
(mikehadlow.blogspot.com.au)
2 points
by
halayli
13y ago
|
0 comments
693.
▲
by
halayli
13y ago
I see. So a map implemented using an RB Tree is not abstracting away the implementation?
694.
▲
by
halayli
13y ago
You can say the same thing for the new range based for loop in C++11.
695.
▲
by
halayli
13y ago
DMCA and Ad compliance are core to the business model. They cannot be ignored by pointing your users to this link.
696.
▲
by
halayli
13y ago
adsense or any ad server can block your account/domain because of a single inappropriate picture. How will you deal with that?
697.
▲
by
halayli
13y ago
I am not talking about how I end up searching the container. I am talking about the syntax. Besides, how a container is searched should be abstracted away in the container's implementation and the algorithm should be documented. Compar
698.
▲
by
halayli
13y ago
Get out of your bubble.
699.
▲
by
halayli
13y ago
C++ suffers from the too many cooks in the kitchen syndrome. They sometimes miss the basics.
700.
▲
by
halayli
13y ago
I wish they add a new operator: "in" ... then it can be defined in maps and whatnot for lookups: if (123 in x)
701.
▲
by
halayli
13y ago
Why not use C++11 if performance matters?
702.
▲
by
halayli
13y ago
Lesson from this: buy yourself a hitachi.
703.
▲
by
halayli
13y ago
Lthread ( http://github.com/halayli/lthread ) is basically an M:N threading model. You can run an lthread scheduler per core.
704.
▲
by
halayli
13y ago
C doesn't control memory. brk() does. There are various malloc libraries out there to improve the way malloc manages memory. But ideally you don't want to allocate memory at all. You want to have memory preallocated and preferably
705.
▲
by
halayli
13y ago
of course it does, but it does it in a way that aims to provide an overall good performance for all apps. But it doesn't mean that's the best performance you can get.
706.
▲
by
halayli
13y ago
It can be. You have total control of memory layout. You can gain a lot of performance by considering locality of reference, slab allocators, and parsing DNS packets in general will most probably be much faster.
707.
▲
by
halayli
13y ago
You can also write it in C and use lthread. It will be faster than what Go has to offer. https://github.com/halayli/lthread
708.
▲
by
halayli
13y ago
Don't blame it on MongoDB if you are using the wrong tool for the job.
709.
▲
by
halayli
13y ago
I highly recommend this: http://www.artima.com/shop/overview_of_the_new_cpp By Scott Meyers
710.
▲
by
halayli
13y ago
Yes I understand that foo() won't be called if you defined NDEBUG. But when compiling lthread, NDEBUG is not defined anywhere in the code / makefiles so it's guaranteed to be called and I want to assert the returned value.
711.
▲
by
halayli
13y ago
The asserts are in the .c files. Defining NDEBUG in your program won't change anything in lthread because the library was compiled without NDEBUG defined. If you want to define NDEBUG when compiling lthread, that's up to you.
712.
▲
by
halayli
13y ago
I prefer to fail as soon as possible. I use asserts in places where there is no good way to recover from a failed invariant.
713.
▲
by
halayli
13y ago
I think lthread ( http://github.com/halayli/lthread ) is the only coroutine lib that allows you to block inside a coroutine and do heavy computation without affecting other coroutines. Example: void my_function(void*
714.
▲
by
halayli
13y ago
vector S(vector o,vector d, unsigned int& seed) {} int T(vector o,vector d,float& t,vector& n) {} not sure why he's copying the vectors here.
715.
▲
by
halayli
13y ago
nginx already scales by spawning multiple processes. The worker processes share the listening file descriptors from the parent master process which allows the workers to accept connections on the listening fds.
716.
▲
by
halayli
13y ago
or use lthread. http://github.com/halayli/lthread
717.
▲
by
halayli
13y ago
lthread is a coroutine library that allows you to make blocking calls inside coroutines by surrounding the blocking code with lthread_compute_begin() and lthread_compute_end(). This is equivalent to async calls but without the need to captu
718.
▲
by
halayli
13y ago
Checkout C++11. It has lambda callbacks, promises/futures and async with threading.
719.
▲
by
halayli
13y ago
This code is far off from being production ready. Skimming through the code quickly, there's barely any error handling. HTTP parsing is not compliant either. https://github.com/timothyej/Shortfin/blob/mas
720.
▲
by
halayli
13y ago
low level performance and control with a lot of abstraction features.
More ›