it should be noted that those statements were method calls on the main language::befunge::interpreter object. and the method then was outputing things depending on the value of a debug attribute of the interpreter. the interpreter was not used outside of this.
knowing that method calls are expensive (since perl doesn't know until run-time where to find the method), i therefore created a language::befunge::debug module that exports a debug() sub. 2 other subs are provided (but not exported) to turn on/off the debug. (there's a trick here, that i will explain in another post).
net result? around 20% speedup (a bit more in fact). not bad for one hour spent on the subject. :-)
other than that, language::befunge tests got sanitized (using test::more, test::output and test::exception everywhere instead of crafting stuff by hand). part of this code was not touched since 2002...
finally, language::befunge got some new extensions, still passing all mycology tests. you can now enjoy the following in jqbef98:
- CPLI - complex numbers extension
- DIRF - directory operations
- FILE - file i/o operations
- FIXP - fixed point operations
- STRN - string operations
- SUBR - subroutines extension
- TIME - date/time operations
which leaded me to update language::befunge::debugger to load mycology correctly, with a new option to run without delay till the next breakpoint. using it, things were easier to get right. still not perfect, but already more than usable...
so, enjoy language::befunge 4.11 and language::befunge::debugger 0.3.6, now available on cpan!
If only it ran on DJGPP's Perl ....
ReplyDelete