Skip to content

Instantly share code, notes, and snippets.

@saitoha
Created May 5, 2012 05:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saitoha/2599985 to your computer and use it in GitHub Desktop.
Save saitoha/2599985 to your computer and use it in GitHub Desktop.
端末のベンチマーク。minttyとputtyのwindows版だけはワイド幅文字のDECAWM挙動が変、iTerm2ではちょっと遅め、tanasinn(特にcygwin版)では非常に残念なパフォーマンスです。
#! /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