Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
esailija
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
32 ms
·
301.
▲
by
esailija
13y ago
I am type 1 on ketogenic diet as well and my sugars are virtually always in healthy person's range (or actually always if the healthy person eats candy or white bread :P). So I am curious why you consider it extremely valuable with suc
302.
▲
by
esailija
13y ago
You can gain ridiculous performance improvements without anything ever really being a bottleneck at all - this attitude is wrong and annoying.
303.
▲
by
esailija
13y ago
In general "faster without optimization" is completely meaningless because it doesn't mean fast with optimization, which is what actually matters. Example: Average code written in node.js is typically just as slow as, say
304.
▲
by
esailija
13y ago
I did not say that one should not to comply to a specification. There is a big difference between implementations complying to specification and implementations where the source code is basically just duplication of the spec (which obviousl
305.
▲
by
esailija
13y ago
That's just the specification. Doing exactly what the spec says is the definition of a naive implementation.
306.
▲
by
esailija
13y ago
That is not true at all about Promises/A+. The requirement is to always calls handlers with an empty stack and in a certain order. In practice only naivest implementations would call platform scheduler for every `.then()`. Implemen
307.
▲
by
esailija
13y ago
Well yes you can achieve better concurrent execution if you essentially duplicate the code. I also showed you how to do it with promises already (in 1 line) so not sure why you are wishing me good luck :) There is just no way to use yield w
308.
▲
by
esailija
13y ago
1. Yes this is the problem. It is very easy to write something like this: var a = yield A(); var b = yield B(); This is massively less performant than: var a = A(); var b = B(); a = yield a; b = yield b; In
309.
▲
by
esailija
13y ago
Cool trick with the redundant indentation which can be applied to generators too: #Without generators Credentials.get({ token }) .then(credentials => User.get({ username: credentials.username })) #With generators
310.
▲
by
esailija
13y ago
Otoh they don't use some top secret innovations but decades old techniques accessible to everyone. And language benchmarks don't tell the whole story. In Java, idiomatic and typical code will be optimized very well whereas in Java
311.
▲
by
esailija
13y ago
You are mistaking jQuery for a querySelectorAll alias, I have no words for how wrong that is.
312.
▲
by
esailija
13y ago
They are not going to "fix it", it is working as intended with the deliberate tradeoff because almost no real world code is affected by it.
313.
▲
by
esailija
13y ago
Is your only use case to scrape a few pages for 1 user at a time? What if there was 1000 users requesting that scrape concurrently? or 10000? Benchmarks with N=1 are complete bullshit and you cannot use it at all to reason what will happen
314.
▲
by
esailija
13y ago
The canonical PHP implementation is a simple interpreter that cannot even dream of such optimizations. Hell, it uses unions to handle dynamic typing and hash tables to represent objects. The implementation by facebook (HipHop) might have su
315.
▲
by
esailija
13y ago
Generators and await don't really give anything substantial after promises except less superficially verbose syntax and not even that when using CoffeeScript where `return` and `function(){}` are really light-weight. Actually what issu
316.
▲
by
esailija
13y ago
async/await is just a generator function that yields promises. It is implementable even in node.js if you enable --generators flag.
317.
▲
by
esailija
13y ago
Riot is just jQuery though. The riot's own source code is literally useless. I agree with the ideas that you can structure your application without frameworks like backbone though
318.
▲
by
esailija
13y ago
Let me put it in code terms. In the following template script: <div>@hello</div> The generated code can be like (not including runtime lib): var ___html = ""; var hello = hasown.call(data, "
319.
▲
by
esailija
13y ago
I wasn't aware that the benchmark comparison was about micro-templating, it includes libraries like handlebars. I am sure you realize you can just walk the AST for what identifiers are being used in the template code and forward declar
320.
▲
by
esailija
13y ago
I don't think that's fair since a templating engine could easily avoid the actual with statement but provide same convenience. Optimization should be done in the implementation (which is fully possible here) and not at the cost o
321.
▲
by
esailija
13y ago
I don't know - it's just a default general API, obviously it's not going to match everyone's use case. I would say that even relying on sort made by someone else is already not fit for many use cases. If such a petty and
322.
▲
by
esailija
13y ago
That is a common fallacy and benchmarking anti-pattern, and it really enrages me that some people look at the completely incorrect results and justify it with "I am going to be using this with jQuery so why shouldn't I add some jQ
323.
▲
by
esailija
13y ago
Also another mistake here is the classical "if you want to measure x, don't measure y". If the OP wanted to measure function with or without return , even without realizing how futile that is, they still should not include th
324.
▲
by
esailija
13y ago
That's not throughput. You are running exactly 1 promise in parallel at a time and waiting for it to be resolved. However, on node.js you can have more than 1 client served by your server. For instance, your server could have e.g. 1000
325.
▲
by
esailija
13y ago
When I say performance, I mean throughput not latency. That's why there are no latency benchmarks. Also, in your benchmark you do output in bluebird section with console.log. Maybe try http://jsperf.com/promise-comparis
326.
▲
by
esailija
13y ago
Hmm. Can you post your code and description of the problem as an issue? https://github.com/petkaantonov/bluebird/issues
327.
▲
by
esailija
13y ago
Thanks for your interest - the optimization guide is planned to go over everything I have done.
328.
▲
by
esailija
13y ago
It looks like you are creating wrappers manually, that could be improved. Look into both overloads of [`Promise.promisify`]( https://github.com/petkaantonov/bluebird/blob/master/API.md#... )
329.
▲
Bluebird – A full-featured, fast promises library for JavaScript
(github.com)
90 points
by
esailija
13y ago
|
42 comments
330.
▲
by
esailija
13y ago
You are probably confusing ES spec with DOM spec, if not, at least I cannot find anything in ES spec even remotely related to how anything built on top would have to be asynchronous.
More ›