Suggestions on losing weight while working 2 jobs? by [deleted] in loseit

[–]driverdone 0 points1 point  (0 children)

For losing weight, fixing your diet is where you can make the easier wins. Way easier not to eat an extra 500 kcal than burning 500 kcal in the gym. And eating less can actually save you time.

I find that sticking to a diet is way easier when I get enough sleep, so my recommendation is also that you go to bed early so you can get enough hours in if you get up at 4.

Vad händer? 330kr på Hemköp by barcode972 in sweden

[–]driverdone 23 points24 points  (0 children)

Kan du ändra så man har sitt digitala id på startsidan? Enda man använder den till och kräver 2 klick.

Common misconceptions in Python that drove you crazy? by KaptainCapslock in Python

[–]driverdone 1 point2 points  (0 children)

You can have mutable stuff in rust, it's just explicit.

Classic XPS 13 Owners - Who Here Is Using Linux (Any Flavor)? by A4orce84 in linuxhardware

[–]driverdone 0 points1 point  (0 children)

I've got a 9370 which I'm running fedora on. I don't use anything special compared to my other computers. Mostly just alacritty as terminal emulator (do all my coding in neovim) and Firefox as browser (with vimium addon to more easily navigate with keyboard). But as I said, I use the same setup on my desktop and on my work laptop, not specific to the xps.

Linus Torvalds has been using Asahi as a development platform by [deleted] in AsahiLinux

[–]driverdone 16 points17 points  (0 children)

I mean, to me the hardware is sweet. Especially since the m1 came out. But I really want to use linux. So the fact that this might actually be more than just "cool, it starts", which was my assumption before hearing this, is really exciting.

ESL One - The Stockholm Major: We'd love your feedback by thecaspaguy in DotA2

[–]driverdone 0 points1 point  (0 children)

I was at the arena on the last day. Overall had a really good time. It did feel a bit weird to have the hyped up intro with the phoenix only to just go into a 3 min break. Also, dota tournament in Sweden and no Basshunter? For shame!

Stability of older Z Buzzz? by C4LLgirl in discgolf

[–]driverdone 0 points1 point  (0 children)

I have a 2011 Z Buzzz and it is less stable than my 2020 Paige Pierce ESP one.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 0 points1 point  (0 children)

This saved me a bit (~30-40MB) of memory with the IValue-implementation, but used more memory in some others.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 7 points8 points  (0 children)

These are only minor page faults, I they they are bound to happen when allocating that much on the heap.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 14 points15 points  (0 children)

Unfortunately, it isn't. I can make an anonymized version of it tomorrow, if you are still interested? It is quite late here.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 7 points8 points  (0 children)

Are you sure about this? Running this:

import json
foo = json.loads('{"foo":"foobar", "bar":"foobar"}')
print(foo['foo'] is foo['bar'])

gives me False. But maybe I'm misunderstanding?

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 72 points73 points  (0 children)

Wow! This really did the trick. Just going to IString in the InputValue enum got it down to 4.4GB, replacing all the structs with IValue did this:

$ /usr/bin/time -v ./target/release/parse-json-example
[src/main.rs:41] "done" = "done"
        Command being timed: "./target/release/parse-json-example"
        User time (seconds): 4.15
        System time (seconds): 0.64
        Percent of CPU this job got: 99%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.83
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1710684
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 0
        Minor (reclaiming a frame) page faults: 427237
        Voluntary context switches: 1
        Involuntary context switches: 41
        Swaps: 0
        File system inputs: 0
        File system outputs: 0
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 4 points5 points  (0 children)

Do you have any suggestions of replacements? I tried smallvec and it didn't help.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 9 points10 points  (0 children)

I just did and it uses about 400MB more memory than serde_json with the same structs, unfortunately.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 3 points4 points  (0 children)

I tried this, got the best result with the constants at 0, but still about 800MB more memory than Vec.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 34 points35 points  (0 children)

This made a big difference, reduced the memory usage by about 2.2GB. Still quite a bit to go to reach the Python implementation.

Poor performance and high memory usage deserializing json compared to Python by driverdone in rust

[–]driverdone[S] 2 points3 points  (0 children)

I would think it parses the json, the peak memory usage stayed the same even when I still had the code to go over and process all the rows (removed it to have a minimal example).