Comment #15 on issue 265 by m.niloc: Slow pasting
http://code.google.com/p/yi-editor/issues/detail?id=265

This small change speeds up Yi in my test from 5.5s to 3.5s. It is ugly and  
I don't
think it should be committed; my only point here is to demonstrate that  
prepareAction
is definitely performance-critical.

hunk ./Yi/UI/Vty.hs 292
          tabWidth = tabSize . fst $ runBuffer win b indentSettingsB
          prompt = if isMini win then miniIdentString b else ""

-        (rendered,toMarkPoint',cur) = drawText h' w
+        (rendered,_,cur) = drawText h' w
                                  fromMarkPoint
                                  point $
                                  tabWidth
hunk ./Yi/UI/Vty.hs 298
                                  ([(c,(wsty, (-1))) | c <- prompt] ++  
bufData ++ [('
',(wsty, eofPoint))])
                               -- we always add one character which can be  
used to
position the cursor at the end of file
+        bufDataPlain = setSty undefined text
+        (_,toMarkPoint',_) = drawText h' w
+                                fromMarkPoint
+                                point $
+                                tabWidth
+                                ([(c,(wsty, (-1))) | c <- prompt] ++  
bufDataPlain ++
[(' ',(wsty, eofPoint))])
+                             -- we always add one character which can be  
used to
position the cursor at the end of file
          (_, b') = runBuffer win b (setMarkPointB toM toMarkPoint')
          (modeLine0, _) = runBuffer win b $ getModeLine (commonNamePrefix e)
          modeLine = if notMini then Just modeLine0 else Nothing


For timing I'm using the LaTeX test HackerMain.hs above renamed to Main.hs,  
plain
"cabal configure" so no profiling, and a shellscript using the "empty"  
terminal
redirection tool: "empty -f -i in -o out -f ./yi && time cat out  
>/dev/null".

Before:

$ sh time

real    0m5.473s
user    0m0.000s
sys     0m0.000s

After:

$ sh time

real    0m3.499s
user    0m0.000s
sys     0m0.004s


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Yi development mailing list
yi-devel@googlegroups.com
http://groups.google.com/group/yi-devel
-~----------~----~----~----~------~----~------~--~---

Reply via email to