Search found 497 matches

by korona
Mon Jan 16, 2017 8:30 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

At least on Debian RRDTool just pulls in cairo. This is fine: cairo is a generic vector graphics drawing library and fine for headless systems; it's the right tool for the job. However cairo is built with support for output to X11 surfaces and thus pulls in X11 libraries (in wayland based systems X1...
by korona
Mon Jan 09, 2017 10:35 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

And that, kids, is why we pass -O2 on the command line. (Runtime: 0 seconds because the dead store and the loop is eliminated :P) Seriously though, it does look quite strange. What compiler / options were you using? Can you paste the real code (the real calculation and initialization and bounds chec...
by korona
Sun Jan 01, 2017 11:00 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

So yes, you get the expected result for integers. So then, why is float length; float width; length = 10.0; for (width=1.0 ; width=width+.01 ; length==width) print ("still too long"); print ("Finally, perfect!"); wrong? Jose Because floats cannot represent 1/100 exactly. Just li...
by korona
Sun Oct 30, 2016 6:08 pm UTC
Forum: Coding
Topic: Efficiency of prime sieve
Replies: 7
Views: 4016

Re: Efficiency of prime sieve

Robert'); DROP TABLE *; wrote:(The ideal target would be being able to find the smallest prime under 1012, but I suspect that's far too ambitious to be able to do in 4GB of memory.)

If you're only interested in the largest prime <= a certain bound doing things like AKS primality testing might perform better than a sieve.
by korona
Fri Oct 28, 2016 4:37 pm UTC
Forum: Computer Science
Topic: Deliberately bad algorithms
Replies: 120
Views: 33529

Re: Slowest Sorting Algorithms that Terminate

Since i is a constant, this works out to O(t(n)^2) with a very, very large constant. The smallest possible value of t(n) is O(n*log(n)) (if it were smaller then a comparison sort faster than O(n*log(n)) would be possible), giving O((n*log(n))^2) runtime, which is surprisingly good for a sort that i...
by korona
Fri Oct 28, 2016 3:58 pm UTC
Forum: Computer Science
Topic: Deliberately bad algorithms
Replies: 120
Views: 33529

Re: Deliberately bad algorithms

That can be improved to yield a total impractical and useless but asymptotically optimal algorithm for every problem. Consider a problem that can be solved in O(f(n)) time by a DTM. Now we do: for i = 1 to infinity do run DTM with number i for i * f(n) steps on the original input if the DTM produced...
by korona
Sat Oct 15, 2016 12:13 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Yeah, I get that too. There's everything, and there's everything . At some point you have to stop. The point isn't that it's official documentation. The point is... where do you stop, and why? I don't know the answer, (and I don't know hardly any python) so I can't tell whether this particular case...
by korona
Fri Oct 14, 2016 4:20 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

