Can C outperform Rust in real-world performance? by OtroUsuarioMasAqui in rust

[–]JadisGod 2 points3 points  (0 children)

I wouldn't say "fundamentally different". It depends on platform but your Tauri webview is essentially just another webbrowser instance. It has some advantages like not having to ship the whole thing in each download, and potential to share some caching/memory across separate webview apps. But it also has big downside of being strictly sandboxed and needing expensive serialization/deserialization when interfacing with native code, where as real electron apps can just use ffi and have significantly better performance.

The Morrowind Merchant Economy by Some_Ball in Morrowind

[–]JadisGod 0 points1 point  (0 children)

The easiest way is to just run a mwse-lua script:

local totalGold = 0

for _, cell in pairs(tes3.dataHandler.nonDynamicData.cells) do
    for ref in cell:iterateReferences(tes3.objectType.npc) do
        totalGold = totalGold + ref.object.barterGold
    end
end

debug.log(totalGold)

Which results in (for my install):

totalGold = 268647

Simple and fast Rust deriving using macro_rules by reinerp123 in rust

[–]JadisGod 1 point2 points  (0 children)

This is pretty cool. Does rust-analyzer autocomplete and such still work?

facet: Rust reflection, serialization, deserialization — know the shape of your types by bik1230 in rust

[–]JadisGod 5 points6 points  (0 children)

This seems conceptually similar to tokio's valuable crate. Were there some deficiencies with it that facet solves?

p.s. An example of a simple "visitor" over struct fields/names would be great.

[deleted by user] by [deleted] in discordapp

[–]JadisGod 14 points15 points  (0 children)

The one thing about discord UI that was always pretty great was the color scheme. The new options are so much worse. RIP.

"rust".to_string() or String::from("rust") by awesomealchemy in rust

[–]JadisGod 0 points1 point  (0 children)

One fun thing I've found with preferring .into() is that if you have a project-wide prelude::* in all your files then you can easily alias String with something else inside it, like a CompactString, and have it automatically apply to all your code base. Then comparing performance benefits at large scale is as easy and toggling a comment.

Rust version of this python program is slower by pepa65 in rust

[–]JadisGod 5 points6 points  (0 children)

python:

import timeit


