Hello,

I've tested the new H:T:JIT module. It really seems to be faster. Good job, Mr. Tregar.
Actually I had to modify the module slightly to be able to test it:

1)
old Compiler.pm line 87: 
use Inline C => Config => OPTIMIZE => "$optimize", DIRECTORY => "$self->{package_dir}" 
$inline_debug;

new Compiler.pm line 87: 
use Inline C => Config => OPTIMIZE => '$optimize', DIRECTORY => '$self->{package_dir}' 
$inline_debug;

I'm sure you can imagine what the backslash (used in Win32 paths) will do inside "..."

2)
Compiler.pm lines ~ 40-50:

    if ( $^O eq 'MSWin32' ) {
      print STDERR join("\n", @code);
    } else {
      open(INDENT, "| indent -kr > code.tmp");
      print INDENT join("\n", @code);
      close INDENT;
      open(CODE, 'code.tmp');
      print STDERR join('', <CODE>);
      close(CODE);
      unlink('code.tmp');
    }

Do not expect that M$ Windows ships with "indent" included. :-)

3)
Compiler.pm lines ~ 420

# concatenate a string onto result
sub _concat_string {
  return "" unless $_[0];
  my $len = length($_[0]);
  my $string = _quote_string($_[0]);
  $string = join( "\"\n                  \"", $string =~ /.{1,80}(?<!\\)/g ); # THIS 
LINE FIXES THE ISSUE
  return "sv_catpvn(result, \"$string\", $len);"
}

The join statement above is good if your C compiler doesn't handle too long lines. I 
have quite large texts without any <tmpl_*> tags in my templates and H:T:JIT converts 
these texts into one-line string. I don't know the exact line length limit of MS 
Visual C compiler but 3500 is too much for it :-)

The marked code will carefully split every string into shorter chunks one on line. 
Carefully means that the backslash will not stay at the end of the line:  that's not 
good to split "...\n..." into "...\" and "n...".

4)
JIT.pm 
  ...
  my $filepath = $self->_find_file(...);
  ...

Please let us define our own _find_file methods in successive objects.

5)
All the test are OK except "08print_to_stdout.t".
You really can't do "unless (open(TEST, '-|')) {" on MSWin32 (ActivePerl 5.6.1 build 
632) :-(
And I don't know how to test print_to_stdout functionality since "open STDOUT, 
'>log';" doesn't work for your output method.

open STDOUT, '>log';
print 'bla bla';             # prints into "redirected" STDOUT = 'log' file
$template->output;     # still prints to the "real" STDOUT = console

--------------------------------------

I hope I didn't forget anything.

regards

-- Petr Smejkal


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to