Daily Tech Briefing
AI 科技速览

每天 5 分钟内学习 AI。获取最新的人工智能新闻,理解其重要性,并学习如何将其应用于您的工作。

AI 快讯
Hacker News · 2026/8/2 07:58:30

Cyberscript

AI 中文解读
Cyber脚本语言闪亮登场!一句话概括:一款比Python、Ruby快好几倍,还能轻松嵌入App和游戏的新一代编程语言。通俗点说,Cyber就像给开发者准备的一辆“高性能跑车”——上手简单,既能用动态类型快速写代码,也能用静态类型保证严谨;它独有的“协程”机制让程序能同时处理多件事,加上JIT即时编译,跑起递归计算来比Python快近14倍,内存占用还不到Python的三分之一。对普通人来说,这个技术可能听起来遥远,但影响却很实际:Cyber体积小、速度快,可以像电池一样嵌入到各类软件和游戏发动机里,意味着以后手机App启动更快、游戏操作更跟手,甚至网页上的复杂应用也能流畅运行。目前Cyber已开源到GitHub,提供命令行和可嵌入的编译虚拟机,跨平台支持Windows、macOS和Linux。对开发者而言,它提供了新选择;对普通用户而言,那些“秒开”的体验背后,可能就有Cyber的一份功劳。
Home Perf. Docs Play Github v0.3 Cyber is a new language for fast, efficient, and concurrent scripting. Install Release Notes At a glance. Easy to learn. Dynamic and static types. Concurrency with fibers. Memory safe. FFI and Embeddable. Fast VM and JIT. Cross platform. use math var worlds = ['World', '世界', 'दुनिया'] worlds.append(math.random()) for worlds -> w: print "Hello, $(w)!" -- Optional static typing. func fib(n int) int: coyield if n < 2: return n return fib(n - 1) + fib(n - 2) -- Counts fib calls. var count = 0 var fiber = coinit(fib, 30) var res any = 0 while fiber.status() != .done: res = coresume fiber count += 1 print "$(res) $(count)" Use cases. Cyber wants to provide fast and delightful scripting. The compiler and VM can be embedded into applications, games, and engines. The CLI app can run scripts on desktops and servers. Performance. Cyber is fast on various benchmarks. The language was designed with performance in mind from the start. See more Benchmarks or read more about Performance. Recursive Fibonacci (VM) source This tests how fast function calls are with a growing call stack. cyber 19ms   2.9 MB luajit 21ms   1.4 MB wasm3 31ms   1.4 MB luau 34ms   2.1 MB lua 39ms   1.3 MB quickjs 57ms   1.9 MB wren 71ms   1.5 MB java 44ms 31ms 35.2 MB python3 70ms 15ms 10.2 MB ruby 54ms 31ms 29.6 MB node 56ms 39ms 31.9 MB Recursive Fibonacci (JIT) source cyber 5ms   2.9 MB luajit 5ms   1.6 MB luau 20ms   2.3 MB java 3ms 31ms 38.3 MB node 6ms 35ms 34.0 MB ruby-yjit 13ms 30ms 30.1 MB Showing script time (orange), load time (gray), and peak memory usage. Features. To get a comprehensive overview of the language and its features, see the Documentation. Interop. libcyber allows Cyber to be embedded into your applications. Cyber's CLI and core library were built using libcyber. The FFI API allows your scripts to use any C-ABI compatible library. cbindgen.cy was also created as a tool to automatically generate full bindings from just a C header file. Some example bindings include Raylib and LLVM. Support us. Cyber is still evolving so ideas are always welcome! Feel free to file issues on GitHub or hop on over to our Discord. If you're feeling generous, consider supporting the project via Github Sponsors or Patreon! © 2022-2023 Cyber Authors. hljs.registerLanguage('cy', function() { return { keywords: ['func', 'use', 'for', 'coinit', 'coresume', 'coyield', 'return', 'if', 'as', 'wh
分享
阅读原文