Script Preparation code:
AخA
 
var txt="OYmY 40913621\nnwuTNuInsMG\nUOOORMSOUqjcqEZzsjBeOdbSLoTDWjYNVvBNgO\nDAOGfTjLo                       272S2g\nneGUXGmMk                       105990\nHLsseCJF                          7831\nEtjwsaYGrDy                   70151320\n\n\njluoGFq\nqn6078731934941y\ngvM pUBF OpSI       \ncdlLWA             NvqAnBWDwLtksdN3651\nHkbtikfGujwaENPvT                    0\n\nZaGSjFNG\neqXEKD                20b14T9889 26H10\ntmOSdeUIQVrODdMO                d04291\n\n\nnoyphDx                       5s04 RYV\n\nNOQhXAvYPUd\nRSMUwCKSFyAk rHta\n";function FR1(n,t,e,r,s=null){var l=Array(n+1).join(s||" "),a="";n>(t=null==t?"":t).length&&(a=l.substring(0,n-t.length)),n<t.length&&(a="");var g="";if("right"==e&&(g=a+t,r&&(g=g.substring(0,g.length-1)+" ")),"left"==e&&(g=t.length>n?t.substring(0,n-2)+a+"..":t+a,r&&(g=" "+g.substring(0,g.length-1))),"center"==e){var i=Math.floor((n-t.length)/2);g=l.substring(0,i),g+=t;var o=n-(g+=l.substring(0,i)).length;g+=l.substring(0,o)}return g}function F1(n){const t=document.createElement("p");t.style.textAlign="center";const e=n.split(String.fromCharCode(10));for(let n=0;n<e.length;n++){const r=document.createElement("span");r.innerHTML=FR1(38,e[n],"left",!1),t.appendChild(r),t.appendChild(document.createElement("br"))}return t.outerHTML}function F2(n,t=""){return`<p style="text-align: center;">${t}<span>${n.split(String.fromCharCode(10)).map(n=>FR1(38,n,"left",!1)).join(`</span><br>${t}<span>`)}</span><br>${t}</p>`}
Tests:
  • F1

     
    let res = F1(txt);
  • F2

     
    let res = F2(txt);
  • F2a

     
    let resA = F2(txt);
  • F1a

     
    let resA = F1(txt);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    F1
    F2
    F2a
    F1a

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4065.1 Safari/537.36
Chrome 82 on Windows
View result in a separate tab
Test name Executions per second
F1 3942.8 Ops/sec
F2 47192.5 Ops/sec
F2a 46754.3 Ops/sec
F1a 4066.0 Ops/sec