Skip to content
Why might performan...
 
Notifications
Clear all

Why might performance of a Rust-sdl2 project be better while profiling?

1 Posts
1 Users
0 Likes
0 Views
Guest
Illustrious Member
Joined: 4 months ago
Posts: 57415
Topic starter  

$begingroup$

I'm making a simple SDL2-based Rust game, on an OSX laptop. Graphics mostly involves drawing lots of colored squares to the screen. Performance is really slow for what I'm doing, so I decided to profile with Flamegraph. The weird thing is, when I run with flamegraph, performance improves dramatically, going from ~20-50ms/frame to more like 5-10ms/frame. What could possibly be causing this (and how can I take advantage of it)?

Here's the command I use to run the program normally:
sudo CARGO_PROFILE_RELEASE_DEBUG=true cargo run

Here's the command I use to run the program with flamegraph:
sudo CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph

(Flamegraph requires some permissions to run, so I run them both with sudo for maximum comparability.)

$endgroup$


   
Quote

Unreplied Posts

A riddle involving the axiom of choice

$begingroup$

So i found a riddle on reddit which is a consequence of the axiom of choice.

There is a house with 100 rooms, and each room contains countably many boxes indexed with the natural numbers. Each box contains a random real number, which is the same over all the rooms (that is, box n contains the same real number in every room).

100 set theorists play a game. Each person will go into a unique room and open as many boxes as they like (perhaps countably many) as long as they leave at least one box in their room unopened. Then, each of them need to pick an unopened box in their room, and guess what real number is inside of it.

In order to win, 99 of them need to guess correctly.

The mathematicians can discuss a strategy beforehand, but after they go into their respective rooms, no more communication is allowed. What is a 100% winning strategy for this seemingly impossible task?

The solution is here: https://www.reddit.com/r/math/comments/rpbhos/predicting_random_real_numbers_with_the_axiom_of/?utm_source=share&utm_medium=ios_app&utm_name=iossmf

My question is why can the mathematicians agree on a specific representative for each equivalence class? I thought that the axiom of choice guaranteed a choice function existed, but didnt specify it. But for the solution to the riddle, they would need to know what the choice function is. Can someone explain?

$endgroup$

problem with Ubuntu Pro blocked my pc

I am user of Bodhi 18.04 LTS Bionic 32 bit wich based on Ubuntu.I update to nvidia-304 and now i can’t enter on my Bodhi os. because it’s show me Ubuntu Pro at the beginning.After insert my password and Token, he show me the error:

WARNING:root:failed to process /proc/version_signature.

Anyone have solution to help me ?

Exponentials of stochastic band matrices

$begingroup$

This may be a duplicate, but I’ve done some searching and I can’t find exactly this problem setting, probably due to not knowing the right terminology for how to refer to the transition matrix.

I’m considering absorbing random walks ${X_t}$ which have symmetric transition probabilities inside a window of size $k$. For example, on ${0, 1, 2, dots, 100}$, with $k=3$ if $X_t = 5$
begin{align*}
P[X_{t+1} = 4] &= P[X_{t+1} = 6]\
P[X_{t+1} = 3] &= P[X_{t+1} = 7]\
P[X_{t+1} = 2] &= P[X_{t+1} = 8]\
end{align*}

When the walk is within $k$ of the endpoint, the allowable transitions are truncated on both sides, e.g. if $X_t = 1$, $P[X_t = 3] = 0$.

I wanted to figure out the probability of the walk being absorbed at the upper endpoint, so I did some numerical experiments with walks on the integers from 0-100.
I calculated $T^n$ for the transition matrix $T$ and a large $n$. I then looked at $(T^n)_{i, 100}$ to see the probability of being absorbed at 100. It appears that the value is always equal to $i/100$, regardless of how I set the transition distribution or window-size.

The transition matrix for a walk on the integers in $[0, N]$ has the following properties:

  1. $T$ is (row) stochastic
  2. $T$ is a band matrix with upper and lower band size $k$
  3. $T_{i, j} = 0$ if $|i – j| > max (i, N – i)$
  4. $T_{i,i + r} = T_{i, i – r}$ (this is the main property I don’t know the name of)
  5. $T_{0, 0} = T_{1, 1} = 1$

I would like a proof or counterexample of the following statement:
begin{equation*}
limlimits_{n to infty} (T^n)_{i, N} = i/N
end{equation*}

If the statement above is true, is it still true if the transition distributions are no longer left-right symmetric, but it’s still the case that $E[X_{t + 1}] = X_t$?

$endgroup$

If $varphi$ is a normal faithful semifinite weight, is $eta_varphi(mathfrak{n}_varphicapmathfrak{n}_varphi^*)$ dense in $mathfrak{H}_varphi$

$begingroup$

Let $M$ be a von Neumann algebra and $varphi: M_+to [0, infty]$ be a normal, faithful semifinite weight. Consider its associated semi-cyclic representation
$$pi_varphi: Mto B(mathfrak{H}_varphi)$$
(see Takesaki’s second book, chapter VII for details).

Consider the associated map
$$eta_varphi: mathfrak{n}_varphito mathfrak{H}_varphi.$$

Is it true that $eta_varphi(mathfrak{n}_varphicap mathfrak{n}_varphi^*)$ is norm-dense in $mathfrak{H}_varphi$?

Attempt: If $xi perp eta_varphi(mathfrak{n}_varphicap mathfrak{n}_varphi^*)$, then for $x,yin mathfrak{n}_varphi$
$$0 = langle xi, eta_varphi(x^*y) rangle = langle pi_varphi(x)xi, eta_varphi(y)rangle$$
so that $pi_varphi(mathfrak{n}_varphi)xi=0$. Maybe this is sufficient to conclude that $xi= 0$? I feel like non-degeneracy of $pi_varphi$ is relevant.

$endgroup$

Can’t install any Nvidia driver

When i run:

sudo ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00002520sv00001025sd00001547bc03sc00i00
vendor   : NVIDIA Corporation  
model    : GA106M [GeForce RTX 3060 Mobile / Max-Q]  
driver   : nvidia-driver-525-open - third-party non-free recommended  
driver   : nvidia-driver-515-server - distro non-free  
driver   : nvidia-driver-510 - distro non-free  
driver   : nvidia-driver-470-server - distro non-free  
driver   : nvidia-driver-515 - distro non-free
driver   : nvidia-driver-470 - distro non-free
driver   : nvidia-driver-515-open - distro non-free
driver   : nvidia-driver-525 - third-party non-free
driver   : nvidia-driver-525-server - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

When i install the recommended driver (nvidia-driver-525-open), i get a black screen.

When i install nvidia-driver-515 (or any below version) i get stuck at login screen (keyboard, mouse, nothing is working… even ctrl+alt+f1 to open another tty).

This is the bug report log for the nvidia-driver-525:
https://forums.developer.nvidia.com/uploads/short-url/hu0foxXT3RfYSgvYz9Ei2dMtDdZ.log

Laptop: Acer Predator Helios 300 PH315-54-760S Gaming Laptop
GPU: NVIDIA GeForce RTX 3060
Kernel: 5.15.0-57-generic
OS: Ubuntu 22.04.2 LTS

Please help me!

Centering a string in another

I have a string of length N which I want to center in another string.

Thus setting some string of length N

old_string="***"

I want a new string (length 55) with the old string centered in it.

new_string="     ***     "

How can I do this in bash ?

Although in actual fact the trailing spaces are redundant, so I can-simply have

new_string="     ***"

Share: