|
Nish - I don't think it's anything specific to Windows XP - I've noticed the same phenomenon on Windows 2000, especially with files on network drives... Think about it, for some files where there's more than just size & file times (like executables, where the version is shown in properties), Windows pretty much has to read in the whole file to get at the relevant bits...
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Alot of our customers have reported approx. the same thing... I heard something that it should be fixed in SP1 but I haven't got this confirmed.
Can't even confirm the "bug" since I don't run XP myself so please consider this second hand info (at best).
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
I'm looking for some inline assembly for a couple of simple things:
1. to invert all bits in a row of bytes. the typical C way is
BYTE *pIn...;
for (UINT x=0;x < bytes;x++)
{
pIn[x] = ~pIn[x];
}
i think this can be improved by doing the inverts a DWORD at a time, and by accounting for DWORD-alignment of the buffer. (i think this because that's what MS's memcpy and memcmp do. i just don't know enough assembly to do what i need)
2. logical-OR two equal-sized BYTE buffers
for (UINT x=0;x < bytes;x++)
{
BYTE a = pInA[x];
BYTE b = pInB[x];
pInA[x] = a & b;
}
again, i think this could be improved by processing 4 bytes at a time and by accounting for DWORD alignment.
anyone?
-c
I'm not the droid you're looking for.
|
|
|
|
|
And why exactly do you need to do it in assembly?
The mistakes made in this API make me realise that Microsoft has become big enough that it can shelter morons. If anyone working for me wrote anything this bad and tried to release it, I would kill them and display the body as a warning to the rest of the team. - Christian Graus about C# - GDI+
|
|
|
|
|
didn't anyone ever tell you it's not polite to answer a question with a question?
i want to do it in assembly for the same reason MS has all of its low-level string and memory function in assembly - performance.
-c
I'm not the droid you're looking for.
|
|
|
|
|
Before you start getting into assembler, the first thing I would do would be to modify the code to process the bytes in 4 byte blocks (ULONG) and then any remaining 0-3 bytes.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
but wouldn't be even nicer to have the bulk of the process operating on dword-aligned dwords, instead of just running down an array of non-aligned dwords ?
-c
I'm not the droid you're looking for.
|
|
|
|
|
Yeah, the alignment can be a big problem. Routines such as memcmp check first to make sure the data is aligned.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm sure it could be written better, and it doesn't handle DWORD alignment, but it will do the trick. For more information on the Intel instruction set:
http://www.intel.com/design/pentium4/manuals/245471.htm[^]
void Invert( unsigned char * p_pucData, unsigned long p_ulLen )
{
__asm
{
pusha
mov ecx, p_ulLen
mov ebx, p_pucData
head:
cmp ecx, 4
jle tailbytes
not dword ptr [ebx]
sub ecx, 4
cmp ecx, 0
je end
add ebx, 4
jmp head
tailbytes:
cmp ecx, 0
je end
not byte ptr [ebx]
add ebx, 1
sub ecx, 1
jmp tailbytes
end:
popa
}
}
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
just FYI, this takes less than 15% of the time of the first invert loop i posted:
int z;
BYTE *pb = pBuf;
UINT32 uLeadUp = (DWORD)pBuf & 0x03;
for (z=0;z < uLeadUp;z++)
{
*pb = ~(*pb);pb++;
}
uLen-=uLeadUp;
UINT32 dwords = uLen / 4;
UINT32 leftovers = uLen % 4;
DWORD *p = (DWORD*)pb;
for (z=0;z < dwords;z++)
{
*p = ~(*p);
p++;
}
pb+=4;
for (z=0;z < leftovers;z++)
{
pb[z] = ~pb[z];
}
-c
I'm not the droid you're looking for.
|
|
|
|
|
I just ran some tests, here are the results:
My Machine:
2GHz Pentium 4
512 MB Ram
Data: 180MB char array.
Test: Bitwise NOT the contents of the array 100 times, alternating between the assembly version and the C++ version.
Debug build:
C++ Version:
445 ms average.
Assembler Version:
285 ms average.
Release Build:
C++ Version:
268 ms average.
Assembler Version:
284 ms average.
I think the most significant optimization (from your original sample) is copying 32 bits at a time, rather than 8 bits at a time, but surely the alignment helps.
It also appears that the optimizer is definately your friend!
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
It also appears that the optimizer is definately your friend!
About a month ago, someone posted a speed fix for a strxxx routine. I thought the enhancement was cool, but really didn't think it would be better than the MASM strxxx routine in CRTL.
I was wrong.
My bet is that many of those old strxxx MASM routines haven't been reviewed for performance on newer machines. A lot has changed.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
My bet is that many of those old strxxx MASM routines haven't been reviewed for performance on newer machines. A lot has changed.
Imagine how much has changed even in just the last 4.5 years since VC6 was first released. I would not be surprised at all to find that those old asm routines need a bit of review.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I'm not an assembly geek, but did you consider
just assembly stepping into memcpy, copying their
code and modifying to to do whatever particular
operation you need? It should just involve replacing
a MOV instruction with an XOR or OR instruction.
Oh, on other thing, if you are going for fast
performance, I believe the special MMX instructions
of the Pentium processor can do this sort of stuff
really fast (obviously you'll have to check processor
version and provide an alternative for processors
without those instructions.)
|
|
|
|
|
I'm currently working on an MDI application that has dockable toolbars and a child window (view). I want to make a menu item that allows me to return the windows & toolbars to their initial position. I am able to place the toolbars successfully via docktoolbar(), but i cannot recall how to handle the child window. I would like to capture the window's position during/just after it's creation, and upon the appropriate menu call, restore that position. I've looked into Get/Set-WindowPlacement() but i'm very unclear on it's usage. Any advice would be appreciated, code is especially helpful.
I was also wondering how i can call the built in functionality from the window->tile menu command that tiles your child windows (from within my code at runtime).
Thanks
Jeff Rothenberg
Project Engineer
Vector CANtech, Inc.
|
|
|
|
|
Good Formating everyone !
I need to set the string length of a float number :
for example, I have this number :
345.22123123 , and the length is 4 , so the output will be 345.2 , no leader zero, or trunc/round at the end, it's only outputing the number; if the lenght is smaller than the representation of the number, I manage this already.
What's the magic formula for this ?
MSDN says :
%[flags] [width] [.precision] [{h | l | I64 | L}]type
But I'm not sure what width or precision to set, since the width is the minimum length, and the precision is what's after the decimal.
Thanks.
Clueless Max.
|
|
|
|
|
there's a g format token that helps ...
Max.
|
|
|
|
|
I would like to alter the caption displayed on the buttons in a MSVC++ Message box. I've currently got MB_YESNO buttons and would like to have them display Bi lingual text (ie. YES/OUI and NO/NON). Any ideas on how to do this.
Thanks in advance.
|
|
|
|
|
I believe you'll have to make your own dialog to do that. If you're using MFC, you can just create something in the resource editor with some generic buttons, and derive from CDialog and add a few functions to set the text.
As a note - the system Message Boxes will display their text in the language installed/selected on the machine. That is, on an English system, they show English, and on a French system, they show French, etc. So maybe you don't even need to change them...?
Even a broken clock is right twice a day.
|
|
|
|
|
It's not simple. You actually can't change the captions n a true message box; they are fixed.
However, you can use a class called TcxMessageBox to do this, along with a lot of other message box customizations. It's on CP, somewhere.
|
|
|
|
|
|
Hi all, hope someone can help.
Using GetCurrentHWProfile() to obtain GUID string in simple app. #defining _WIN32_WINNT (0x0400)(and #include "windows.h")which ensures that the program works fine with NT and Win2k, but f() fails on a Win98 machine even though the f() is supposed to work with Win95 OSR2 and upwards.
Can't find any documentation in the MSDN - anybody know of further #defines that are necessary for this to work on a Win9x machine?
Sonork ID: 100.13715 - 3bananas4
I have detailed files
|
|
|
|
|
Hi,
I want to spawn a process and wait for it to finish. I'm doing this in a seperate thread, so the user can continue working. The problem is that the new process comes popping up in front of the application each time! Now I could spawn the process with _P_DETACH, so the process is invisible, but that way I can't wait for the process to finish. That is important, because when the process finishes, I build a texture of it's output image. Is this possible and if so how?
Thanks in advance,
Wybren van Keulen,
Funny Farm
|
|
|
|
|
Go to MSDN and check out CreateProcess and WaitForSingleObject .
Even a broken clock is right twice a day.
|
|
|
|
|
Hi All,
I've got a CDialogBar derived class which contains a rich edit control, I am using this as a message window for an MDI app. How can I modify the right click menu that is shown? Currently, my options are "Hide" and "Undock" or something like that. I would llike to add a CLear option to the message window.
Thanks,
Aaron
|
|
|
|