The script below prints a list of 34 Burmese characters. I happen to
have a font for these but I'm not sure that matters.
If I run the script in BBEdit or TextWrangler just after launching
the apps, there is a huge delay before the output is printed (up to
15 seconds) but subsequent runs produce no special delay.
#!/usr/bin/perl
binmode STDOUT, q~:utf8~;
for (4096..4129) {
$c = chr();
$text .= qq~$_\t$c$/~;
}
print $text;
I get the same sort of behaviour if I run the script in Script Editor
or Smile as a shell script, but there is no delay running it in
Terminal.
Can anyone explain what causes this delay?
JD
> The script below prints a list of 34 Burmese characters. I happen to
> have a font for these but I'm not sure that matters.
>
> If I run the script in BBEdit or TextWrangler just after launching the
> apps, there is a huge delay before the output is printed (up to 15
> seconds) but subsequent runs produce no special delay.
First guess is font caching, which is mostly the time to find and load
glyphs. It looks like you might be also implicitly invoking the
relevant parsing attribute tables, which will also take some time to
find and load.
> #!/usr/bin/perl
> binmode STDOUT, q~:utf8~;
[quoted text clipped - 7 lines]
> or Smile as a shell script, but there is no delay running it in
> Terminal.
Perhaps this reflects that terminal has advanced quite a bit since
jaguar, to the point of pre-loading many of the relevant tables?
Perhaps Script Editor and Smile are also loading some sort of run-time
interpreter which has to do its own caching of font and parsing tables?
Perhaps those two are using Java, maybe? Java does a lot of pre-flight
checking both syntax and rudimentary semantics for security purposes.
Perhaps they are loading a separate copy of the perl interpreter?
> Can anyone explain what causes this delay?
Good question.
> JD
John Delacour - 06 Dec 2005 22:47 GMT
>First guess is font caching, which is mostly the time to find and
>load glyphs. It looks like you might be also implicitly invoking the
>relevant parsing attribute tables, which will also take some time to
>find and load.
It's interesting (to me) that if I go for Korean characters rather
than Burmese, there is no appreciable delay. It seems some sort of
obstacle exists in the way of finding the necessary font/glyphs.
#!/usr/bin/perl
binmode STDOUT, q~:utf8~;
###for (4096..4129) {
for (44032..44066) {
$c = chr();
$text .= qq~$_\t$c$/~;
}
print $text;
I'll try to narrow it down by testing with various runs of characters.
JD