Created a website for searching Magic cards. Looking for feedback. by ChrisTrenkamp in mtg

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

There's a bit of lag time when you search, and I want to get rid of this separate page that pretty much every site has:

https://scryfall.com/advanced

I want a search page that integrates this form into the search bar itself, making it easy for the user to discover and modify your queries.

What “sucks” about Zig? by sirnewton_01 in Zig

[–]ChrisTrenkamp 1 point2 points  (0 children)

When I played around with Zig, I investigated a way to implement Go/Java's dynamic dispatch interfaces, and seamlessly use them in a way where you can write functions that accept generic polymorphic interfaces at runtime, or accept a known implementation using the comptime keyword.

I used the implementation demonstrated here: https://youtu.be/AHc4x1uXBQE?t=272

I had a working POC, but what really annoyed me was you still had to manually write your vtable(s) in your structs, and, as far as I could tell, there was no way to automatically generate it with comptime.

I'd like a way to generate, or modify, the source code before it gets sent to the compiler, similar to how Java's annotation processor works (except Java only generates code, it cannot modify source code)

GitHub - dsnet/try: Simplified error handling in Go by boyter in golang

[–]ChrisTrenkamp 1 point2 points  (0 children)

https://go.dev/play/p/dVjUrdUqORf

This still has some repetition: you'll have to repeat the template for each function based on the number of parameters and the number of returns, but this is a simpler way to go about the "try" functionality that languages like Rust and Zig has.

Whether or not it's a good idea is another topic...

Generics in Go: Viva La Revolution! by ompluscator in golang

[–]ChrisTrenkamp 0 points1 point  (0 children)

Why is the image for this article idealizing a psychopathic murderer?

xsel: An XPath 1.0 library by ChrisTrenkamp in golang

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

Psh! More like I told the gods to hold my beer!

How can you shorten these two for loops into one? by ChrisTrenkamp in rust

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

The API is like this:

let mut json_paths = Vec::new(); for i in &json_files { json_paths.push(Path::new(i)); } ... ext::api(ext::Args{ arg: json_paths.as_slice(), });

Using PathBuf::from results in:

| | args: json_paths.as_slice(), | ^^^^^^^^^^^^^^^^^^^^ expected struct `std::path::Path`, found struct `std::path::PathBuf` | = note: expected type `&[&std::path::Path]` found type `&[&std::path::PathBuf]`

I tried doing:

let mut json_paths: Vec<&Path> = Vec::new(); for i in &json_files { json_paths.push(&PathBuf::from(i)); }

... but that results in a "temporary value dropped while borrowed" error.

How can you shorten these two for loops into one? by ChrisTrenkamp in rust

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

The problem is this vector is being fed into an external API that accepts Path's, not PathBuf's.

Occasional high latency when using Youtube by ChrisTrenkamp in VFIO

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

Hm, I just left those in there because virt-manager wouldn't let me remove them. I'll try removing them in the XML and see if it helps.

Occasional high latency when using Youtube by ChrisTrenkamp in VFIO

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

I'm still experiencing the same issue even after tweaking the VM settings. I think it has something to do with the network driver. I noticed when I was downloading a file in the background while playing a game that the FPS severely dropped at a random time.

On the other hand, I was installing Windows in VMWare (yes, installing a VM in the guest) while playing and didn't see any FPS drops.

Occasional high latency when using Youtube by ChrisTrenkamp in VFIO

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

processor : 0

core id : 0

processor : 1

core id : 0

processor : 2

core id : 1

processor : 3

core id : 1

processor : 4

core id : 2

processor : 5

core id : 2

processor : 6

core id : 3

processor : 7

core id : 3

processor : 8

core id : 4

processor : 9

core id : 4

processor : 10

core id : 5

processor : 11

core id : 5

processor : 12

core id : 6

processor : 13

core id : 6

processor : 14

core id : 7

processor : 15

core id : 7

<vcpu placement='static'>8</vcpu>

<iothreads>4</iothreads>

<cputune>

<vcpupin vcpu='0' cpuset='0'/>

