arun823 (08-18-2012),demtrios (08-19-2012),Drake (08-20-2012),[MPGH]Flengo (08-26-2012),luccss (08-18-2012),NotRealPro (08-19-2012),Password77 (08-18-2012),pDevice (08-18-2012)
MultiThreading is already in the programs u develop, just behind the scenes. Take advantage of it to improve the performance of those multi-core processors and optimize it for the single thread processors.
example:
This will allow u to do multiple things at a time using multiple threads.The number of threads are limited to the number of logical processor and single thread processors will not see any performance change. Something like this will help u with your menus. The reason menus lag is because of the font. Having to draw every character in every string for every item. For each character in a string, in each items, that is a lot of time wasted in looping, but what if u could do more than one of these at a time.Code:#include <ppl.h> using namespace Concurrency; void Hook() { parallel_invoke( [&] { //Hook Present }, [&] { //Hook Endscene }); ); }
Example:
Please note that fonts not coded for concurrency may have rendering errors, if requested i will be willing to code a Font class for Concurrency
Depending on the number of logical cores the time it takes to render these times may differ.Code://This function will return the time it takes to call the function template <class Function> __int64 time_call(Function&& f){ __int64 begin = GetTickCount(); f(); return GetTickCount() - begin; } void DrawParallel() { parallel_for(0, 10, [&] (int i) { Font.DrawText(200, 20+ i*15, WHITE, "BLA BLA BLA"); }); } void DrawSerial() { for(int i = 0; i < 10; i++) { Font.DrawText(20 , 20 + i*15, WHITE, "BLA BLA BLA"); } } void RenderFont() { // Draws the time it takes to do these different Draws. Font.DrawNumber( 200, 10, WHITE, time_call([&] { DrawParallel(); } )); Font.DrawNumber( 20, 10, WHITE, time_call([&] { DrawSerial(); } )); }
Last edited by topblast; 08-18-2012 at 02:27 PM.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
arun823 (08-18-2012),demtrios (08-19-2012),Drake (08-20-2012),[MPGH]Flengo (08-26-2012),luccss (08-18-2012),NotRealPro (08-19-2012),Password77 (08-18-2012),pDevice (08-18-2012)
Thank you, I will make sure I implement this .
Doing more Java and Python
Need help with your hack? Ask me, I will try to help you with all my might .
thanks top
little info for beginners, how it works(shown in screenshots):
the code(tip: there is a namespace, but you should already figured it out)
first run
second run
you should see it. result is based on a dual core, 2.2GHz
ignore title of project, was a demo for my classmates lol
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
topblast (08-19-2012)
yes, it doesnt run things one after the other, but a random number can be picked to run in the threads
Because of this limits of 2 cores (guessing u have 2 threads), some threads are used again to process the information, so it Serializing in the parallel threads.
Running this code to time it and Sleep for 10 ms i got the times below, u can see the difference 8 threaded processor have over the 4 threaded one when using parallelism.
Running this code to time it and Sleep for 10 ms i got the times below, there is no difference between the 8 threaded processor and the 4 threaded one when using traditional for loops, performance wasted.Code:#include <iostream> #include <Windows.h> #include <ppl.h> template <class Function> __int64 time_call(Function&& f){ __int64 begin = GetTickCount(); f(); return GetTickCount() - begin; } int main(int argc, char** argv) { printf("Time : %i\r\n\n",time_call([&]{ Concurrency::parallel_for(0, 50,[&](int i) { printf("Output %i\r\n", i); Sleep(10); }); })); system("pause"); return 0; }
Code:#include <iostream> #include <Windows.h> #include <ppl.h> template <class Function> __int64 time_call(Function&& f){ __int64 begin = GetTickCount(); f(); return GetTickCount() - begin; } int main(int argc, char** argv) { printf("Time : %i\r\n\n",time_call([&]{ for(int i=0; i<50;i++) { printf("Output %i\r\n", i); Sleep(10); } })); system("pause"); return 0; }
---------- Post added at 11:05 PM ---------- Previous post was at 10:53 PM ----------
Test for AMD Phenom II x4 (Quad Core, 4 Thread) = 125 ms vs 499ms
---------- Post added at 11:09 PM ---------- Previous post was at 11:05 PM ----------
Test for Intel CORE i7 sandybridge (Quad Core x2 threads, 8 Threads ) = 62ms ~ 78 ms vs 499ms
: This is why Intel Better, more threads in a core, so 8 logical processors, just saying
Last edited by topblast; 08-19-2012 at 11:34 PM.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
race me to 3000
Intel i5 760 @2.8ghz
Last edited by matypatty; 08-20-2012 at 04:22 AM.
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
matypatty (08-21-2012)
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
matypatty (08-21-2012)
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
You're avoiding the problem, not addressing it. Anyways, we've had this discussion before so there's no need to rehash it but even with my extremely limited knowledge of directX, I can see lots of better ways to improve menu efficiency rather than just taking a "fuck it, computers are powerful, I don't need to code well" approach.
Off-screen surfaces,
Blitting,
Rendering to the backbuffer.
Google any, or a combination of these and you'll see what I'm talking about. A huge portion of the menu never changes, and when it does it's usually in response to user input. There's no need to redraw the menu piece-by-piece every time present/endscene is called. Simply draw it to an offscreen surface once and blit it to the display when needed. When the user provides some input, you can just redraw the offending parts on the offscreen surface (or the whole menu if need be). Far less unnecessary overhead and calls to performancing-hitting functions like DrawText.
As I said, I have only a limited knowledge of DX, there are probably dozens of ways to further improve efficiency.
You can win the rat race,Originally Posted by Jeremy S. Anderson
But you're still nothing but a fucking RAT.
++Latest Projects++
[Open Source] Injection Library
Simple PE Cipher
FilthyHooker - Simple Hooking Class
CLR Injector - Inject .NET dlls with ease
Simple Injection - An in-depth look
MPGH's .NET SDK
eJect - Simple Injector
Basic PE Explorer (BETA)
my sites are approach have change, the thing is I already optimized the DX functions as much as my current knowledge can take me. now i am optimizing it be putting speed into the memory manipulation.
Also it will be more work than anything to be checking to see if the menu change also many functions of the menus requires the part that people don't see.
The part i am really trying to optimize is the filling of the vertices for the font.
while (*strText++)
as it adds one character to the vertexbuffer. this part is not really d3d its filling an array, a large array.
If u have any ideas please share.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development