On Wed, 30 Aug 2000 00:31:24 -0400, Stephen P. Potter wrote: >For every tr/// in a program, >256 bytes have to be allocated? Even if I only do something like tr/a/A/? >Is this really the optimal solution for this Speedwise, it is. You don't have to do any tests on the bytes. All you have to do is use the ord of the character (the byte value) as an offset in a table, and replace what you had with what you find in the table. A test and conditional jump instruction is a lot slower. Some processors, like Intel's x86, even have a special machine instruction to do that: XLAT. And, compared to how much memory perl needs to run anyway, what is 256 bytes? How many tr/// tables do you think you need? Even if it's 100, you still get only at about 25k of tables, which still isn't that much. -- Bart.
- RFC 165 (v1) Allow Varibles in tr/// Perl6 RFC Librarian
- Re: RFC 165 (v1) Allow Varibles in tr/// Mark-Jason Dominus
- Re: RFC 165 (v1) Allow Varibles in tr/// Nathan Wiger
- Re: RFC 165 (v1) Allow Varibles in tr/// Mark-Jason Dominus
- Re: RFC 165 (v1) Allow Varibles in tr/// Tom Christiansen
- Re: RFC 165 (v1) Allow Varibles in tr... Nathan Wiger
- Re: RFC 165 (v1) Allow Varibles in tr/// Bryan C . Warnock
- Re: RFC 165 (v1) Allow Varibles in tr/// Bart Lateur
- Re: RFC 165 (v1) Allow Varibles in tr/// Mark-Jason Dominus
- Re: RFC 165 (v1) Allow Varibles in tr... Stephen P. Potter
- Re: RFC 165 (v1) Allow Varibles ... Bart Lateur
- Re: RFC 165 (v1) Allow Varib... Bart Lateur
- Re: RFC 165 (v1) Allow Varib... Stephen P. Potter
- Re: RFC 165 (v1) Allow V... Mark-Jason Dominus
- Re: RFC 165 (v1) Allow V... Stephen P. Potter
- Re: RFC 165 (v1) Allow V... Tom Christiansen
- Re: RFC 165 (v1) Allow Varibles ... Tom Christiansen
- Re: RFC 165 (v1) Allow Varib... Stephen P. Potter
- Re: RFC 165 (v1) Allow V... Bart Lateur
- Re: RFC 165 (v1) Allow V... Tom Christiansen
- Re: RFC 165 (v1) Allow Varibles ... Jonathan Scott Duff