v8 对于我的目的来说太慢了
我正在为 libvisual 开发一个音乐可视化插件。它是 AVS 克隆——AVS 来自 Winamp。现在我有一个超级作用域插件。该元素有 4 个脚本,“点”在每个像素上运行。你可以想象它必须相当快。最初的 libvisual avs 克隆有一个 JIT 编译器,速度非常快,但它有一些错误并且没有完全实现,所以我决定尝试 v8。嗯,v8 在每个像素上运行编译的脚本太慢了。有没有其他脚本引擎可以非常快地实现此目的?
I'm working on a music visualization plugin for libvisual. It's an AVS clone -- AVS being from Winamp. Right now I have a superscope plugin. This element has 4 scripts, and "point" is run at every pixel. You can imagine that it has to be rather fast. The original libvisual avs clone had a JIT compiler that was really fast, but it had some bugs and wasn't fully implemented, so I decided to try v8. Well, v8 is too slow running the compiled script at every pixel. Is there any other script engine that would be pretty fast for this purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在每个像素级别运行更新,我建议您拥有屏幕的离屏内存表示,并更新整个屏幕,而不是每个单独的像素。我知道这是位图更新的常见问题,而不是 V8 本身的问题。我对您正在工作的特定环境了解不够,无法提供太多帮助,只是正如我所说,尝试一次针对 UI 画布更新单个像素是一个常见的性能问题。如果您可以对画布/用户界面表面进行离线/离屏表示,然后一次全部更新,您的性能将会好得多。
此外,事件模型的计算方式也存在一些依赖性。如果这不能很好地工作,您可能需要将此逻辑带入已编译的 COM 对象或其他内容中,但在每像素更新方案中,在尝试进行每像素更新时您将遇到类似的问题。并不是说你是,只是再次指出这是此类问题中最常见的问题。
If you are running your updates on a per-pixel level, I would suggest having an off-screen in-memory representation of the screen, and update the screen as a whole, not each individual pixel. I know that this is a common issue for bitmap updates in general, not V8 per-se. I don't know enough about the specific environment you are working in to be much help, only that as I said, it's a common performance issue to try to update individual pixels against a UI canvas one at a time. If you can do an offline/offscreen representation of your canvas/ui surface then update it all at once, your performance will be much better.
Also, there will be some dependencies on how your event model is worked out. If this doesn't work well, you may need to bring this logic into a compiled COM object or something, but on a per-pixel update scheme, you will have similar issues when trying to do per-pixel updates. Not saying you are, just noting again this is the most common issue with this type of problem.
听起来您需要使用本机代码,或者可能是 Java Applet(并不是说我推荐 Java Applet,仅当您完全控制客户端环境时才使用它)。
sounds like you need to use native code, or maybe a Java Applet (Not that I recommend a Java Applet, use it only if you are in full control over the client environment).