Created
May 5, 2012 05:18
-
-
Save saitoha/2599985 to your computer and use it in GitHub Desktop.
端末のベンチマーク。minttyとputtyのwindows版だけはワイド幅文字のDECAWM挙動が変、iTerm2ではちょっと遅め、tanasinn(特にcygwin版)では非常に残念なパフォーマンスです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl | |
# -*- coding:utf-8 -*- | |
use strict; | |
sub initialize { | |
system "stty", '-icanon', 'eol', "\001"; | |
print "\e[?7s\e[?7l\e[?1049h\e[?7l"; | |
} | |
sub uninitialize { | |
print "\e[?1049l\e[?7r"; | |
system 'stty', 'icanon', 'eol', '^@'; | |
} | |
sub fill { | |
my ($str) = @_; | |
my $in = ''; | |
vec($in, fileno(STDIN), 1) = 1; | |
$| = 1024; | |
print "\e[2J"; | |
for (my $i = 1; $i < 100; $i++) { | |
print "\e[$i;1f"; | |
for (my $j = 0; $j < 20; $j++) { | |
print $str; | |
} | |
} | |
$| = 1; | |
print ""; | |
if (select ($in, undef, $in, 1)) { last; }; | |
} | |
$SIG{INT} = sub { | |
uninitialize; | |
exit 0; | |
}; | |
initialize; | |
eval { | |
while (1) { | |
# fill "abcdefghijklmnopqrst"; | |
# fill "ABCDEFGHIJKLMNOPQRST"; | |
fill " (」・ω・)」 うー! "; | |
fill "(/・ω・)/にゃー "; | |
} | |
}; | |
uninitialize; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment