Giter Site home page Giter Site logo

performancetesting's Introduction

Example PRs Welcome

简介

Unity游戏引擎, C#原生丶puerts脚本丶xLua脚本性能测试与横向对比

初始化

使用node命令行, 快速安装指定版本的puerts到指定目录:

node ./.script/get-puerts.mjs --version 1.4.0-rc.2 --path package

使用node命令行, 快速启动测试:

node ./.script/run-test-cli.mjs --unity `unity editor install absolute path` --pkg package

//例:
node ./.script/run-test-cli.mjs --unity /****/_UNITY_/2020.3.34f1c2/Unity.app/Contents/MacOS/Unity --pkg package

node ./.script/run-test-cli.mjs --unity D:/****/Unity/2020.3.34f1c2/Editor/Unity.exe --pkg package

测试平台

  • 基础
  • 反射调用-Editor
  • 反射调用-Windows
  • 反射调用-Androd
  • 静态代码调用-Editor
  • 静态代码调用-Windows
  • 静态代码调用-Android
  • IL2CPP调用-Windows
  • IL2CPP调用-Android
  • 附加
  • ValueType BlittableCopy unsafe编译
  • 软件版本

测试项目

测试结果

结论

  • xLua性能优于puerts,据作者@John所言,Unity与C++(puerts)相互调用比较与C(xLua)相互调用要慢
  • 使用puerts应尽量避免跨语言调用 PS:使用任何脚本框架都应该尽量避免跨语言调用
  • puerts没有脚本fix功能: 推荐使用 InjectFix + puerts 混合开发

如何选择

puerts xLua
开发语言 typescript丶javascript lua丶haxe(不推荐)
跨语言效率
IDE支持 vscoderider EmmyLuaLuaPandaLuaPerfect
代码提示 完整类型定义 局部类型推断+手动注释
代码规范 eslint丶tslint等 人工review
第三方库 得益于浏览器丶nodejs的普及, npm上拥有大量可用es库 自行编译丶扩展(有限支持)

performancetesting's People

Contributors

throw-out avatar zombieyang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.