[Rt-commit] rt branch, 4.4/migrate-progress-cache-clear-output, created. rt-4.4.3-39-g320c0ded1

? sunnavy sunnavy at bestpractical.com
Fri Aug 17 11:01:45 EDT 2018


The branch, 4.4/migrate-progress-cache-clear-output has been created
        at  320c0ded188e172b60cb2b4de284c7f27bf3e666 (commit)

- Log -----------------------------------------------------------------
commit 320c0ded188e172b60cb2b4de284c7f27bf3e666
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Aug 17 21:12:47 2018 +0800

    Cache `clear` output to avoid unnecessary system calls for better performance
    
    Repeatly system calls is expensive enough to slow down the process a lot
    when database is huge. In some worst cases, it even could make
    rt-importer 1000x slower.

diff --git a/lib/RT/Migrate.pm b/lib/RT/Migrate.pm
index 50251b023..55cd35c02 100644
--- a/lib/RT/Migrate.pm
+++ b/lib/RT/Migrate.pm
@@ -105,6 +105,7 @@ sub progress {
     my $start;
     my $left;
     my $offset;
+    my $clear = `clear`;
     return sub {
         my $obj = shift;
         my $force = shift;
@@ -117,7 +118,7 @@ sub progress {
         my $elapsed = $now - $start;
 
         # Determine terminal size
-        print `clear`;
+        print $clear;
         my ($cols, $rows) = (80, 25);
         eval {
             require Term::ReadKey;

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


More information about the rt-commit mailing list