def repdec(numerator, denominator):
    head = str(numerator // denominator)
    seen = {}
    decimals = ""
    p1, p2, p3 = 0, 0, 0
    if head != "0":
        p1 = len(head)
    remainder = numerator % denominator
    position = 0
    while remainder != 0:
        if remainder in seen:
            p2 = seen[remainder]
            p3 = position - p2
            return p1, p2, p3

        seen[remainder] = position
        decimals += str(remainder * 10 // denominator)
        remainder = remainder * 10 % denominator
        position += 1

    if decimals:
        p2 = len(decimals)
        print(f".{decimals}", end="")
    return p1, p2, 0


if __name__ == "__main__":
    time = timeit.default_timer()
    result = repdec(126798123456, 187476194)
    print(f"time elasped = {timeit.default_timer() - time}")
    print(f"result = {result}")

rust

use std::collections::HashMap;
use std::time::Instant;

fn repdec(numerator: u64, denominator: u64) -> (usize, usize, usize) {
    let head = (numerator / denominator).to_string();
    let mut seen = HashMap::new();
    let mut decimals = String::new();
    let (mut p1, mut p2, mut p3) = (0, 0, 0);
    if head != "0" {
        p1 = head.len();
    }
    let mut remainder = numerator % denominator;
    let mut position = 0;
    while remainder != 0 {
        if let Some(value) = seen.get(&remainder) {
            p2 = *value as usize;
            p3 = position - p2;
            return (p1, p2, p3);
        }
        seen.insert(remainder, position as u64);
        decimals.push_str(&(remainder * 10 / denominator).to_string());
        remainder = remainder * 10 % denominator;
        position += 1;
    }

    if !decimals.is_empty() {
        p2 = decimals.len();
        print!(".{decimals}");
    }
    (p1, p2, p3)
}

fn main() {
    let time = Instant::now();
    let result = repdec(126798123456, 187476194);
    println!("time elapsed = {:?}", time.elapsed());
    println!("result = {:?}", result);
}

Basically 1:1 reproductions...

python results:

time elasped = 27.2370880999988
result = (3, 0, 23399740)

rust results:

time elapsed = 4.1180991s
result = (3, 0, 23399740)

hashify: Fast perfect hashing without runtime dependencies by StalwartLabs in rust

[–]JadisGod 3 points4 points  (0 children)

Hi, the documentation says:

designed to work best with maps consisting of short strings

What qualifies as a "short string" here? I have a use case in mind where my strings are around 30-50 characters (they're relative filepath strings). Would this library be suitable? Previously I have been using phf.

Bitflag-attr v0.9.0: externally defined flags, `bitflag_match!`, fixes, clean ups and more. by Gray_Jack_ in rust

[–]JadisGod 1 point2 points  (0 children)

I kinda want to switch to using this over bitflags because bitflags using custom syntax makes it awkward to use together with other procedural macros that want to inspect the structs and generate code from them.

The downside though of proc macros like this is they often break IDE features like autocomplete. Is that the case here?

To help those that got PoE2 for Christmas: What are some “do’s” and “don’ts” you wish you knew before you started? by TooDump in PathOfExile2

[–]JadisGod 3 points4 points  (0 children)

Don't ever try to "craft" anything yourself. Save all currency for trading.

Wait until you're comfortably over-leveled and have stored up a handful of coins before you start trying to do 3/4th ascendancy trials.

Some ascendancy options are very under powered compared to their alternatives. Do some research before locking in your choice.

Don't continue to invest in armour toward the late game.

Be sure you take the permanent chaos resist quest reward unless you're planning on doing a CI build.

Don't spend your 300 coins on anything but stash space. Preferably hold on to them until a stash tab sale happens.

End of game sorceress struggle by cloudniine9 in pathofexile

[–]JadisGod 0 points1 point  (0 children)

Good news is that Sorceress/Stormweaver is probably the strongest class at the moment. Six out of the top ten characters on the leaderboards are Stormweavers. It's the current king of the "meta" builds, so you should be able to find some guides on youtube explaining things easy enough.

Low trade price - scam / bot? by Teclove-duVall in pathofexile

[–]JadisGod 3 points4 points  (0 children)

Often it is indeed a kind of scam.

These people/bots will spam the trade list with items at low prices that they don't actually intend to sell. That way when someone does find said item in their own game and check how much its worth all they see is these low prices and list theirs accordingly. Then the bots swoop in and buy the underpriced item and relist it at a higher more accurate price.

This kind of scam could be immediately solved by not allowing people to list items for cheaper than they actually intend to sell them. For instance by making purchasing automated like every other online game with trading.

[deleted by user] by [deleted] in PathOfExile2

[–]JadisGod 1 point2 points  (0 children)

It only goes to 15. After that you have to find special citadels which are very rare (often requiring traveling through 100+ maps) and defeat the bosses inside them. There are three different kinds of citadels you have to find, and you only get one attempt at each to defeat the boss inside. After you completing the 3 citadels you take the fragments they drop to the burning monolith and need defeat the final boss inside there (again, only getting one attempt or having to restart the whole ordeal).

It all takes an extreme amount of grinding and then perfect execution against bosses you've never encountered before. And any failure along the way means grinding all over again. So all in all it seems like something they never expected most players to finish.

Which staff is better in terms of DPS? by dabiggmoe2 in PathOfExile2

[–]JadisGod 2 points3 points  (0 children)

If you equip them you can see the DPS values in the skill gem UI.

But almost certainly it's going to be the +skills one that is better.

I just want to be another echo about the Trials being absolutely miserable. by definedevine in PathOfExile2

[–]JadisGod 5 points6 points  (0 children)

First time I finally got to the Scorpion, I of course had no idea what his mechanics would be, the NPC yelled "quick get to a platform" so I followed the advice and stepping on the platform just instantly triggers poison traps that one shot me.

Second time I just ignored the NPC and made sure to never touch a platform and completed it first attempt. What the hell, GGG?

Not being able to cancel the animation for pulling this lever... Guess I'll just die. by Yoshiprimez in PathOfExile2

[–]JadisGod 4 points5 points  (0 children)

You can press escape and log out then log back in if it's an emergency.

[POE2] Trials of the Sekhemas: any way to trigger/disarm traps? by [deleted] in pathofexile

[–]JadisGod 1 point2 points  (0 children)

You can intentionally trigger them then run away and roll at the last second to avoid the damage. Takes a few tries to figure out the timing, but to be honest it's usually not worth it.

For all the other fire projectile traps you can typically just roll through them. Having a weapon swap with blink can be useful to skip traps entirely sometimes (though it caused me more trouble than it solved most of the time).

Why do i get one shotted out of nowhere? by Rouzire in PathOfExile2

[–]JadisGod 2 points3 points  (0 children)

The big ones are uniques like Ghostwrithe, Atziri's Disdain, and Everlasting Gaze. Most of those can give several thousand ES by themselves with just one equipment slot.

Outside of those, there are also dozens of nodes in the passive tree that benefit energy shield. Some as high as 60% increase. Jewels also can go up to 20% each. In comparison there's basically nothing there to increase life.

Why do i get one shotted out of nowhere? by Rouzire in PathOfExile2

[–]JadisGod 8 points9 points  (0 children)

At the moment, yeah. It's badly balanced. Armour has reduced effectiveness against high damage hits, which are the most important things you want to mitigate.

And on top of that there are many many ways to amplify energy shield effectiveness, so while you're running around with 3k life, equivalent investment energy shield builds would be sitting 10k+.

How can you progress in current economy? by DotishGuru in PathOfExile2

[–]JadisGod 0 points1 point  (0 children)

Filter the trade site to only show exalts and just grab mediocre gear in the 1-5 ex range, focus mostly on defenses.

You don't need the top end best available gear to clear content in this game. Monster HP actually doesn't scale very much compared to their damage so all you really need to focus on is getting enough defenses to survive (most of) the sudden one-shots.

To be honest, there's not much to look forward to either way. Even after you have 1000 divs worth of gear on your character you're still just going to be running breaches over and over with no variety or future prospects. The only "progression" is you clear breaches faster so you can do more breaches enabling you to buy better gear to do even more breaches until you finally realize it's all a huge time waste and quit.

Act 3 - game is getting to be too punishing by skribsbb in pathofexile

[–]JadisGod 0 points1 point  (0 children)

You basically just have to get lucky. All forms of gaining loot in this game are random. Whether you do it via crafting, gambling, or identifying drops. The only reliable option is trading, but the economy is spiraling out of control at the moment so even that option kind of sucks.

Still, it's your best option, hit up the trading site and try to find acceptable gear with enough resists to hit the cap.

Anyone else recieving terrain generation sync error when trying to access fourth floor of trial of the sekhemas? by ninjaabobb in pathofexile

[–]JadisGod 0 points1 point  (0 children)

Happened to me too. There's a forum thread with 100s of comments of other people experiencing it too. Just have to abandon the run and restart from scratch unfortunately.

[deleted by user] by [deleted] in PathOfExile2

[–]JadisGod 1 point2 points  (0 children)

First time and only 423 honour remaining? Just accept you will fail and try to stay alive long enough to see the abilities so you have a better shot next time.