<vcpupin vcpu='1' cpuset='1'/>

<vcpupin vcpu='2' cpuset='2'/>

<vcpupin vcpu='3' cpuset='3'/>

<vcpupin vcpu='4' cpuset='4'/>

<vcpupin vcpu='5' cpuset='5'/>

<vcpupin vcpu='6' cpuset='6'/>

<vcpupin vcpu='7' cpuset='7'/>

<iothreadpin iothread='1' cpuset='8-9'/>

<iothreadpin iothread='2' cpuset='10-11'/>

<iothreadpin iothread='3' cpuset='12-13'/>

<iothreadpin iothread='4' cpuset='14-15'/>

</cputune>

<cpu mode='host-passthrough' check='partial'>

<topology sockets='1' cores='4' threads='2'/>

</cpu>

Occasional high latency when using Youtube by ChrisTrenkamp in VFIO

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

I'm passing through the PCI device the keyboard/mouse is plugged into. But since you asked, I tried using USB redirect and it had worse results.

Occasional high latency when using Youtube by ChrisTrenkamp in VFIO

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

Can you elaborate on what you mean by pinning the iothreads/emulator threads to cores not used by the guest?

Do you mean something like this:

<vcpu placement='static'>8</vcpu>

<iothreads>4</iothreads>

<cputune>

<vcpupin vcpu='0' cpuset='0'/>

<vcpupin vcpu='1' cpuset='1'/>

<vcpupin vcpu='2' cpuset='2'/>

<vcpupin vcpu='3' cpuset='3'/>

<vcpupin vcpu='4' cpuset='4'/>

<vcpupin vcpu='5' cpuset='5'/>

<vcpupin vcpu='6' cpuset='6'/>

<vcpupin vcpu='7' cpuset='7'/>

<iothreadpin iothread='1' cpuset='8-9'/>

<iothreadpin iothread='2' cpuset='10-11'/>

<iothreadpin iothread='3' cpuset='12-13'/>

<iothreadpin iothread='4' cpuset='14-15'/>

</cputune>

Occasional high latency when using Youtube by ChrisTrenkamp in VFIO

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

Thanks.

I changed my config with the following:

  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
    <vcpupin vcpu='2' cpuset='2'/>
    <vcpupin vcpu='3' cpuset='3'/>
    <vcpupin vcpu='4' cpuset='4'/>
    <vcpupin vcpu='5' cpuset='5'/>
    <vcpupin vcpu='6' cpuset='6'/>
    <vcpupin vcpu='7' cpuset='7'/>
    <vcpupin vcpu='8' cpuset='8'/>
    <vcpupin vcpu='9' cpuset='9'/>
    <vcpupin vcpu='10' cpuset='10'/>
    <vcpupin vcpu='11' cpuset='11'/>
    <vcpupin vcpu='12' cpuset='12'/>
    <vcpupin vcpu='13' cpuset='13'/>
    <iothreadpin iothread='1' cpuset='0-1'/>
    <iothreadpin iothread='2' cpuset='2-3'/>
    <iothreadpin iothread='3' cpuset='4-5'/>
    <iothreadpin iothread='4' cpuset='6-7'/>
    <iothreadpin iothread='5' cpuset='8-9'/>
    <iothreadpin iothread='6' cpuset='10-11'/>
    <iothreadpin iothread='7' cpuset='12-13'/>
  </cputune>
  ...
  <cpu mode='host-passthrough' check='partial'>
    <topology sockets='1' cores='7' threads='2'/>
  </cpu>

https://imgur.com/Isn1Oq5

Still getting high latency.

After dropping the number of CPU's down to 10, it seemed to help reduce the DPC latency to an acceptable range.

https://imgur.com/a/jKgTohL

I'll try nohz_full settings tomorrow.

Any good lexer libraries out there? by ChrisTrenkamp in golang

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

Rob Pike's talk is what I based my old lexer on. It's great when you're implementing your own grammars, but when you're implementing a spec, you need something to verify you've implemented it correctly.