Alchemy C 库比等效的 as3 库更快/更慢吗?
我有一个简单的问题。假设一些简单的lib写在c上。我是否正确理解alchemy在将其编译为swf之前将其编译为AS3。如果是这样,与在 AS3 上编写的相同库相比,该库会更慢还是更快。
I've got a simple question. Suppose some simple lib written on c. Did I understood correctly that alchemy compiles it AS3 before compiling it to swf. If so, will the lib be slower or faster in comparison with the same lib written on AS3.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Alchemy 使用 修改后的 ActionScript 编译器,允许使用 新操作,加速内存访问或允许符号扩展来处理 C 类型。
它编译为 SWF 或 SWC 格式,但您可以选择查看生成的 as 文件,
内部 Alchemy 模拟处理器(似乎是 X86 proc),并拥有一个复制一些核心 C 库的库,例如 Malloc、Free、等等...
因此,如果您的库大量使用内存,您会看到速度增益,但否则,当它编译为字节码并模拟 C 库时,您会看到增益损失。
在当前状态下,您不会看到与 C 代码相同的速度。
Alchemy use a modified actionscript compiler that allow the use of new operation who speed up memory access or allow sign extension to deal with C type.
It compile to SWF or SWC format but you have an option to see the as file genereated
Internally Alchemy emulate a processor (it seems to be an X86 proc) and have a library that replicate some of the core C lib such as Malloc, Free, etc...
So you will see a speed gain if your library use memory a lot but otherwise, as it compile to bytecode and emulate the C lib you can see a gain loss.
You will not see in the current state the same speed as your C code.
不,Alchemy 不会编译为 as3,它充当 C/C++ 代码的桥梁。因此 AS3 可以利用用 C/C++ 编写的函数,从而以最小的降级获得高性能。所以它只会慢一小部分......
No, Alchemy does NOT compile to as3, it functions as a bridge to c/c++ code. So AS3 can utilize the functions written in C/C++ AND thus benefit from the high performance with a minimal degradation. So it will be just a really small fraction slower...