随笔分类 -  C#

1 2 3 4 5 ··· 8 下一页
摘要:今天在写一个工具时,写着写着发现执行速度突然变慢。最后发现是string.StartsWith与EndsWith的锅,改为手动比较后,执行时间变成原来的1/5-1/10。代码如下 ,黄色背景是主要部分 using System.Collections; using System.Collection 阅读全文
posted @ 2021-01-02 20:11 时空观察者9号 阅读(789) 评论(0) 推荐(0) 编辑
摘要:主线程开了一个子线程去做事件,这个子线程全速跑和每个循环周期休眠1毫秒,2种方式对CPU的消耗差别是巨大的。 以U3D手游为例,运行时主线程应该全力跑,不做任何sleep,开一个子线程去做网络收发和更新。这时输出CPU使用情况发现。 1,不开子线程,主线程全力跑,此游戏进程的CPU占用率为15%。 阅读全文
posted @ 2020-12-20 11:29 时空观察者9号 阅读(447) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/jzywh/archive/2012/07/30/2615715.html 在Mono/Linux上使用PerformanceCounter 阅读全文
posted @ 2020-12-18 21:18 时空观察者9号 阅读(124) 评论(0) 推荐(0) 编辑
摘要:using System.Diagnostics; using System; using System.Threading.Tasks; namespace THREADS { class Threads { public double[] times = new double[4]; publi 阅读全文
posted @ 2020-12-18 15:53 时空观察者9号 阅读(231) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/BYH371256/article/details/79815097 阅读全文
posted @ 2020-12-15 15:45 时空观察者9号 阅读(149) 评论(0) 推荐(0) 编辑
摘要:解决方案:将C/C++代码编译成so供C#代码调用。 SO生成工具:android studio,简称AS 一,so 生成方法: 1,菜单:File->New->New Project-> Native C++ 2,编写C++导出函数 3,菜单:Build->Select Build Variant 阅读全文
posted @ 2020-12-12 21:25 时空观察者9号 阅读(976) 评论(0) 推荐(0) 编辑
摘要:using System; class MyData { public int[] dat; public MyData(int size) { dat = new int[size]; Console.WriteLine($"构造"); } ~MyData() { Console.WriteLin 阅读全文
posted @ 2020-12-12 10:01 时空观察者9号 阅读(154) 评论(0) 推荐(0) 编辑
摘要:有可能是断点析构函数所导致的卡顿。解决方法:取消VS 中的所有断点 阅读全文
posted @ 2020-12-07 18:12 时空观察者9号 阅读(1343) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/davidCheng/p/3210862.html 阅读全文
posted @ 2020-10-29 11:21 时空观察者9号 阅读(373) 评论(0) 推荐(0) 编辑
摘要:时间:2020.9.29,XMoba第一次Demo 子线程调用UNITY的相关变量或函数导致程序执行过程断掉,且不报任何错误的一个BUG 一,问题现象 网络异步连接的回调函数中使用了一个函数XLog.log,此函数中使用了UNITY的Time.FrameCount,导致程序执行到这一行时异常退出,但 阅读全文
posted @ 2020-09-29 19:09 时空观察者9号 阅读(657) 评论(0) 推荐(0) 编辑
摘要:https://unity.cn/projects/network-service 阅读全文
posted @ 2020-09-21 09:34 时空观察者9号 阅读(159) 评论(0) 推荐(0) 编辑
摘要:http://www.manew.com/thread-108589-1-1.html 其中重要知识点:SynchronizationContext,这个东西来将一个线程的内容传到另一个线程中。没有细看 比如:U3D开发,C#在主线程中执行一个网络异步连接BeginConnect(ip, port, 阅读全文
posted @ 2020-09-20 10:37 时空观察者9号 阅读(1829) 评论(0) 推荐(0) 编辑
摘要:https://docs.microsoft.com/zh-cn/archive/msdn-magazine/2011/february/msdn-magazine-parallel-computing-it-s-all-about-the-synchronizationcontext 阅读全文
posted @ 2020-09-20 10:25 时空观察者9号 阅读(355) 评论(0) 推荐(0) 编辑
摘要:转:https://blog.csdn.net/fgx_123456/article/details/80031821 其中有一个疑问:如果使用TCP收发包,设置了nodelay模式,发一个大于MTU的包,发送过程中会被路由拆包,那么达到接收端的应用层,会不会将这些因为MTU限制而被拆分的包再合起来 阅读全文
posted @ 2020-09-10 20:52 时空观察者9号 阅读(149) 评论(0) 推荐(0) 编辑
摘要:问题起源:void DistpatchEvent(EventType, IEventData) 这里的 IEventData是一个接口,代表事件参数。 为了避免每次发送事件产生GC,决定事件参数使用struct,但struct不能继承,所以这里只能使用接口作为基类。 但将结构体传给接口时会发生装箱操 阅读全文
posted @ 2020-09-09 09:56 时空观察者9号 阅读(398) 评论(0) 推荐(0) 编辑
摘要:https://github.com/thangchung/awesome-dotnet-core 阅读全文
posted @ 2020-07-02 18:32 时空观察者9号 阅读(166) 评论(0) 推荐(0) 编辑
摘要:https://github.com/disruptor-net/Disruptor-net 阅读全文
posted @ 2020-06-30 19:35 时空观察者9号 阅读(177) 评论(0) 推荐(0) 编辑
摘要:PhotonServer-14052: 17:14:09.033 - StopApplication - Exception: CManagedHost::GetManagedHost() - AppDomain Manager not available for id: 26 原因:ID为27的程 阅读全文
posted @ 2020-05-17 17:40 时空观察者9号 阅读(212) 评论(0) 推荐(0) 编辑
摘要:.net standard的程序集中定义的是一些标准接口,.net core与.net framework都可以调用。 而.net core编写的程序集与.net framework的程序集是不兼容的,比如.net core3.1编写的程序集使用了system.io.filesystem的版本是 4 阅读全文
posted @ 2020-05-05 21:07 时空观察者9号 阅读(397) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/liushen/p/Different_Dlls_In_The_Projects.html 阅读全文
posted @ 2020-05-05 15:37 时空观察者9号 阅读(204) 评论(0) 推荐(0) 编辑

1 2 3 4 5 ··· 8 下一页
点击右上角即可分享
微信分享提示