4,235 karma · joined Sep 10, 2015 (11y ago) · 1,525 submissions
comment 6y ago · link · parent
Even if updating analyses, creating indices, changing the query, etc. fails, you can always either use CTEs or temporary tables, or use a stored procedure that manually iterates over results to implement whatever strategy is desired.
It might be more time consuming than having query hints, although this is compensated by the fact that almost always queries just work after creating appropriate indices.
comment 6y ago · link · parent
The advantage of having higher prices is that only people who REALLY need an article will buy it, so limited supplies will go to them.
For instance, if FFP2 masks are in a limited supply and cost $0.01 each, then everyone is going to try to buy in lots of 1000, and they will run out immediately, with the supply going to random people who probably will not even use most of them.
But if FFP2 masks cost $100 each, then people will buy and use them only when strictly needed, and they will be available for those who absolutely need them and are thus willing to pay any amount of money.
The only problems are:
- People who irrationally try to price gouge when the price is already correct, costing themselves money and making the article unavailable
- The potential inability of people who are highly needy to obtain loans or have sufficient basic income to purchase high-priced supplies
The former is fixed by providing the forecasts that are used to set prices, thus providing a credible insight that there will be no shortage at current prices, while the latter by having better ways of ensuring that loans are repaid and generally making it easier to give out loans.
comment 6y ago · link · parent
What could be done is to have the component function return a closure that returns the VDOM nodes instead of the VDOM nodes themselves, and then the hooks would be run only once, since rerendering would only run the returned closure and not the whole component function, and there would be no need for the magic or rules.
Like this:
const Component = component((comp) => {
const [show, setShow] = useState(comp, false);
return (...props) => (
<div>
<button onClick={() => setShow(!show())}>Show Menu</button>
// Mounted with show = true and unomunted with show = false
{show() && <MenuDropdown />}
</div>
);
});
Where the changes are that the hook takes the component as an argument, show is now a function rather than a value and a closure (that takes the props) is returned rather than returning the VDOM nodes directly.The React Hooks API is essentially equivalent to this, but inelegant, unintuitive and somewhat inefficient.
comment 6y ago · link · parent
3/7 = 2/4 (+) 1/3 = 1/2 (+) 1/3 = 2/5, absurd because 2/5 != 3/7
Once this is realized, it's easy to see that the correct formulation for the "table joining" operation used here is a weighted arithmetic mean, i.e. a(/)b (+) c(/)d = weighted arithmetic mean of a/b and c/d with relative weights b and d = ((a/b) * b + (c/d) * d) / (b + d) = (a + c)/(b + d).
On the other hand, fraction addition is clearly determined as a/b + c/d = ad/bd + bc/bd = (ad + bc)/bd given the a/b = (ak)/(bk) and (a/b + c/b) = (a + c)/b axioms.
comment 6y ago · link · parent
Obviously there are big, possibly insurmountable, obstacles related to the cost of onboarding/learning bespoke tech stacks, the need to preserve trade secrets and serial dependencies that require work to be performed quickly.
comment 6y ago · link · parent
That is, a table on the jepsen.io frontpage, or at least on each product's review page, with database products and configuration on rows and consistency properties on columns, and a nice "Yay!" or "Nope!" mark in the cell, plus links on how to achieve the database configurations in the table (esp. how to configure each database to have the most guarantees).
Also, ideally the analyses should be rerun automatically (or possibly after being paid, but making it easy for the company to do so) every time a new major release happens rather than being done once and then being stale.
Finally, there should be tests for the non-broken databases (PostgreSQL for instance, both in single-server mode, deployed with Stolon on Kubernetes and using the multimaster projects) as well to confirm they actually work.
comment 6y ago · link · parent
Some things, namely array indexing and RefCell borrowing, have unavoidable extra runtime overhead in the default safe usage, but it's unlikely that it is significant (often array bounds checks are either essential and thus needed in C++ as well or optimized out by LLVM in Rust, and RefCell usage is generally rare), and you can use unsafe unchecked operations as well.
comment 6y ago · link · parent
Obviously a CPU could use a predictor for CMOVs as well, although I think the commonly used CPUs don't (but not too sure).
comment 6y ago · link · parent
1. Borrowed pointers are not a first class concept, but just syntax sugar over returning a parameter from a function, i.e. &T or &mut T are not actual types in Rust parlance
2. There is no mention on how to achieve safe shared mutable data or even just shared read-only data, i.e. the equivalent of Rust's Arc<Mutex<T>> or Arc<T>, which probably means the language has no support
3. It seems there is no way for a struct/record/tuple to contain another non-primitive data type without the latter being allocated on the heap
So as far as I can tell aside from the dependent types this language is much less powerful than Rust and cannot fully utilize the CPU, and hence far from the goal of having a perfect Rust+dependent types language.
comment 6y ago · link · parent
comment 6y ago · link · parent
If you _really_ want to avoid any contention, then build the benchmark as a Linux kernel module and call stop_machine(), which will prevent anything else including interrupt handlers from running.
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
Looking at the Android API docs, it looks like Google does not trust government apps and so provides only limited data and alerts the user with a popup when the app asks for information.
It's not clear why Google doesn't provide the UI themselves, although maybe they intend to do so at a later time?
comment 6y ago · link · parent
Or in other words, wouldn't it have been easier and better to make an optionally headless version of the Servo browser with additional native APIs and some enhancements like being able to run JavaScript directly in addition to HTML?
The choice made means that Deno can't be used, at least directly, to make desktop applications, and also doesn't have all the features that browsers have for free, like multiprocess and multiple sandboxes, network traffic inspector, local storage, GPU compute, etc.
comment 6y ago · link · parent
Getting restaurant food delivered is a waste of money compared to getting bulk food delivered from supermarkets, so those who order it are probably not very price sensitive, and thus simply raising prices until the company is profitable should work without losing so much customers that economies of scale are lost, assuming there are no money-losing competitors.
comment 6y ago · link · parent
Still not clear why localhost (which can mean root access to the local machine since it may have localhost-only services that enable that) and cookies access is needed, also http://*.pushbullet.com is unnecessary since they should always use HTTPS.
If they had properly implemented the extension they may not have this problem now.
comment 6y ago · link · parent
malloc/free is fast with a moving GC, but moving is not, and if an object is never moved it's likely that it should not have been allocated on the heap in the first place.
The cmpxchg problem is solvable by epoch-based reclamation libraries (RCU, crossbeam-epoch, etc.), and while a traditional GC also solves it, it's not necessary.
comment 6y ago · link · parent
Also in most cases work that is done at home is done in on a computer, so the same space that is used for home computer use can be reused at no additional space cost besides possibly an extra desktop or laptop if a dedicated machine is used.
comment 6y ago · link · parent
Mandatory GC is not a zero-cost abstraction (it is ridiculously inefficient and unnecessary in general), and a language with mandatory GC is a non-starter as a universal language. C programs (like web browsers) are starting to have new code written in a different language only now that Rust is available as the first zero-cost non-GC safe language.
Yes, dependent types improve performance by eliding checks, but that's only likely to be a net win if the rest of the compilation is optimal.
comment 6y ago · link · parent
Also it's not enough to erase irrelevant types, the types that end up in the program also need to be treated efficiently, which means generic monomorphization, not auto-boxing things unless essential (or ideally never), using computed layouts where possible (i.e. store (n, [T; n], [T; n]) in a single allocation if n is immutable), etc.
The issue is that I think all of the current dependently typed languages don't have zero-cost abstraction and compiled code efficiency as a primary goal, they are designed for research or as machine-checked proof systems.
There's also the issue that some features may not compose well, e.g. Rust's ability to mutate a single field in place (needed for zero-cost since CPUs can do that with a store instruction) doesn't compose very well with dependent types because that can change the type of other fields, and also linear types (again needed to fully use CPUs) don't go well with having proof-like types that refer to other values, etc. All this seems fixable, but it seems quite involved to find the most general and ergonomic solution.
comment 6y ago · link · parent
Hopefully Rust will evolve into it or a new language will come up for that: we really need this to finally have a programming language that is strictly better than all others and can thus be the single language in use and finally the solve the programming language problem.
comment 6y ago · link · parent
For example, it might be fine as a way to guarantee the integrity of things like Folding@Home where disruption provides no gain other than the satisfaction of successful vandalism, but not for securing a popular cryptocurrency.