more optimizations

This commit is contained in:
biglyderv 2025-01-27 18:09:40 -05:00
parent 0306a17ea3
commit 8ce2a4242f

View file

@ -14,7 +14,8 @@
$pr = array();
$fcount = array();
$frs = array();
foreach ($result as $usern) {
$fn = $usern['username'];
@ -24,15 +25,18 @@
$stmt->execute([$fn,$fn]);
$fcount[$fn] = count($stmt->fetchAll(PDO::FETCH_DEFAULT));
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
$stmt->execute([$fn]);
$frs[$fn] = $stmt->fetchAll(PDO::FETCH_DEFAULT);
}
for ($i = 0; $i < 50; $i++) {
for ($i = 0; $i < 20; $i++) {
foreach ($result as $usern) {
$theuser = $usern['username'];
$stmt = $db->prepare("SELECT * FROM main.follow WHERE username = ?");
$stmt->execute([$theuser]);
$followers = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$followers = $frs[$theuser];
foreach ($followers as $follown) {
$fn = $follown['target'];
@ -45,7 +49,7 @@
}
}
$dist = 1 - ($i / 50);
$dist = 1 - ($i / 20);
$dist = pow($dist,0.3);
$new_sum = array_sum($pr);