前端开发入门到精通的在线学习网站

网站首页 > 资源文章 正文

VB6与Perl、Julia拼接速度测试(vb6运行库)

qiguaw 2024-11-11 13:08:52 资源文章 13 ℃ 0 评论

VB6与其它语言字符串拼接速度测试之七 (Perl、Julia)

应读者要求,本文将继续进行VB6与其它编程语言的字符串拼接速度的测试。下面将进行Perl、Julia的字符串速度拼接测试,如有不足之处请指出,将予以修正。为保证测试结果的公平,以下测试都是Release模式,32位优先,命令行(管理员身份)方式调用。

Perl拼接测试

测试代码

#!/usr/bin/perl -w

use Time::HiRes qw( gettimeofday );

my ($seconds, $microseconds) = gettimeofday;

$starttime=$seconds*1000+(0.0+ $microseconds)/1000.0;

$strout = "";

for($a=0;$a<10000000;$a+=1){

$strout.="AAAAA";

}

#print("strout = $strout\n");

my ($e_seconds, $e_microseconds) = gettimeofday;

$endtime=$e_seconds*1000+(0.0+ $e_microseconds)/1000.0;

printf "拼接一千万字符共用时%.0f毫秒\n",$endtime-$starttime;

测试结果

耗时822毫秒

Julia拼接测试

using Dates

using Printf

# 获得计算机当前时间

starttime = Dates.now()

arrStr=[]

for i in 1:10000001

append!(arrStr,"AAAAA")

end

str1=join(arrStr,"")

# 获取过段时间后的时间

endtime = Dates.now()

# 计算时间差并以豪秒的格式输出

delta = endtime - starttime

totaltime=Dates.value(delta)

@printf("拼接1千万字符串花费时间:%d毫秒",totaltime)

测试结果

耗时4376毫秒

测试结果汇总

拼接性能排行榜

语言

时长

C++ char

11毫秒

C

16毫秒

RUST

32毫秒

C++

75毫秒

Go

87毫秒

Lazarus

146毫秒

Delphi XE 10

156毫秒

C++ Builder2010

168毫秒

VB.Net

174毫秒

.Net7

183毫秒

C#

184毫秒

.NetCore3.1

185毫秒

Delph10 StringBuilder

188毫秒

Java8

196毫秒

VB6 system.text.V2.dll

248毫秒

IE JS

297毫秒

VisualFreeBasic永芳版

344毫秒

VB6 system.text.dll

346毫秒

Delphi7 FastMM4

549毫秒

Chrome JS

781毫秒

Perl

822毫秒

Excel VBA数组

844毫秒

twinBasic

856毫秒

Delphi7

889毫秒

VB6数组

949毫秒

Python3.11

1012毫秒

Python

1137毫秒

PHP

2156毫秒

Asp

3140毫秒

Julia

4376毫秒

VB6原始方法

未知

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表