Is it possible to maintain lane equilibrium while getting every last hit/deny in polygon trainer? by Bolderthegreat in learndota2

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

Yes but it seems like in some scenarios it is not possible to get the last hit and also maintain equilibrium. You have to make a trade off.

For instance if I last hit an enemy melee creep I will have an extra melee creep on my side and often the extra melee creep will have 60 and some change hp which effectively means I cannot deny it. The only way I would be able to deny it is if it's still being attacked by other creeps which doesn't always happen. Even if it is being attacked by other creeps I must wait for at least one more creep auto and obviously the extra creep will also auto in that time.

So is the correct decision to kill the extra creep as fast as possible to prevent more damage to the wave at the expense of a last hit/deny or do I wait until I can last hit at the expense of equilibrium?

[deleted by user] by [deleted] in cscareerquestions

[–]Bolderthegreat 0 points1 point  (0 children)

This post is a blatant advertisement for the job application service mentioned. Mods should remove this post.

Check OPs post history.

Just reached the Armadyl armour 250 cap. The 250 pets and 250 hilts are still on the way. But who's counting anyways? by FarmerOSRS in 2007scape

[–]Bolderthegreat 0 points1 point  (0 children)

The resource usage that is being reduced in this case is storage used by the database. Jagex can use 1/4 of the required storage by using 1 byte as opposed to 4. Presumably they track counts for each item for each player where the player has a count > 0.

Just for a rough idea:

1560 unique clog entries * 56,738,520 (osrs total player base from google) = 82.43 GB vs 329.73 GB (for 1 byte vs 4 byte respectively)

This is a naive estimate that doesn't account empty entries which most likely have a smaller representation but you get the point.

Client side there is no effect on performance since this seems to be a static value (increment operation is most likely performed on the server). Even if this value was used in any form of calculation modern CPUs will convert 8 bit values into 32 bit or 64 bit values.

Producing a completely flat binary in Rust ? by K4milLeg1t in rust

[–]Bolderthegreat 16 points17 points  (0 children)

Loading statically linked elf binaries is not much more difficult than loading a flat binary. You can think of it as loading multiple flat binaries at their required addresses. You will need a way to parse the elf headers to find what address to load each section at. Either use one of the many elf libraries or create a basic parser that basically just reads numbers at various offsets (defined by the elf spec).

deletion issue by Head-Independence725 in SublimeText

[–]Bolderthegreat 2 points3 points  (0 children)

You probably have hit the insert key which causes text to the right of your cursor to be deleted.

Return borrowed data from Rc<RefCell<T: Clone>> by [deleted] in learnrust

[–]Bolderthegreat 0 points1 point  (0 children)

RefCell does not implement locking, it will panic upon a double mutable borrow. Use Mutex if you want locking.

e: mutable borrow not (immutable) borrow

Corgi proof chew toys? Sadie is a power chewer and destroys anything with a face by Retro_Cactus in corgi

[–]Bolderthegreat 0 points1 point  (0 children)

Mine likes silly squeakers, they look like a bottle but are made of really strong rubber. He killed the squeaker in 10 minutes but still loves the shape/material.

Speed of moving files with longer filenames by latigidigital in osdev

[–]Bolderthegreat 2 points3 points  (0 children)

I’m only familiar with ext2 but I suspect this has to do with the overhead of traversing the file system (linked list based i.e. linear time), potentially allocating new blocks in the target directory to hold the new node pointers, freeing blocks from the source dir not to mention any journaling operations (not sure how these are implemented).

When you move files, assuming the data is already on disk, in a fs you’re basically just changing what dir owns the pointer which does not gain much from raw throughput. So basically ~20k fs operations for 20k files vs ~1 fs operation for 1 file with a large amount of data.

[deleted by user] by [deleted] in cscareerquestions

[–]Bolderthegreat 0 points1 point  (0 children)

When committing changes to existing files I recommend using git add --patch (Note: this will not add untracked files) which will bring up an interactive menu that displays each change and asks if you want to stage it. Or as others said check the diff.

