字符串连接符效率分析
来源:互联网 发布:js 中文简体繁体转换 编辑:程序博客网 时间:2024/05/21 07:11
Stopwatch st1 = new Stopwatch(); Stopwatch st2 = new Stopwatch(); Stopwatch st3 = new Stopwatch(); st1.Start(); for (int i = 0; i < 10000000; i++) { string a = "1234567"; string b = "abcdefg"; string c = a + b; } st1.Stop(); st2.Start(); for (int i = 0; i < 10000000; i++) { string a = "1234567"; string b = "abcdefg"; string c = string.Format("{0}{1}", a, b); } st2.Stop(); st3.Start(); for (int i = 0; i < 10000000; i++) { string a = "1234567"; string b = "abcdefg"; StringBuilder c = new StringBuilder(); c.Append(a); c.Append(b); } st3.Stop(); Console.WriteLine("st1:{0}", st1.ElapsedMilliseconds); Console.WriteLine("st2:{0}", st2.ElapsedMilliseconds); Console.WriteLine("st3:{0}", st3.ElapsedMilliseconds);结果:st1:570st2:1690st3:563
阅读全文
0 0
- 字符串连接符效率分析
- C#: 字符串连接 (+=) 与 StringBuilder 效率分析
- 字符串连接效率测试
- 字符串连接效率探究
- javascript中字符串连接效率
- VB6字符串连接操作效率
- 提高字符串连接的效率
- C#中字符串连接效率测试
- 字符串连接在不同浏览器中效率
- Java字符串连接效率 String、StringBuilder、StringBuffer
- C#字符串连接的效率问题
- python3字符串连接方法效率测试
- python字符串连接导致效率问题
- Java字符串连接效率比较之String.concat() 连接符+号 和StringBuilder类
- 深入java字符串原理及其效率分析
- python字符串连接效率比较(使用+连接)
- java字符串连接性能分析
- 三种字符串连接方法的效率比较
- 组合View之自定义按钮_另一种方法
- 前言:Python半深入讲义
- sticky footer设计
- ubifs文件系统的制作
- 【Python自学】06. 判断与循环
- 字符串连接符效率分析
- CC2541之notify通知方式的介绍和使用 一、简介 本篇介绍CC2541从机端的notify通知的两种方式。 二、实验平台 协议栈版本:BLE-CC254x-1.4.0 编译软件:IAR
- 开始使用Titan
- JAVA实践-TOMCAT启动项目提示的各种异常:空指针异常,未开启服务等
- 颜色转换
- Intellij IDEA使用restclient测试
- FFmpeg 中AVPacket的使用
- Catch That Cow (BFS)
- #关于黑框游戏__弹球游戏#