V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  phpfpm  ›  全部回复第 2 页 / 共 27 页
回复总数  534
1  2  3  4  5  6  7  8  9  10 ... 27  
@yumusb 主要是这个现象无法描述,搜索引擎对于*支持的很差

我试了搜索 star after capture group 也没找到合适的结果

但是至少 ff 给你说 too much 了 hhh
```
package main

import (
"fmt"
"regexp"
"strings"
"time"
)

func testRegexPerformance(repeatCount int) {
testString := strings.Repeat("a", repeatCount) + "#"
regex := regexp.MustCompile(`(\w*)*$`)

startTime := time.Now()
result := regex.MatchString(testString)
endTime := time.Now()
executionTime := endTime.Sub(startTime).Milliseconds()

fmt.Println("Repeat Count:", repeatCount)
fmt.Println("Execution Time:", executionTime, "milliseconds")
fmt.Println("-----------------------------------")
fmt.Println(result)
}

func main() {
// 测试从 1 到 50 的重复次数
for i := 1; i <= 50; i++ {
testRegexPerformance(i)
}
}
```

```
function testRegexPerformance(repeatCount) {
var testString = 'a'.repeat(repeatCount) + '#';
var regex = /(\w*)*$/;

var startTime = process.hrtime();
var result = regex.test(testString);
var endTime = process.hrtime(startTime);
var executionTime = endTime[0] * 1000 + endTime[1] / 1000000;

console.log("Repeat Count:", repeatCount);
console.log("Execution Time:", executionTime + " milliseconds");
console.log("-----------------------------------" + result);
}

// 测试从 1 到 50 的重复次数
for (var i = 1; i <= 50; i++) {
testRegexPerformance(i);
}
```
<?php

function testRegexPerformance($repeatCount) {
$testString = str_repeat('a', $repeatCount) . '#';
$regex = '/(\w*)*$/';

$startTime = microtime(true);
$result = preg_match($regex, $testString);
$endTime = microtime(true);
$executionTime = ($endTime - $startTime) * 1000;

echo "Repeat Count: $repeatCount\n";
echo "Execution Time: $executionTime milliseconds\n";
echo "-----------------------------------\n";
var_dump($result);
}

// 测试从 1 到 50 的重复次数
for ($i = 1; $i <= 50; $i++) {
testRegexPerformance($i);
}
```

```
import re
import time

def test_regex_performance(repeat_count):
test_string = 'a' * repeat_count + '#'
regex = r'(\w*)*$'

start_time = time.time()
result = re.match(regex, test_string)
end_time = time.time()
execution_time = (end_time - start_time) * 1000

print("Repeat Count:", repeat_count)
print("Execution Time:", execution_time, "milliseconds")
print("-----------------------------------")
print(result)

# 测试从 1 到 50 的重复次数
for i in range(1, 51):
test_regex_performance(i)
```
2024-01-25 14:12:01 +08:00
回复了 wulilele 创建的主题 程序员 按下列要求生成一些长度为 10 位的十六进制数。
这问题一点也不有趣
2024-01-22 13:03:07 +08:00
回复了 wuyadaxian 创建的主题 硬件 关于东芝硬盘后续。顺便求推荐企业级硬盘。
能上全闪还是全闪吧。。。别替老板省钱
2024-01-18 12:58:45 +08:00
回复了 well775397252 创建的主题 PHP 求指点 PHP 内存泄露排查
你们一个月不上线?
2024-01-15 18:29:39 +08:00
回复了 molika 创建的主题 宽带症候群 老家的网络突然很多网站打不开
你能具体说说么,发一下 curl 和 traceroute

不要只凭感觉发泄情绪

据我所知宽带差一点也不会出现你说的这么差。。。

盲估开启了 ipv6 导致 dns 不对之类的问题
保留现场,闪退,避免带来更多问题
2023-12-24 22:19:19 +08:00
回复了 huage 创建的主题 NVIDIA 2023 年 12 月底了哪款显卡合适个人电脑做 AI 图文?
个人显然不会觉得 2w 对于一个生计来说是贵的,只是说不适合你。。
@mohumohu
1 捡来的设备找不到技术支持,当然厚点脸皮也不是不行
2 主要是将来换路由的时候直接改三层的下一跳就行,别的不用改。。。
屠龙的勇士终将成龙
2023-11-06 12:17:30 +08:00
回复了 sudosu 创建的主题 云计算 北京移动用户可以领取一年免费云电脑 开通代码: KTYDNCXBTYNB
试用了,没啥用
@Wenpo 我觉得整体向好
@flynaj 猫棒我可以加额外散热,而且连接数真的可以秒杀光猫。

@RecursiveG 协议分流和做主路由并不能打
@nkloveni 有点丑。。。
@kkk9 对我就是机柜……
@Satansickle 有点丑,&& 我是多线负载多了一个莫名其妙的 wan 口就很奇怪


感谢 1~5 楼的回复,看起来确实不是我不会用的问题。
2023-10-26 14:02:36 +08:00
回复了 dreamn 创建的主题 Linux 求推荐自组装 Linux 主机
你要不要捡垃圾,价格可以低到怀疑人生。。

R620 ,预算 double 可以上 R730
2023-10-23 12:39:31 +08:00
回复了 cy18 创建的主题 站长 [转]jabber.ru 遭中间人攻击(似乎是机房劫持 IP 签发 TLS 证书)
证书是如何签发的?是不是基于 http 的证书鉴权都不够安全了?
2023-10-23 11:42:36 +08:00
回复了 noway723 创建的主题 微信 wechat 已删除记录恢复?
大记忆恢复术可以的。
2023-10-23 11:42:11 +08:00
回复了 handspring 创建的主题 NAS 为啥黑群晖的型号都选择 DS918?
@miniers sn 是算出来还是泄露的?
1  2  3  4  5  6  7  8  9  10 ... 27  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5024 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 110ms · UTC 05:52 · PVG 13:52 · LAX 21:52 · JFK 00:52
♥ Do have faith in what you're doing.