mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
9ab60dabcc
Simple scripts to generate performance benchmarks for label, macro and token lookups. The label and macro lookups are simple numerical sequences; it may be desirable to add some more sophisticated algorithms for producing tokens in case we want to compare different hash functions against each other.
24 lines
436 B
Perl
Executable File
24 lines
436 B
Perl
Executable File
#!/usr/bin/perl
|
|
#
|
|
# Generate a test case for token lookup performance
|
|
#
|
|
|
|
@insns = qw(add sub adc sbb and or xor mov);
|
|
@regs = qw(eax ebx ecx edx esp ebp esi edi);
|
|
|
|
srand(0);
|
|
sub pickone(@) {
|
|
return $_[int(rand(scalar @_))];
|
|
}
|
|
|
|
($len) = @ARGV;
|
|
$len = 1000000 unless ($len);
|
|
|
|
print "\tbits 32\n";
|
|
print "\n";
|
|
|
|
for ($i = 0; $i < $len; $i++) {
|
|
print "\t", pickone(@insns), " ",
|
|
pickone(@regs), ",", pickone(@regs), "\n";
|
|
}
|