简体   繁体   English

JavaScript扩展和NPAPI插件之间的性能差异

[英]Difference between JavaScript Extensions and NPAPI plugins with respect to performance

I have written a windowless NPAPI plugin which binds to a shared library for accessing my native resources. 我编写了一个无窗口的NPAPI插件,该插件绑定到用于访问本机资源的共享库。 The plugin is loaded by a web Application running in Firefox browser. 该插件由运行在Firefox浏览器中的Web应用程序加载。 Recently, I have seen in net, that using Java Script extensions, one can also make native code function calls.But these Java Script extensions are specific to browsers. 最近,我在网上看到,使用Java Script扩展,也可以进行本机代码函数调用。但是这些Java Script扩展特定于浏览器。

Can some one please tell me that if I use a Java Script extension instead of NPAPI plugin for calling my native code, will there be any performance improvement in terms of latency in making native library API calls? 有人可以告诉我,如果我使用Java脚本扩展而不是NPAPI插件来调用本机代码,那么在进行本机库API调用的延迟方面是否会有任何性能改进?

Kindly note: My query is generic and not specifically for Firefox browser. 请注意:我的查询是通用查询,并非专门针对Firefox浏览器。

There is no generic answer to a question like this, the mechanisms implemented by different browsers have nothing in common. 对于这样的问题没有通用的答案,不同浏览器实现的机制没有共同点。

Firefox : A native library can be called via js-ctypes . Firefox :可以通过js-ctypes调用本机库。 This mechanism should be more light-weight than the communication with an NPAPI plugin. 这种机制应该比与NPAPI插件的通信更轻巧。 Even more importantly, you don't have the overhead of inter-process communication (newer Firefox versions run plugins in separate processes). 更重要的是,您没有进程间通信的开销(较新的Firefox版本在单独的进程中运行插件)。

Chrome : AFAIK the only way to access operating system functionality (such as writing files to a random location on disk) is via NPAPI, Chrome won't allow extensions to use system libraries. Chrome :AFAIK访问操作系统功能(例如将文件写入磁盘上的随机位置)的唯一方法是通过NPAPI,Chrome不允许扩展使用系统库。 However, if you use a native library only to speed up execution and don't mind having this code run in a sandbox - the native client might work for you. 但是,如果您仅使用本机库来加快执行速度,并且不介意在沙盒中运行此代码,则本机客户端可能会为您工作。 Due to sandboxed execution it will probably be slower than an NPAPI plugin but it won't trigger huge scary warnings when your extension is installed. 由于执行沙盒操作,它可能比NPAPI插件要慢,但在安装扩展程序时不会触发巨大的可怕警告。

Safari : From what I know, Safari doesn't let you use native libraries, not even via NPAPI plugins . Safari :据我所知,Safari不允许您使用本机库, 甚至不通过NPAPI插件

Internet Explorer : As of MSIE 9.0, Internet Explorer still doesn't have anything resembling JavaScript-based extensions. Internet Explorer :从MSIE 9.0开始,Internet Explorer仍然没有类似于基于JavaScript的扩展的任何内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaScript中“>”和“!=”之间是否存在性能差异? - Is there a performance difference in JavaScript between “>” and “!=”? 函数初始化位置之间的性能差异[JavaScript] - Performance difference between function initialization locations [JavaScript] JavaScript 中的“let”和“var”之间是否存在性能差异 - Is there a performance difference between 'let' and 'var' in JavaScript JavaScript创建的内联样式和JavaScript创建的样式表之间的性能差异 - Performance difference between JavaScript created inline styles and JavaScript created stylesheets 双等于(==)和三等于(===)之间的JavaScript性能差异 - JavaScript performance difference between double equals (==) and triple equals (===) javascript中的动态和直接变量返回之间是否存在一些性能差异? - Is it some performance difference between dynamic and direct variable return in javascript? Javascript / jQuery - height()和.css({'height'})之间是否存在性能差异 - Javascript / jQuery - Is there a performance difference between height() and .css({'height'}) for.in和.forEach()之间是否存在性能差异? - Is there a performance difference between for…in and .forEach()? + =,++,+之间的性能差异 - Performance difference between +=, ++, + webpack 配置中的 resolve.plugins 和 plugins 字段有什么区别? - What is the difference between resolve.plugins and plugins field in webpack configuration?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM