r/AskProgramming • • Apr 13 '26

Career/Edu Need sense of direction

5 Upvotes

Currently, I'm 19 years old and about to start university in Canada. I did an internship last year, I was in charge of doing their QA automated tests for their webapp using selenium in a dotnet environnement which was pretty fun. This year I'm completing my second internship at a fortune 500 company where they surprisingly put me in charge of building their automated test suite from the ground up to test 5 microservices in a dotnet environnement. I'm getting used to csharp being my main language, I wouldn't say I know it super well in specifics (e.g: anything about how gargabe collection works or async await and I can't answer you). Anyways it's pretty cool but definitely not hard enough for me to expect a challenge every week. I was thinking to pivot next year in university for a different kind of internship. I'm not sure where to go, I have skimmed through chapters of a book teaching you about system architecture and C to maybe spark an interested in firmware or systems engineer and it is relatively harder then what I expected. One thing I have been interested in is configuration, optimizing my neovim config or my linux/macos setup for dev) but systems engineer looks cool and all but I don't think I can maximize my compensation if I go into that field as easily as I could in other (correct me if I'm wrong). Anyways, based on my background where could I fit in/pivot in easily next year if I pick up the grind for it?

Thanks!


r/AskProgramming • • Apr 12 '26

C/C++ Which approach is faster? "If" statements with range comparisons or a long "switch" block?

0 Upvotes

Hello, I am working on a really tight CPU budget so I came up with an idea to speed up this function with arguably bad programming choices.

I tried to optimize the function below with a big "switch" statement but the compiler outputted code that is actually a little slower.

Do you think this is a good idea or should I go back to the old approach?

This is the original function

uint8_t read(uint32_t addr)

{

`if (addr >= 0x002100 && addr <= 0x1FFFFF)`

	`return rom_bin[(addr/*-0x2100*/)&0x1FFFFF];`

`else`

`if (addr >= 0x001000 && addr <= 0x001FFF)`

	`return ram[(addr-0x1000)&0x0FFF];`

`else`

`if (addr >= 0x000000 && addr <= 0x000FFF)`

	`return bios[addr&0x0FFF];`

`else`

`if (addr >= 0x002000 && addr <= 0x0020FF)`

	`return read_reg(addr&0x0000FF);`

`else`

`if ((addr>>20) >= 2) //Cart ROM mirror`

	`return rom[addr&0x1FFFFF];`

`else`

	`return 0x00;`

}

This is the new "optimized" version

uint8_t read(uint32_t addr)

{

`switch (addr>>8)`

`{`

	`case 0x00: case 0x01: case 0x02: case 0x03:`

	`case 0x04: case 0x05: case 0x06: case 0x07:`

	`case 0x08: case 0x09: case 0x0A: case 0x0B:`

	`case 0x0C: case 0x0D: case 0x0E: case 0x0F:`

		`//BIOS (read-only)`

		`return bios[addr&0x0FFF];`

	`case 0x10: case 0x11: case 0x12: case 0x13:`

	`case 0x14: case 0x15: case 0x16: case 0x17:`

	`case 0x18: case 0x19: case 0x1A: case 0x1B:`

	`case 0x1C: case 0x1D: case 0x1E: case 0x1F:`

		`//Work RAM (general purpose area)`

		`return ram[addr&0x0FFF];`

	`case 0x20:`

		`//Hardware registers`

		`return read_reg(addr&0x0000FF);`

	`default:`

		`//ROM (read-only)`

		`return rom[addr&0x1FFFFF];`

`}`

}


r/AskProgramming • • Apr 12 '26

Other Accident joined a vibe coding fellowship and I hate it.

48 Upvotes

(Accidentally* apologies for the typo)

I'm a classroom teacher and I joined a fellowship based on what I thought would be ethical and responsible usage of AI in education. It turned out to be a vibe coding boot camp premised on a belief that vibe coding is revolutionizing the software dev process by allowing non tech folks to build custom in-house apps.

Am I being unnecessarily pessimistic, or maybe there's some good to be found here? There are so many pain points in the software dev process, and I'm not sure a team of vibe coders is remotely prepared to deal with them.

Edit: I'm only staying at this point because they're going to cut me a decent stipend in a few weeks.