Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reverse a GUID? Fastest way?
Message
De
22/03/2008 00:02:40
 
 
À
21/03/2008 22:51:38
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01304506
Message ID:
01304517
Vues:
19
>>>>>Thanks
>>>>
>>>>May I ask why you want to do that?
>>>
>>>I can't tell you yet.
>>
>>err ... OK. ("yet" is the key word here)
>>
>Here's a sample of how I applied what you provided:
>
>
m.cGUID = REPLICATE(CHR(0),16)
>CoCreateGuid(@m.cGUID)
>m.cGuid = ;
>	BinToC(CToBin(Right(m.cGuid, 8), "BRS"), "BRS") + ;
>	BinToC(CToBin(Left(m.cGuid, 8), "BRS"), "BRS")
>
>It's a little faster. Looks like the timing I'm seeing is not just from the reversal process.
>
>Thanks

OK, a couple of things: CoCreateGuid takes its time too, try with this one instead, it is supposed to be a tad faster, since CoCreateGuid just calls this other API function.
Declare Integer UuidCreate In rpcrt4.Dll As apiUuidCreate ;
	String @Uuid

apiUuidCreate(@m.Uuid)
http://msdn2.microsoft.com/en-us/library/ms688568(VS.85).aspx

"The CoCreateGuid function calls the RPC function UuidCreate, ..."

If you don't mind giving away the MAC address in the GUID, try this one, MSDN says its a little faster:
Declare Integer UuidCreateSequential In rpcrt4.Dll As apiUuidCreateSequential ;
	String @Uuid

apiUuidCreateSequential(@m.Uuid)
http://msdn2.microsoft.com/en-us/library/aa379322(VS.85).aspx

"For security reasons, UuidCreate was modified so that it no longer uses a machine's MAC address to generate UUIDs. UuidCreateSequential was introduced to allow creation of UUIDs using the MAC address of a machine's Ethernet card."

"Note The UuidCreateSequential function tends to be slightly faster than the UuidCreate function. When the performance of the generation of a UUID is a significant consideration, the UuidCreateSequential function may be used."

So there you have two other options to try, and still waiting to find out what you are into...

Carlos
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform