2,006 reputation
51125
bio website
location
age
visits member for 2 years, 8 months
seen yesterday

Dec
31
comment What is the correct way to publish a runtime? Should it be a singleton?
Same issue, sending a pointer to a struct or making it singleton... not sure what is better for C, now.
Dec
31
comment What is the correct way to publish a runtime? Should it be a singleton?
Hmm, fair enough. I guess that is a good approach. I might ask the question again in C, though, since there is a C backend and closures aren't available there.
Dec
31
comment What is the correct way to publish a runtime? Should it be a singleton?
Yes I guess that can be done.
Dec
31
comment What is the correct way to publish a runtime? Should it be a singleton?
If I get the idea correctly, as the "runtime" is hidden inside a closure, then the functions generated after the first one will not be able to access the same "runtime". That is, if I call "eval" on your code twice, it creates two runtimes.
Dec
31
comment What is the correct way to publish a runtime? Should it be a singleton?
It is a considerable slowdown when you have things such as "runtime.write(a,b)" inside a inner loop that runs a million times. JQuery accessors are never used in such inner loops, but for a compiled code, that would happen anytime you have a nested loop.
Dec
31
comment What is the correct way to publish a runtime? Should it be a singleton?
The problem is that functions can be compiled during the program execution. In this case it wouldn't work. I'm sorry, I didn't predict your answer!
Dec
31
asked What is the correct way to publish a runtime? Should it be a singleton?
Sep
16
awarded  Popular Question
Sep
2
comment Why aren't we building and using parallel processors *meant* for general computation?
Maybe not an average consumer, but I'm programming a computing server for a specific application and the benefit of having an actual parallel computer I could program into would be immeasurable.
Sep
2
asked Why aren't we building and using parallel processors *meant* for general computation?
Aug
5
comment Are bloom filters actually faster than hashes, even taking in account cache?
@delnan AFAIK it uses something around 10 bits/element, no? So, for several thousands of elements - ie, huge datastores - it will definitely not fit in a cache. So, if you are using k hashes, you are probably having k cache misses per read. Hash tables on the other hand guarantee that you will have your answer with 0 cache misses most of the time - collisions are rare, anyway.
Aug
5
asked Are bloom filters actually faster than hashes, even taking in account cache?
Jul
19
awarded  Popular Question
Jul
11
asked How can a true Vector be implemented in Haskell?
Jun
21
comment Would you get better performances by coding an application in C, then compile to JavaScript?
And as much as your statement about optimisations is interesting, it is simply not true in all cases. Certain optimisations will mostly likely always generate faster code. For example, optimising for (var i=0;i<1000;++i) x+=1 to x += 1000 will pretty much always be faster in any kind of target, because you just decreased the number of operations. Or, more obviously, map f . map g will mostly always be slower than map (f . g), for the same reason. In other words, albeit not guaranteed, it is often likely that a program with fewer reductions will have better performance.
Jun
21
comment Would you get better performances by coding an application in C, then compile to JavaScript?
The latter. It performs optimisations that are not possible in JavaScript. For example, a specific function as coded in C could be optimised taking account its type, which is not possible in JavaScript. So in order to get the same kind of optimisation in JS, you couldn't rely on the compiler nor using built-in JS functions. You could, in theory, yes, but then you'd not have something very far from linguistic JS.
Jun
21
comment Would you get better performances by coding an application in C, then compile to JavaScript?
If you think about it, Emscripten makes use of decades of research in optimising C, including a wide range of optimisations that are not even possible in JavaScript - V8 or not. That kinda makes my hypothesis more believable.
Jun
21
comment Would you get better performances by coding an application in C, then compile to JavaScript?
I agree with you, but it could be the case that while someone very good at optimising JavaScript could do a better job than emscripten, he must not just be good, but really good. Probably inhumanly good, because in order to get that kind of performance out of it, you'll be probably writing some ridiculously obfuscated asm.js, going through reinventing pointers and allocators, up to a point it isn't really JavaScript anymore. But if you mean you can get such performance by using usual JS, including its builtin arrays, objects, functions etc, I fear that is really unlikely....
Jun
20
comment Would you get better performances by coding an application in C, then compile to JavaScript?
I guess so, but it also takes care of the memory management, so I am not sure that is considered an interpreter by the terminology.
Jun
20
asked Would you get better performances by coding an application in C, then compile to JavaScript?