webassembly

Running async functions on Google Apps Script

落爺英雄遲暮 提交于 2021-02-04 05:04:20
问题 I am attempting to run WebAssembly on the new V8 Google Apps Script runtime, and it appears to be supported, however it seems that async functions are terminated after they return a Promise. let wasm= new Uint8Array([/* snip */]).buffer function add(a,b) { return((async()=>{ console.log("running function...") results=await WebAssembly.instantiate(wasm) return results.instance.exports.add(a,b) })()); } function test(){ add(2,3).then(console.log).catch(console.error) } when I run test "running

如何为 Web 主机做预算

守給你的承諾、 提交于 2021-01-30 08:53:11
每日前端夜话 第284篇 翻译: 疯狂的技术宅 作者:Mokhtar Ali Ebrahim 来源:likegeeks 正文共: 2403 字 预计阅读时间:7分钟 我们都想通过共享托管来省钱,但是对于某些网站,VPS 甚至专用计划都是不可避免的。如果你不得不做一个更高级的计划,这可能意味着你的网站正在成长并获得更多的流量——因此,付出的财务成本将是值得的。 但是,你如何计划该财务成本,并尽可能降低呢?首先,你需要知道网站的目标。 你网站的目标是什么? 为了找出最适合你自己的网络托管计划预算,确定你网站的目标是很非常重要的。无论是太复杂还是不够可扩展,最终都会为次付出代价。 如果你的目标是网站… 在家人和朋友中吸引少量粉丝 作为当地企业的联系点 展示个人的作品或简历 …那么 共享托管(2.75 - 15.00 美元/月) 绰绰有余。但是,如果你希望该网站: 处理中型企业的流量需求 有足够的安全性来处理电子支付 承载成功和活跃的博客 随着流量的增加,保持良好的页面速度和图像加载时间 …你需要升级到 VPS(5 – 80美元/月) 。 唯一需要为 专用计划(80 – 730美元/月) 掏钱的网站是: 面向拥有大量跨国受众并产生大量访问量的公司的页面 电子商务需求特别大的网站,例如存储大量高分辨率产品图片 如果你现在经营的是一个只有几页的小型网站,但目标是最终扩大规模并成为高流量

云原生|我对云原生软件架构的观察与思考

夙愿已清 提交于 2021-01-30 03:11:53
作者 | 易立,阿里云资深技术专家,容器技术负责人 本系列文章: 第一篇 - 云原生基础设施 (已发布,文末点击阅读原文查看) 第二篇 - 云原生软件架构(本文) 第三篇 - 云原生应用交付与运维体系(待续) 前言 在《云原生基础设施》一文中我们谈到了,云原生计算包含三个维度的内容,云原生基础设施,软件架构和交付与运维体系,本文将聚焦于软件架构层面。 “Software architecture refers to the fundamental structures of a software system and the discipline of creating such structures and systems. ” - 维基百科。 在我的理解,软件架构主要目标是解决下列挑战: 控制复杂性。 由于业务的复杂性,需要我们用更好的手段帮助研发组织克服认知障碍,更好的分工协作。分而治之,关注点分离等手段皆是如此。 应对不确定性。 业务在快速发展,需求在不断变化。即使再完美的软件架构,然而随着时间的推移,团队的变化,软件架构的调整不可避免。读《设计模式》,《微服务设计》等书字里行间写的都是“解耦”两字,让我们关注架构中确定性和不确定性的分离,提升架构的稳定性和应变能力。 管理系统性风险。 管理系统中的确定性以及不确定性风险,规避已知陷阱,对未知的风险做好准备。

“Failed to run llvm optimizations” using clang++ for webassmebly

南笙酒味 提交于 2021-01-29 17:31:25
问题 I've installed emscripten-1.38.27 1 and fastcomp-clang-e1.38.27-64bit via the official emsdk tool. After running qmake and gettting no errors nor warnings,I ran make for my Qt project and that resulted in this(with EMCC_DEBUG=1 ): shared:DEBUG: executed emsdk-master/fastcomp-clang/e1.38.27_64bit/clang++ -target asmjs- unknown-emscripten -D__EMSCRIPTEN_major__=1 -D__EMSCRIPTEN_minor__=38 -D__EMSCRIPTEN_tiny__=27 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -nostdinc -Xclang

JavaScript string is empty when passed to Rust WebAssembly module

心不动则不痛 提交于 2021-01-29 12:30:54
问题 When passing a string to a Rust WASM module, the passed data shows up as blank, as per the pattern matching in the real_code::compute function The following code is what I've tried. I don't know if it has to do with how its being returned, but when I pass a hardcoded &str , it works fine. However, the JsInteropString shows as blank. Here is how I encoded the string before sending it to WASM (from Passing a JavaScript string to a Rust function compiled to WebAssembly) const memory = new

Why is WebAssembly safe and what is linear memory model

允我心安 提交于 2021-01-29 06:37:10
问题 (1) I heard WebAssembly's safety by providing a linear memory. I wonder what does this linear memory contain? does wasm stack and heap locate in this memory space? If yes, I think the stack of wasm and stack of glue code (e.g., js python etc) are separate, right? (2) I can understand memory safety of wasm by using an import table. In other words, wasm function cannot call any function outside the linear memory because it can only use an index to call the imported functions. Besides this, what

URL Rewrite exceptions for Blazor WebAssembly Hosted deployment

筅森魡賤 提交于 2021-01-29 06:26:47
问题 During development, i have used Swagger on the server side of my Blazor WebAssembly App. Always launching (debug) using kestrel instead of IIS Express. Routing worked as expected, all my component routed properly and if i manually typed /swagger, i got to the swagger page. All good. We have deployed under IIS on our pre-prod servers, the Server side and Blazor WebAssembly App (client) work as expected and are usable, however, my /swagger url gets rewritten (I assume) to go somewhere in my App

Node.js single-thread mechanism

雨燕双飞 提交于 2021-01-28 21:32:42
问题 I learnt Node.js is single-threaded and non-blocking. Here I saw a nice explanation How, in general, does Node.js handle 10,000 concurrent requests? But the first answer says The seemingly mysterious thing is how both the approaches above manage to run workload in "parallel"? The answer is that the database is threaded. So our single-threaded app is actually leveraging the multi-threaded behaviour of another process: the database. (1) which gets me confused. Take a simple express application

WASM backend for tensorflowjs throws “Unhandled Rejection (RuntimeError): index out of bounds” error in Reactjs

倖福魔咒の 提交于 2021-01-28 21:08:00
问题 I am trying to set up a WASM back-end for blazeface face detection model in a react app. Although the demo with the vanillajs can run it without any error for hours, in react it throws "Unhandled Rejection (RuntimeError): index out of bounds error" after leaving the cam open for more than 3-5 minutes. Entire app crashes with this error. From the log of the error below, maybe it is related to disposeData() or disposeTensor() functions which to my guess, they are related to garbage collecting.

WASM backend for tensorflowjs throws “Unhandled Rejection (RuntimeError): index out of bounds” error in Reactjs

僤鯓⒐⒋嵵緔 提交于 2021-01-28 20:40:49
问题 I am trying to set up a WASM back-end for blazeface face detection model in a react app. Although the demo with the vanillajs can run it without any error for hours, in react it throws "Unhandled Rejection (RuntimeError): index out of bounds error" after leaving the cam open for more than 3-5 minutes. Entire app crashes with this error. From the log of the error below, maybe it is related to disposeData() or disposeTensor() functions which to my guess, they are related to garbage collecting.