Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
detrino
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
18 ms
·
121.
▲
by
detrino
12y ago
> But these problems aren't solved by reservoir sampling. Reservoir sampling is still O(N), and it requires generating a random number for every element. I had the same thought reading this. This solution is only really suitable if
122.
▲
by
detrino
12y ago
Flash for Chrome uses the PPAPI and is sandboxed.
123.
▲
by
detrino
12y ago
Thanks for the tip.
124.
▲
by
detrino
12y ago
Unfortunately this can be problematic if you include any library headers that use old-style-casts.
125.
▲
by
detrino
12y ago
Go will never match (in performance) C or C++ (using epoll) for this task.
126.
▲
by
detrino
12y ago
> graduate to F# This is condescending to C# programmers when F# is nearly the same language.
127.
▲
by
detrino
12y ago
> Rust is basically Haskell cleverly disguised as a C-style language so as to not scare away imperative programmers. This comment is very condescending. It makes it seem as if C programmers are ignorant and Haskell programmers are enligh
128.
▲
by
detrino
12y ago
FWIW, I did a more direct translation[1] of the Nim code into C++. The current C++ code does things like memcpy a std::bitset on every recursive call. I also wanted the code to be doing the exact same thing as Nim is (vector with 1 byte per
129.
▲
by
detrino
12y ago
The article does not claim to be refuting objections, but debunking myths.
130.
▲
by
detrino
12y ago
We don't have to make any assumptions, we know how schedulers work, and the radix sort counterpart of a priority queue would probably be a radix tree, which would be impractical for use in a scheduler.
131.
▲
by
detrino
12y ago
This is not a linear time sort. This is just sorting using a priority queue (aka heap sort) with arbitrary pauses thrown in. Here is a simplified model of what is going on ( http://ideone.com/azLsTc ). Note that line 31 (the
132.
▲
by
detrino
12y ago
C++14 version that sorts random strings: https://gist.github.com/det/57c7f0e377e02ccc696f
133.
▲
by
detrino
12y ago
> Some simulations want to have the same sequence of numbers. srand(time(NULL)); does not provide that.
134.
▲
by
detrino
12y ago
There are concerns with using time() as a seed other than security. Besides, consider what you are typically trying to express: initialize my PRNG with a random seed. Almost never are you trying to express: initialize my PRNG so that all ru
135.
▲
by
detrino
12y ago
It's probably the fact that using time() for seeding a PRNG is a really poor choice.
136.
▲
by
detrino
12y ago
This is more about C's integer promotion rules than it is about overflow.
137.
▲
by
detrino
12y ago
I don't know why this was downvoted, everything you say is true.
138.
▲
by
detrino
12y ago
std::string_view didn't make it into C++14.
139.
▲
by
detrino
12y ago
Using int also limits the optimizer in some ways, for example division/modulo becomes more expensive. Every time I see someone mention the optimization argument for signed integers I ask for examples and I've yet see a good one.
140.
▲
by
detrino
12y ago
Forget about for statements for a second and let's write both a counting up and a counting down loop using while statements. // count up std::size_t i = 0; while (i != 10) { std::cout << i <
141.
▲
by
detrino
12y ago
While Rust is indeed competitive with C here, its likely only number #1 because LLVM is generating better code than gcc for this example. I'd expect clang/C to run at least as fast.
142.
▲
by
detrino
12y ago
How does this follow from you implying a JIT advantage for this use case and me asking exactly what the JIT advantage is? I think you are just arguing to win at this point.
143.
▲
by
detrino
12y ago
Interestingly, you brought up two things that are typically categorized as static analysis. Keep in mind GCC does figure out the values will never be negative and its run-times destroy all the JIT competitors listed on that page. Also, stat
144.
▲
by
detrino
12y ago
And how do you expect a JIT to "figure out" negative numbers can't happen and optimize accordingly where a static compiler could not?
145.
▲
by
detrino
12y ago
I think most of the SSE slowness is because the weird static vec::add that uses pass by value, try changing that to pass by reference.
146.
▲
by
detrino
12y ago
Two things to keep in mind: 1) This program has no negative numbers yet the c++ source uses signed ints while having a lot of modulo calls which are slower than if unsigned int was used 2) This program was benchmarked with clang++ In the fo
147.
▲
by
detrino
12y ago
C++ has lambda and std::function.
148.
▲
by
detrino
12y ago
> When you have 512MiB of memory and your current allocation is 256MiB, where do you go? I'm not sure if this is assuming that 2.0 is the only growth factor that is exponential.
149.
▲
by
detrino
12y ago
I had a similar experience with Gnome 3, it looked nice but was always difficult to use despite trying for many months. I suggest taking a look at Mate. I moved to it after finally giving up on Gnome 3 and have been very happy. Here are som
150.
▲
by
detrino
12y ago
Have you considered if this would fit with C++'s grammar?
More ›