FT: In pre-C++17, is it possible to use standard library allocators on types that have const-members without invoking undefined behavior? struct Foo { Foo() : bar(0) { } const int bar; }; Foo *make_foo() { using A = std::allocator<Foo>; A allocator; auto p = std::allocator_traits<A>::allocate(alloca...
by korona
Mon Oct 10, 2016 9:31 pm UTC
Forum: Computer Science
Topic: Encryption for the Lich Queen's spys?
Replies: 15
Views: 5937

Re: Encryption for the Lich Queen's spys?

What does computable by hand mean? AES is computable by hand but requires significant effort. How much ciphertext does one individual have to output per hour? If its just a few bytes then AES will be manageable after some practice and by building a few lookup tables to speed up the process. Breaking...
by korona
Thu Oct 06, 2016 8:45 pm UTC
Forum: Hardware
Topic: Intel & Micron announce “3D XPoint” memory
Replies: 17
Views: 9331

Re: Intel & Micron announce “3D XPoint” memory

Yes, high bandwidth definitely makes sense for stuff like GPUs with a uniform access pattern (stuff like primitive buffers are usually accessed sequentially). It does not help so much with the random access patterns of most CPU-bound code. However moving stuff like memory or PCI lanes closer to the ...
by korona
Thu Oct 06, 2016 6:35 pm UTC
Forum: Hardware
Topic: Intel & Micron announce “3D XPoint” memory
Replies: 17
Views: 9331

Re: Intel & Micron announce “3D XPoint” memory

I think, in short, system memory's latency is getting too long and it will move on-dye. 3D XPoint (or some other branding, what's in a name?) will become the system memory and be much larger than today. Disks will essentially be repalced by network storage since the system memory is no-volatile eve...
by korona
Tue Oct 04, 2016 4:24 pm UTC
Forum: Computer Science
Topic: Deliberately bad algorithms
Replies: 120
Views: 33529

Re: Deliberately bad algorithms

But the bound on which the mathematician certainly cannot calculate BB_k is pretty high. What bound do you mean? For any k, there's at least one TM (or mathematician) which outputs BB_k, so there's no theoretical upper bound k for which BB_k cannot be known. The upper bound of possible knowability ...
by korona
Sun Oct 02, 2016 10:01 pm UTC
Forum: Computer Science
Topic: Deliberately bad algorithms
Replies: 120
Views: 33529

Re: Deliberately bad algorithms

Unless the mathematician has infinite handwriting speed (or some other method to process arbitrary long proofs in bounded time) he cannot compute BB_k either. :D
by korona
Fri Sep 23, 2016 8:43 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1737: "Datacenter Scale"
Replies: 57
Views: 10576

Re: 1737: "Datacenter Scale"

Do datacenters use RAID storage attached to compute nodes at all? I suspect they only attach a tiny (non-RAID) HDD/SSD to each node (for fast node-local caching aka /tmp) and use dedicated NAS hardware for durable storage. In which case throwing away a NAS node does not make sense at all. That soun...
by korona
Fri Sep 23, 2016 6:15 pm UTC
Forum: Individual XKCD Comic Threads
Topic: 1737: "Datacenter Scale"
Replies: 57
Views: 10576

Re: 1737: "Datacenter Scale"

Do datacenters use RAID storage attached to compute nodes at all? I suspect they only attach a tiny (non-RAID) HDD/SSD to each node (for fast node-local caching aka /tmp) and use dedicated NAS hardware for durable storage. In which case throwing away a NAS node does not make sense at all.
by korona
Fri Sep 23, 2016 3:58 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Also, type* p is just wrong, right? If C wanted us to use that style it wouldn't have given us multiple variable declarations in a single statement!
by korona
Wed Sep 21, 2016 7:30 am UTC
Forum: Coding
Topic: faster function than 1/x?
Replies: 18
Views: 4876

Re: faster function than 1/x?

Does GCC compile the memcpy version to optimal assembly? Last time I checked GCC was pretty good at juggling with memcpy.
by korona
Tue Sep 20, 2016 5:27 pm UTC
Forum: Coding
Topic: faster function than 1/x?
Replies: 18
Views: 4876

Re: faster function than 1/x?

The pointer cast is undefined behavior. The compiler is allowed to reorder the int loads before previous float stores. Type pruning though union works on all compilers as far as I remember but I'm not entirely sure about MSVC and it's not in the standard. The standard way to do this is to use memcpy...
by korona
Tue Sep 20, 2016 7:11 am UTC
Forum: Computer Science
Topic: IT Hare: Infographic - Operation Costs on CPU Clock Cycles
Replies: 4
Views: 3630

Re: IT Hare: Infographic - Operation Costs on CPU Clock Cycles

Yes, context switch costs could be reduced by such mechanisms. However the effectiveness varies by approach. There are several costs associated with context switches: ⋅ There is a switch to supervisor mode. This usually includes a pipeline flush. The cost of the switch may vary between dif...
by korona
Mon Sep 19, 2016 5:31 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

I don't know much about the node culture so I cannot really comment on it. If someone uses a library of questionable quality that is of course a problem but at least in this case that is not what happened. I also doubt that someone who doesn't spend any time on evaluating the quality of a library ca...
by korona
Sun Sep 18, 2016 9:07 am UTC
Forum: Computer Science
Topic: IT Hare: Infographic - Operation Costs on CPU Clock Cycles
Replies: 4
Views: 3630

Re: IT Hare: Infographic - Operation Costs on CPU Clock Cycles

Keep in mind that while it might be possible to specify the latency of individual operations on such a chart it is very difficult to estimate the performance of combinations of instructions. CPUs do not execute instructions sequentially. Also: The costs of individual operations differ by CPU archite...
by korona
Fri Sep 16, 2016 8:31 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

To be fair reusing even trivial functions often does make more sense than rewriting them every time they are needed (and of course introducing different naming schemes, calling conventions and subtle differences in behavior each time). I don't know how often I wrote a ceil_to_2pow(size_t) function i...
by korona
Thu Sep 15, 2016 12:36 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Seemingly unpopular opinion: JavaScript has the cleanest type system of all dynamic languages. Prototype based inheritance just makes so much more sense for a dynamic language than classes. Also: JavaScript has one of the best async programming models of all imperative languages. Yes, you need an ex...
by korona
Fri Sep 09, 2016 3:43 pm UTC
Forum: Coding
Topic: Help optimising an optimisation model
Replies: 5
Views: 3066

Re: Help optimising an optimisation model

The good side of MiniZinc is that you can basically use all the data structures you need and apply the relevant constraints to the bits where it makes most sense. So, for example, I currently have arrays that, for each item, contain the west and east positions, the times that stacking and reclaimin...
by korona
Thu Sep 08, 2016 7:19 am UTC
Forum: Coding
Topic: Help optimising an optimisation model
Replies: 5
Views: 3066

Re: Help optimising an optimisation model

I find it a bit hard to follow what the problem is. Can you state the data that is associated with each { item, ship, reclaimer }? Which part of that data is given by the input and what variables are optimized over? What is the objective function? What are the exact constraints? EDIT: Is the assignm...
by korona
Wed Sep 07, 2016 7:20 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

I don't do much GUI stuff outside of the occasional web app experiment so excuse my ignorance: What is so bad about XPath? Is it completely obsoleted by CSS selectors?
by korona
Sat Aug 20, 2016 9:59 am UTC
Forum: Coding
Topic: Bettering vs Bloat?
Replies: 19
Views: 4445

Re: Bettering vs Bloat?

Agree. More directly: to a first approximation, there's no such thing as wisely-written C . C is not a language for humans to write in, practically nobody can actually do it correctly. Write in a language that doesn't shoot your foot off quite as easily, so any C-writing bugs are confined to the co...
by korona
Mon Jul 25, 2016 11:03 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

I am uncertain, but the issue is you are taking an object of type A and replacing it with an object of type B. This may violate aliasing requirements unless you are very careful. Ah, I think you misunderstood me. I don't want to do that. I'm just assuming that B will fit into an std::aligned_storag...
by korona
Mon Jul 25, 2016 5:32 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

If you make your poly_auto<A, size, align> type be poly_auto<A, sizeof(A), alignof(A)>, then only types with the same size/alignment or less can fit in it, but the code doesn't fundamentally assume it. This also means that the poly_auto object can be made bigger to permit bigger descendents, which ...
by korona
Sat Jul 23, 2016 9:58 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Well I'm not interested in the size of the structs compared to C types but only to each other (and their vtables would be of the same size). I guess Itanium ABI guarantees that they are the same size so I'll just write my code under this assumption and add a static_assert so that other people can fi...
by korona
Sat Jul 23, 2016 9:57 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

In C++ does

Code: Select all

struct B {
    virtual void foo() = 0;
};
struct A : public B {
    void foo() override;
} // no data members

imply
sizeof(A) == sizeof(B)? I guess it does in all sensible ABIs but I suspect it is not enforced by the standard.
by korona
Fri Jul 22, 2016 3:37 pm UTC
Forum: Coding
Topic: How do you manage Python dependencies?
Replies: 8
Views: 3542

Re: How do you manage Python dependencies?

With HTML 5 the spec was adjusted to the code that is used in the wild.
by korona
Wed Jul 20, 2016 7:44 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Are there that many non-toy applications that use graphs but do not need high performance OR specialized structures? And for those applications that use small graphs, is writing two small classes that much overhead? By the way: Constructing high performance graph data structures is hard. I've worked...
by korona
Tue Jul 19, 2016 10:00 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Graph data structures need to be tightly coupled to the problem they want to solve. Even something simple like DFS requires specialized data structures (i.e. a per-node flag that remembers if the node has already been visited yet).
by korona
Fri Jul 08, 2016 3:18 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Yeah, that right. But I have to admit that I would not have thought of such an optimization myself. This is one of the reasons why I believe that non-trivial hand crafted assembler will almost always be worse than code generated by a good compiler. If x is true then esi becomes 0 after 'ssb'...
by korona
Fri Jul 08, 2016 12:19 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Yeah, that right. But I have to admit that I would not have thought of such an optimization myself. This is one of the reasons why I believe that non-trivial hand crafted assembler will almost always be worse than code generated by a good compiler. If x is true then esi becomes 0 after 'ssb'...
by korona
Fri Jul 08, 2016 11:19 am UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

When the compiler generates code that is so clever that you have a hard time understanding it yourself:

Code: Select all

if(x) {
    y = 0x28;
}else{
    y = 0x4B;
}


Code: Select all

# input: rdx = x
# output: esi = y
cmp $0x1, %rdx
sbb %esi, %esi
and $0x23, %esi
add $0x28, %esi
by korona
Sat Jul 02, 2016 5:56 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

Wow, thanks a lot, I did not know that GCC had such a flag. That is exactly what I was looking for. :)
by korona
Fri Jul 01, 2016 11:47 pm UTC
Forum: Coding
Topic: Coding: Fleeting Thoughts
Replies: 9742
Views: 1553433

Re: Coding: Fleeting Thoughts

FT: Is throwing from a signal handler allowed in C++? Context: I have a program that may page fault sometimes (and is able to handle those faults gracefully). I can check if that will happen before I access memory but that is just a (non-negligible) waste of time in 99.999% of all cases. It would be...
by korona
Mon Jun 27, 2016 5:57 pm UTC
Forum: Coding
Topic: Good books for learning to create proxy servers?
Replies: 18
Views: 6034

Re: Good books for learning to create proxy servers?

I'm never used Tor but I don't see why you have to trust exit nodes. My understanding is that no one is able to trace your ip as long as there is at least one node in the path between you and the server that can be trusted. Of course exit nodes can spy on your unencrypted traffic but which security-...

Go to advanced search