Bruce

Results 14 comments of Bruce

Support lua 5.3, you need luasocket https://github.com/diegonehab/luasocket

> 倒和lua侧没关系。 主要是之前实测GCHandle还是挺慢的,大致相当于Key为Object的Dictionary的效率(估计内部也是HashMap实现),当时测试是不如ObjectTranslatorPool的数组方案的。这是非线程安全版本的来由。 而线程版本是在非线程安全版本改的,只加个锁。 我测试了下GCHandle(保存到lua提供的extra space)和Dictionary效率对比 ```csharp class Test { public LuaState L; int v = 0; public Test() { L = LuaAPI.luaL_newstate(); SetExtraObject(L, this, true); } private static void...

1. 其实加cache只是上层优化技巧,~~GCCache加一个thread local的LastObject也能达到这种效果~~.关键是核心层要保持thread clean,留有扩展空间. 2. 我遇到的一个问题是使xlua的ObjectTranslator保持thread clean后, one thread one LuaVM情况下还是出现了线程竞争,造成lua执行出错,并抛出混乱的调用堆栈

仔细看了下 ObjectTranslator.Find函数的实现,发现这行调用让lastTranslator的缓存变得意义不大了:` var ptr = LuaAPI.xlua_gl(L);`. ``` raw cost 126, per 1.26ns/op GCHandle cost 611, per 6.11ns/op Dictionary with lastcache cost 730, per 7.3ns/op ```

> 这最开始并不是这样(没有xlua_gl调用)。而且早年的unity GCHandle 支持我记得是有些问题的 xlua_gl 是为了从lua~~协程~~非主thread中获取正确标识符

> > > 这最开始并不是这样(没有xlua_gl调用)。而且早年的unity GCHandle 支持我记得是有些问题的 > > > > > > xlua_gl 是为了从lua协程中获取正确LuaSate > > 你搞混了概念了。参数带的LuaSate其实标识的就是携程(默认也有个携程,你没自己创建携程实际上就跑在这个默认的携程上)。而xlua_gl获取的是虚拟机公共数据,为了识别出虚拟机。 我更正了下

This is not the right way, in *unix system only some c api can called in signal handler 发自我的iPhone 在 2020年7月11日,上午5:18,kytooooo 写道:  Good question. A friend way I knew...

The routine handler must be very careful, since processing elsewhere was interrupted at some arbitrary point. POSIX has the concept of "safe function". If a signal interrupts an unsafe function,...

诊断速度变慢,写代码时十几秒才能诊断完

> > 诊断速度变慢,写代码时十几秒才能诊断完 > > 请开一个新的issue并提供日志与可复现此问题的演示工程 示例估计太好复现,我是拿我们的项目来说的,文件比较多 500多个