Details
-
AboutElectronics engineer. Software developer.
-
SkillsC, C++, Java, Assembly, Python
-
LocationMX
-
Github
Joined devRant on 4/7/2017
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
If you want to set off and go develop some grand new thing, you don’t need millions of dollars of capitalization. You need enough pizza and Diet Coke to stick in your refrigerator, a cheap PC to work on and the dedication to go through with it. ~John Carmack3
-
Am I the only one that can't stand non-maximized windows on Windows but hate maximized windows on Mac?
Could this be a psychological phenomenon in which the designs of these systems make you use them in a specific way? Or am I just retarded?
Anyone else does the same?8 -
During my interview, I poured some water into a cup and it overflowed a little bit.
Interviewer: Nervous?
Me : No, I just always give my 110%9 -
So recently I did a lot of research into the internals of Computers and CPUs.
And i'd like to share a result of mine.
First of all, take some time to look at the code down below. You see two assembler codes and two command lines.
The Assembler code is designed to test how the instructions "enter" and "leave" compare to manually doing what they are shortened to.
Enter and leave create a new Stackframe: this means, that they create a new temporary stack. The stack is where local variables are put to by the compiler. On the right side, you can see how I create my own stack by using
push rbp
mov rbp, rsp
sub rsp, 0
(I won't get into details behind why that works).
Okay. Why is this even relevant?
Well: there is the assumption that enter and leave are very slow. This is due to raw numbers:
In some paper I saw ( I couldn't find the link, i'm sorry), enter was said to use up 12 CPU cycles, while the manual stacking would require 3 (push + mov + sub => 1 + 1 + 1).
When I compile an empty function, I get pretty much what you'd expect just from the raw numbers of CPU cycles.
HOWEVER, then I add the dummy code in the middle:
mov eax, 123
add eax, 123543
mov ebx, 234
div ebx
and magically - both sides have the same result.
Why????
For one thing, there is CPU prefetching. This is the CPU loading in ram before its done executing the current instruction (this is how anti-debugger code works, btw. Might make another rant on that). Then there is the fact that the CPU usually starts work on the next instruction while the current instruction is processing IFF the register currently involved isnt involved in the next instruction (that would cause a lot of synchronisation problems). Now notice, that the CPU can't do any of that when manually entering and leaving. It can only start doing the mov eax, 1234 while performing the sub rsp, 0.
----------------
NOW: notice that the code on the right didn't take any precautions like making sure that the stack is big enough. If you sub too much stack at once, the stack will be exhausted, thats what we call a stack overflow. enter implements checks for that, and emits an interrupt if there is a SO (take this with a grain of salt, I couldn't find a resource backing this up). There are another type of checks I don't fully get (stack level checks) so I'd rather not make a fool of myself by writing about them.
Because of all those reasons I think that compilers should start using enter and leave again.
========
This post showed very well that bare numbers can often mislead.21 -
DELETE userAccount
FROM devRant
WHERE postContent LIKE '%article 13%' AND numberOfPostsAboutArticle13 > 1;6 -
Multiple all-nighters (all day every day):
1) Working, studying and developing an Android game as pet project. Last few weeks before release (yup, I've set a deadline for a pet project) my day consisted of uni, work, more work and 4-5h sleep.
2) Having worked on my thesis (Development of a CPU/SoC + Firmware + Linux kernel) and actual paid work. In parallel. Because, you know, I need to eat and pay rent and shit while I'm writing the thesis. And debts at that moment were not an option (still made some). All-day all-night all-week. After submitting the thesis I went to the doc and enjoyed 2 weeks of doing nothing.
3) Sometimes on my main open-source project after regular work hours. If I have the motivation and ideas that I want to check out or prove it gets late/early too fast. -
Have you noticed that mac users rarely use full screen mode? Its so hard to use that they just leave half sized windows, its so annoying when I have to ask every time if they can make it bigger17
-
interviewer: What is your greatest weakness?
me: don't let your enemy find out your weakness. -Bruce Lee
interviewer: get out4 -
OMFG! YES! I just solved an issue that made build times close to 20 minutes. Not it's only a couple of seconds! YES!!!9
-
Programming challenges:
Easy: Hello World!
Medium: Matrix multiplication
Hard: Artificial intelligence
Impossible: Coming up with meaningful names for variables and scripts...2 -
So I'm the typical nerd in my class, who studies a lot, and really dives into the topics.
It's really fun to see when other people are struggling with something. That means I can try to help them, and I just get a lot of joy out of helping people 😊55