AboutC++ developer, 16 year old, super intelligent being (read as: i'm stupid but I want people to think that i'm a marvel) Telegram @BinaryByter
SkillsC++, doing random shit, not being productive, building a kernel
Locationger, ma, nie
Joined devRant on 11/10/2016
Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Here is another rather big example of how C++ is WAY slower than assembler (picture)
Sure - std::copy is convenient
but asm is just way faster.
This code should be compatible with EVERY x86_64 CPU.
I even do duffs device without having the loop:
the loop happens in the rep opcode which allows for prefetching (meaning that it doesnt destroy the prefetch queue and can even allow for preprocessing).
BTW: for those who commented on my comment porn last time: I made sure to satisfy your cravings ;-)
To those who can't make sense of my command line:
To those who tell me to call clang with -o<something>:
1) clang removes the call to copy on o3 or o2
2) the result isnt better in o1 (well... one second but that might be due to so many other things, and even if... one second isn't that much)26
Little addition on my rant about the enter and leave instructions being better than push mov sub for stackframes:
I had that debate with a friend of mine, who tried the same code ... and failed to get enter to be as fast. Infact, for him, enter was twice as slow, on his older computer even 3times as slow.
Mhh... pretty bad. basically blows up my whole point.
I tried the code on my computer... Can't reproduce the error.
"Which CPU are you on?"
>"I'm on Intel"
Both of his computers are on intel. I use an amd ryzeni1600. Now this might be a bit of a fast conclusion, but I think that its safe to say that intel should atleast do better for SOME parts of their CPUs.9
Time to stop with the cringe!
Linus was, long live bsd ( and clinl when its out)
Thats right! Linuer4Fun is now called BinaryByter
Binary because I code and i do a lot of low level, Byter because I like eating. And since i eat a lot at once, I eat full bytes at once... BinaryQword doesnt sound too nice unfortunately :(5
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
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
and magically - both sides have the same result.
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.31
Incase you wonder where I am gone to: Well. Looks like I'm a part time irganist now xD
Yes, this is me,
Yes, this is very fun,
Yes, I deliberately go to church X)
(I still code a lot)14
Okay i'm done - YOU FUCKING ANDROID STUDIO MORONS. Being at a high level in C++, I tried to do some android coding. THERE ARE FUCKING NO GOOD TUTORIALS, NO GOOD DOCS, HECK, THE SELF GENERATED CODE OF THE IDE IS WRONG: WHAT THE FUCK IS GOING ON YOU FUCKING MORONS?
oh wait, let me first import android.widgets.rant;
or was it android.widgets.devrant.rant; or was it android.dr.rant.RantManager;?
Oh wait, I know lets search the docs?
OH WAIT THE DOCUMENTATION DOESNT HAVE THAT.
NOW HOW ABOUT I JUST TRY THE EXAMPLE CODE? WELL UH-UH! YOU HAVE TO FIND OUT YOURSELF WHAT TO IMPORT IN ORDER FOR IT TO WORK. ALSO, WHAT FUCKING UP WITH THAT PERMISSION SYSTEM? ITS SO BADLY DOCUMENTED!!!
Oh wait, I'm sure that I have to change something in this file... or was it that other file?
how dare they have style and design guidelines?
I will resort to implement my app idea in godot, idc anymore... I don't want to burn out because I used the "official high standard" tech.
it definitely isn't high standard and definitely not good. Thank you morons@google
THANK YOU FOR NOTHING
A FRAMEWORK WHERE I NEED 2 DAYS TO FIGURE OUT TO ADD EVENT LISTENERS TO MY THINGS IS DEFINITELY NOT ONE I'D LIKE TO USE.
also, whats up with
AudioRecord (int audioSource, int samplerateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes);
ARE WE BACK IN THE C ERA? CAN'T YOU BE BOTHERED TO IMPLEMENT SOME SIMPLE FUCKING ENUMS????
WHATS THE POINT OF AN OOP LANGUAGE IF YOU ARE GOING TO USE IT LIKE C?
Oh wait I found a tutorial ... First trigger: "java scripts". Second trigger: this guy LITTERALLY ONLY TEACHES YOU HOW TO PLACE WIDGETS ON THE CANVAS. THANKS FOR NOTHING SHERLOCK!
Oh btw: did you know that android studio gives the best error messages?
"Error: illegal start of expression"
NO ERROR MESSAGE - NOTHING!
YOU BETTER USE THE IDE OR YOU GO HOME YOU FUCKER!!!
Oh and btw: if you want to read the best documentation - the code itself YOU GOTTA AGREE TO OR TERMS OF SERVICE!!!! WE DONT WANT ANYBODY TO BECOME SUCCESSFUL WITHOUT US KNOWING!!!!!
THANK YOU GOOGLE FOR NOTHING!
thanks godot for *atleast* existing. You are the... last pick i'd pick, but :shrug:, I have experienced android studio now.
If anybody has any advice on what to use instead, please go ahead. And you better not tell me how good you are at android studio. I DONT CARE ABOUT WHAT YOU CAN IMPLEMENT IN ANDROID STUDIO. I JUST WANT SOMETHING THAT IS USABLE WITHOUT HAVING TO BE EXTRA CAREFUL WHEN DOING *ANYTHING*!!!!
Since we devs are masters of the weird - I thought: "why not make a collection of weird things?".
Incase you want to contribute - Contribute!
If you were to teach others a last thing before you die, what would you say?
Id tell my surroundings to use time efficiently. We only have like 800.000h, assuming that we become 100 yo. thats nothing.
Please dont make jokes, id really like this to be an informative thread18
Two reasons why I post this.
1) finally free from fucking youtube
1.1) just noticed that 1) was an alliteration
2) HÄNDEL <3<3<3<3<3<37
Honestly? Trackers on devrant? do you REALLY NEED that information from us? do you REALLY need to know how often your juicestore-webpage was called on a single fucking day? Did you HONESTLY not notice the many members of devRant who care about their privacy?25
I just wrote a small tool to organize command line arguments in C++. Thouhgt that i'd share
Update to my CGI library for C++:
i've finally written the docs, everything seems to run stable!
if anybody is crazy enough to try it out and leave some feedback, I take everything!
Well... Looks like I managed to make a Webpage in C++...
I need a life...
webpage (self hosted, so I don't guarantee that it will always be online. however, the pages source code is on github): http://18.104.22.168/cgi-bin/...
I wanted to do webdev backend in C++.
It was cumbersome so I decided to write a library that helps me and OH MY GOD. I have COMPLETELY changed C++ xDD
(yes, the screenshot is ACTUAL C++ xD)49
Whats worse than TestDrivenDevelopement?
Starting TDD once a 15K LoC project has well started...
sooo.... here I am testing the entirity of clinl ;_;12
- Dooge X5 max (worst phone ever, can't reccomend, randomly shuts off, displays advertizement, gets super hot)
- Bottle of coke light (so I don't get fat)
- Auna Mic 900-b (I used to do videos on youtube, though they were so bad i've deleted them lol)
- Two HP 24es screens (one of them broke when I let it fall while switching overheating cables)
- Mech keyboard with MX - Red
- Razer Naga 2014 (I regret buying that already)
- Wacom intuos small (I wanted to become a designer for a game with @Qcat)
- Computer with
CPU: ryzen i1600. 3.8ghz, 4ghz with boost, 12threads 6 cortes
RAM: 16 gig
Storage: 250gb SSD, 1tb hdd
Stickers: Generously donated by @gelomyrtol
Cooler: alpenföhn brocken
GPU: ATI 560 (something like that. I took the cheapest as I needed to fit a gpu into the budget, ryzen doesnt have integrated graphics units)
OS: fedora GNU/Linux with KDE as de (though i'm not sure wether i'll stay with it. I recently used cinnamon but it was too slow.
If i'm not on my desk, i'm either doing music studies, sleeping or i'm at school.
When on my deskj, I do
3) watch nicob's danganronpa let's plays
My current projects:
So lets make a list of what i love
Well so after some fiddeling around, I managed to release a first preversion of my versatile Machine learning library for C++: https://github.com/Wittmaxi/...
I'd be more than happy to see people start using my Lib lol
In case you have ANY feedback, just open an issue ;) (feedback includes code review lol)2
Someone is lacking ideas, he?
How about "what could you not give up in order to code efficiently?"5
Found my first project's code
incase anybody wants to see the madness: https://github.com/Wittmaxi/...
Hey @dfox @trogus
could you please adress those issues?
i'd really like to be able to browse devrant without being tracked
I didn't do a lot of research, I just saw the DDG extension tell me that devrant isn't that great. and I don't want devrant not to be that great11
Lets Start a list of all the impertant gnutools, everybody
- $(cd contdir; tar -cf - .) > $(cd destdir; tar -xf - .)
Ok dudes, theres something id like to get a bit of help with.
So lately ive always been struggeling with this constant fear of dying that makes me overthink everything.
Im not afraid of the pain or the experience of dying. Im afraid of the meaninglessness of my life before (the current one)
I know that we are just animals, yet i cannot get over this creeping feeling of the unknown18
Someone (QCat) on devRant offered me to be his contact, it ended up with him teaching me a HUGE lot of stuff, enabling me to now code an operating system alongside him (o and I learned maths, formalism, biology, chemistry, game dev, REAL C++, drawing [I still suck at all of them though] )
So yea, thats it from my side2
Urrg my secundary screen tipped over and now its broken.
like seriously wtf?
it only fell like 30 cm, why would it break that easily?
Anyway, back to one screen productivity. FML4
Why not to use gitlab:
-Runs on ruby which is VERY VERY VERY wasteful in processing power and thus in energy
-It's hosted on azure
Why to stay with github:
-There won't be a lot of change
-It's reliable and this won't change so fast
-It's like admitting defeat towards MS who want to ruin our lives lol29