Ludovic 'Archivist'
Actually no, it's end of the first gen
~
Ahh cant send :(
Ludovic 'Archivist'
dm it to me
Ludovic 'Archivist'
I have references for dynamic data from database, here .Net is higher than drogon, although the .Net code is not a code a common .Net dev will write :( but this can be a reference in case you may want to squeeze every bit of performance of .Net https://www.techempower.com/benchmarks/#section=data-r23&test=query
Ludovic 'Archivist'
Ahh cant send :(
The code written for drogon was extremelly convoluted, and used features of drogon that I would never use for their performance cost
Ludovic 'Archivist'
It was basically running on mostly one core because of that
~
The code written for drogon was extremelly convoluted, and used features of drogon that I would never use for their performance cost
Umm but the one who wrote the code is an-tao the drogon creator note: the code for round 23 is in tag 23 not the one in the master branch
Ludovic 'Archivist'
Umm but the one who wrote the code is an-tao the drogon creator note: the code for round 23 is in tag 23 not the one in the master branch
After checking I get why he did that, but that definitively is an expensive way to handle ContentType
Ludovic 'Archivist'
Umm but the one who wrote the code is an-tao the drogon creator note: the code for round 23 is in tag 23 not the one in the master branch
He also uses his ORM in the example but that shit is slow as fuck and converts everything to Json to parse it again
Ludovic 'Archivist'
If there is one thing I pray C++ reflection will solve it is this shit: shitty ORMs
~
Umm may you explain more about the expensive content-type? Because in the code, he uses HttpResponse::newHttpJsonResponse() to set the content type which is the same as the one in the official drogon repo
~
There are 2 versions of Drogon tested there, one without orm and the other with orm. In the multi queries page, ctrl f and type drogon you should see 2 versions of Drogon, Drogon core (no orm), just Drogon (orm)
Chat Boss
Both use the ORM, the core just uses a less weird version of the ORM that is faster
~ sent a code, it has been re-uploaded as a quote Umm have you checked the controller DbCtrlRaw.cc, I don't find drogon orm method here #include "DbCtrlRaw.h" #include "World_raw.h" #include <drogon/utils/Utilities.h> #include <stdlib.h> #include <thread> #include <time.h> void DbCtrlRaw::asyncHandleHttpRequest( const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback) { // write your application logic here static std::once_flag once; std::call_once(once, []() { srand(time(NULL)); }); if (!*_dbClient) { *_dbClient = drogon::app().getFastDbClient(); } int id = rand() % 10000 + 1; auto callbackPtr = std::make_shared<std::function<void(const HttpResponsePtr &)>>( std::move(callback)); **_dbClient << "select * from world where id=$1" << id >> [callbackPtr](const Result &rows) { if (rows.size() == 1) { auto obj = World(rows[0]); (*callbackPtr)(HttpResponse::newHttpJsonResponse(obj.toJson())); } else { Json::Value json{}; json["code"] = 0; json["message"] = "Internal error"; (*callbackPtr)( HttpResponse::newHttpJsonResponse(std::move(json))); } } >> [callbackPtr](const DrogonDbException &err) { Json::Value json{}; json["code"] = 1; json["message"] = err.base().what(); (*callbackPtr)(HttpResponse::newHttpJsonResponse(std::move(json))); }; }
mito
But hey, I can serve 60000 request a second on 4 cores from 2011
Can you recommend some articles on this (if you could find or know)? I'm working on something similar as part of my job, but to serve raw TCP packets.
Aditya Pattewar
Hi I am new in c++ please help me
Zeth
Hi I am new in c++ please help me
what do you need help with?
Zeth
#meta
Rose
#meta
Don't ask meta questions. In other words, don't ask to ask. Questions like "Does anyone know XYZ?", "Has anyone used XYZ?" or "Can someone help me?" are all considered meta questions because they don't specify what your actual problem is. These questions give the impression that you want people to approach you and offer their help as if they don't have any other work to do. Now doesn't that expectation make you look like an idiot? If you have a question ask it directly. You are more likely to get a response that way.
Cayetano
Vlad
Super usefull!! Thanks Vlad!!
You're welcome. Would google for you again
CodeBy
Help me understanding pointers and recursion in C
Vlad
We'll start from there
Vlad
Otherwise sending you mucho texto for both will not help probably
Vlad
Damn his message got deleted
Vlad
1984
Vlad
pajeets have killed our freedom of speech
Metz
Good afternoon
Cayetano
Help me understanding pointers and recursion in C
May this could be usefull https://x.com/chessMan786/status/1944802899990643144?t=JQhDLx-LXL23Tly4StsoPA&s=19
Cayetano
Nice! @CodeByOm feedback with your expirence... 🙏
CodeBy
What you don't understand?
Like when I have to make projects I am unable to use them I watched some videos on YouTube too but it's confusing for me like to access value in a variable by its address,I always gets struck there and make errors
CodeBy
You just don't know what problems it solves
Ya exactly I am unable to understand the logic and right use and am just trying to fit it somewhere where it's of no use , i mean that's what I think my problem is
CodeBy
Especially with pointer concepts
Vlad
So here's a somewhat real world example: typedef struct { ... } Item; Item inventory[3]; Item* currentItem = NULL; void input(...) { if(keyPressed(KEY_1)) currentItem = &inventory[0]; if(keyPressed(KEY_2)) currentItem = &inventory[1]; if(keyPressed(KEY_3)) currentItem = &inventory[2]; if(keyPressed(KEY_E)) UseItem(currentItem); }
Vlad
Using a pointer you can bind a currently chosen item
Vlad
Without doing weird stuff like copying it over to a seperate variable
Vlad
That you should then update if its slot changes for whatever reason
CodeBy
Okayy I think I need to practice this more
Vlad
Okayy I think I need to practice this more
Do you know what primary and foreign keys in the sql are?
Vlad
Yup
Pointers are similar to foreign keys
Vlad
Serve the same purpose
CodeBy
Primary can be one unique key whereas foreign keys represents a value in other table
Vlad
Pointer is your key to get the value "from the other table"
Vlad
But instead of painfully doing joins
Vlad
You can just dereference it
CodeBy
Ok I'll continue asking tomorrow morning 😃 btw thanks for letting me understand it in easier termd
Demon 918
yo i need some dev or something
salami
Huh
Vlad
yo i need some dev or something
Is this supposed to be a job description?
Never Spam Bot
Faathin is now approved by the group admin and can send messages without any restrictions Hey guys, I recently learn futex2 API : futex_wait, futex_wait, ``futex_waitv`, and futex_requeue but I don't how to use futex_requeue and the use case of it? Can someone tell me? See spam? Quote the spam message in the group and reply with /spam
mito
yes
and the payment is gonna be drugs yo ?
Faathin
Hey guys, I recently learn futex2 API : futex_wake, futex_wait, futex_waitv, and futex_requeue but I don't how to use futex_requeue and the use case of it? Can someone tell me?
CodeBy
Can someone tell me why is my gets(str) is not working 😭 It doesn't even shows an option to input string just directly prints . I don't want to use scanf that why I'm using it but it doesn't work
Vlad
It's unsafe
CodeBy
Why how will I input multiple words
Vlad
CodeBy
It's unsafe
How come it is unsafe?
Vlad
How come it is unsafe?
It doesn't know buffer size
CodeBy
Use fgets
I used it fgets(str) it shows error
Vlad
So if the input string is too long it would just continue writing past that
Vlad
I used it fgets(str) it shows error
https://en.cppreference.com/w/c/io/fgets
CodeBy
Okayy
Vlad
Read the docs pliz
Vlad
It needs 3 params
CodeBy
What's that stream?
Vlad
char input[256]; fgets(input, sizeof(input), stdin);
CodeBy
Like address?
Vlad
What's that stream?
FILE* descriptor
Vlad
console input is also mapped as a FILE*
CodeBy
Okay so I have a string named str[300] now ?
Vlad
Okay so I have a string named str[300] now ?
Thou shalt have the string of sizeof(str) - 1 symbols + one symbol is reserved for the null terminator
CodeBy
Why can't I take input from printf() command it just prints itself not asking for input