My program is a simulator for a scripting language that is multi-threaded, although the Perl program itself is single-threaded. The simulator is a mini-OS with threads that are dynamically created, executed, and destroyed.
I use hashes to track the internal states of the threads, their variables, an internal debugger, etc. It's important that user scripts are dispatched in identical order across runs for repeatability and debugging, and the general sanity of the users and the developer. -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 6:15 PM To: Gavin Bowlby; beginners@perl.org Subject: RE: question on Perl determinism with hash keys Understandable. Why do you need the keys function to return the keys in the same order? What is it that you're trying to do? -----Original Message----- From: Gavin Bowlby [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 5:57 PM To: Timothy Johnson; beginners@perl.org Subject: RE: question on Perl determinism with hash keys I don't want to do this sorting because I have many hashes within my Perl program that are changing at a high rate, and I'm trying to optimize performance within my Perl program. -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 5:47 PM To: Gavin Bowlby; beginners@perl.org Subject: RE: question on Perl determinism with hash keys I personally have never felt the need. One thing I'll often do is a foreach(sort keys %hash){ #do something... } If you know what the keys are going to be ahead of time that might work for you. -----Original Message----- From: Gavin Bowlby [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 5:37 PM To: Timothy Johnson; beginners@perl.org Subject: RE: question on Perl determinism with hash keys Timothy et al: Thanks, I did mean in the same order. Any idea on the relative performance of a hash tied to IxHash vs. a vanilla hash? I have a Perl program with many hashes whose entries are created and destroyed at a high rate, and I'm wondering if I can expect a performance hit if I make this change... Gavin -----Original Message----- From: Timothy Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 5:28 PM To: Gavin Bowlby; beginners@perl.org Subject: RE: question on Perl determinism with hash keys If you mean in the same order, then no. perldoc -q order -----Original Message----- From: Gavin Bowlby [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 16, 2006 5:25 PM To: beginners@perl.org Subject: question on Perl determinism with hash keys All: If I populate a %hash within a Perl program, is there any guarantee that from run to run of the same Perl program the keys(%hash) function will return identical sets of keys? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>