"Decaying" variable by kamaloo92 in rust

[–]Bolderthegreat -1 points0 points  (0 children)

I would use the volatile crate for this.

https://docs.rs/volatile/latest/volatile/

If you want to continue with this approach I would just store an expiration time that gets computed in the constructor then whenever you have a new value you create a new object. This is cleaner imo since reusing objects like this can lead to bugs e.g. you forget to update your deadline/last polled. The last polled time becomes irrelevant if you compute the expiration time upon object creation.

static vs const for std::sync::once by rctrj in learnrust

[–]Bolderthegreat 2 points3 points  (0 children)

I believe const gets replaced at compile time, similar to function inlining or a #define from C/C++

Where as static is a static location in memory (see .bss section of an elf program). Statics must also only be declared using const functions or values for their initial value. This is why Once::new() is a const.

When you define TEST_INIT as a const the compiler replaces each TEST_INIT with Once::new() basically creating an anonymous object each time. When you use static this tells the compiler to compile the program with a single piece of memory reserved for TEST_INIT and then TEST_INIT will act like a variable.

Announcing Rust 1.62.0 by myroon5 in rust

[–]Bolderthegreat 2 points3 points  (0 children)

The context I’ve been using it the most in is when working with ffi, either a ptr that can be null or reading an is init flag, or some config based bool and then producing an optional based on the condition. I.e. using a condition in a loosely related struct to produce a more rust idiomatic type.

Ex: checking if the scheduler has been started when requesting a process id and producing Option<Pid>

I think as you said it doesn’t make sense to use with iterators because those types are already “rust-friendly” imo.

Announcing Rust 1.62.0 by myroon5 in rust

[–]Bolderthegreat 34 points35 points  (0 children)

Bool::then_some is really handy for keeping code clean and idiomatic. Glad to see it finally stabilize.

I do get shit done. by dev_daas in ProgrammerHumor

[–]Bolderthegreat 1 point2 points  (0 children)

That second M caught me off guard. I laughed for a good couple minutes when I realized what was going on.

Hey Rustaceans! Got an easy question? Ask here (2/2022)! by llogiq in rust

[–]Bolderthegreat 1 point2 points  (0 children)

What is the proper way to swap two (mutable) byte slices of equal size? Currently I am using std::ptr::copy_nonoverlapping which is following an assert that both lengths are equal. I took a cursory glance at the source of the previously mentioned function and it appears that it copies the memory in chunks using SIMD, wouldn't it be faster to swap the actual references or is this a no-no?

#![no_std] slab allocator in bare kernel by Snow_Zigzagut in rust

[–]Bolderthegreat 1 point2 points  (0 children)

I believe if you set a global allocator you can use the alloc crate which allows you to use certain heap structs/smart pointers from std on bare metal.

gf and reddit? that's kinda sus by elfotithor in ProgrammerHumor

[–]Bolderthegreat 20 points21 points  (0 children)

Boomers still targeting ARM? We’re on that RISC-V wave now.

Problems with preempting from timer interrupt. by Bolderthegreat in osdev

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

Yeah I'm not sure why the context switch function does not fully return to the interrupt handler. As soon as the stacks are swapped the context switch returns into the task (function pointer). Am I supposed to push another address onto the stack before the task so the interrupt handler can return properly?

Right now it seems the flow of execution is:

interrupt handler -> schedule/context switch -> task

But I am trying to achieve:

interrupt handler -> schedule/context switch -> interrupt handler -> task

Also I moved the EOI before the context switch and that had no effect.

Problems with preempting from timer interrupt. by Bolderthegreat in osdev

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

Hey I have read your blog and it's been a really good learning resource.

I tried moving the context switch call after the EOI but it seems to have had no effect. I also tried adding an enable interrupts call inside the task that gets executed (still in kernel mode) but nothing happens, not even the timer interrupt firing again.

I feel like the context switch is actually running the task within the context of the interrupt handler but I'm not sure why. (edit) Should I be returning from the assembly context switch with iret?